SD/MMC mod

From DD-WRT Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 20:58, 29 November 2007 (edit)
S2s2 (Talk | contribs)
m (Subsequent Modifications)
← Previous diff
Current revision (18:05, 16 November 2017) (edit) (undo)
Ian5142 (Talk | contribs)

 
(24 intermediate revisions not shown.)
Line 1: Line 1:
-[[Category:Buffalo]]+* [[Linksys WRT54G-TM SD/MMC mod]]
-Update: 2007-11<br>+* [[Buffalo WHR-G54S and WHR-HP-G54 SD/MMC mod]]
-The original tutorial, was attempted, by at least two users, specifically on WHR-HP-G54's. ''Of a variety of SD and MMC cards, none worked''. Additional information ''with what did work'' is [[#Results (when it didn't work)|below]].+* [[Hinzufügen_eines_SD-Kartenlesers_an_den_Linksys_WRT54G|SD-Kartenlesers an den Linksys WRT54G]] - Original descriptions (in german)
-__TOC__+
-== SD/MMC Modification for the Buffalo WHR-G54S and WHR-HP-G54 wireless router ==+
-=== Introduction ===+
-This tutorial guides you through adding a [http://en.wikipedia.org/wiki/Secure_Digital_card SD] or [http://en.wikipedia.org/wiki/MultiMediaCard MMC] interface to the Buffalo WHR-G54S and Buffalo WHR-HP-G54 router and gives some general information and tips to help you to do the same with other DD-WRT routers. The DD-WRT V2.4 firmware supports this modification, so there is no need to install modules or packages. All configurations can be done from the web interface.+[[Category:Linksys]]
- +[[Category:Hardware]]
-The modification will allow you to add non-volatile memory to your router. I recommend using a SD card up to 1GB. Some forum users reported that they got 2GB working, but both my 2GB cards failed to work. This might be solved in future with an updated MMC driver, but probably my SD cards are to blaim. The problem is that there are quite a number of incompatible 2GB card around.+
- +
-This modification might also work with MMC cards, but the used communication protocol(SPI) is optional for MMC cards. It is only required for SD and mini-SD cards. '''So start with a SD card of 1GB or less to confirm that everything is working.'''+
-1GB does perhaps not sound like a lot, but for this application it is huge!+
- +
- +
-'''So what can you do with this added storage capacity:'''+
- +
-* Store your own custom programs, scripts and packages (standard or [[Optware|optware]]) +
- +
-* Store communication and packet logs+
- +
-* Store your e-mail database for your e-mail server+
- +
-* Store your files for your web server+
- +
-* Store your files for your ftp server+
- +
-* Provide (very slow) swap space+
- +
- +
-There is another way to add storage capacity to your router, and that is by mounting a shared directory on your computer. DD-WRT supports Samba shares, which is the default Windows sharing mechanism. Samba shares can also be made with Linux. Mounting a shared directory will make the available hard disk space accessible to your router.+
- +
- +
-Compared to the SD/MMC modification using Samba this has some disadvantages:+
- +
-* Samba only works over a wired connection (so a wire between the PC and router is required)+
- +
-* Your PC needs to be powered up for the storage capacity to be available+
- +
- +
-You can read more about how to mount a directory with Samba here: [[Samba_Filesystem|The Samba Filesystem]]+
- +
-Note: The Samba tutorial is outdated. I will add a section to it to show you how to mount a Samba share with the V2.4 firmwares.+
- +
-=== Requirements ===+
- +
-To execute this modification you will require the following:+
-* A soldering iron with a small tip (20 to 40 watts, controllable temperature is recommended)+
- +
-* Some soldering tin+
- +
-* A multi-meter+
- +
-* Some glue to fixate the wires and parts (I recommend rubber glue)+
- +
-* Some thin wires (diameter about 0.18 mm)+
- +
-* A SD card (1GB or less is recommended)+
- +
-* A SD card adapter (see below for some suggestions)+
- +
- +
-The modification is not difficult to implement, but some decent soldering skills are required and knowing how to operate a multi-meter would be very handy.+
- +
-=== The SD card ===+
- +
-Let's have a look at the requirements to access an SD card via the simplest available protocol: [http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus SPI (Serial Peripheral Interface)].+
- +
-{| border="1" cellpadding="4" cellspacing="2" style="text-align:center"+
-|-+
-!SD Pin !! SD function(SPI Mode) !! Direction !! The SD Card pin assignment+
-|-+
-| 1 || Chip Select (CS) * || IN || rowspan="10" |[[Image:WHR_G54S_SD_MOD-SD_Card.png]] +
-|-+
-| 2 || Data In (DI) || IN +
-|-+
-| 3 || Ground || - +
-|-+
-| 4 || Vcc (3.3v) || - +
-|-+
-| 5 || Clock (CLK) || IN +
-|-+
-| 6 || Ground || - +
-|-+
-| 7 || Data Out (DO) || OUT +
-|-+
-| 8 || Reserved || - +
-|-+
-| 9 || Reserved || - +
-|-+
-| colspan="3" | (*) A ''low'' level on "Chip Select" selects the chip+
-|}+
- +
- +
-From this we can see what is needed:+
- +
-* Ground+
-* Power, 3.3 volt+
-* 3 outputs (that are going to control the 3 inputs of the SD card)+
-* 1 input (that is going to read the data from the SD card output)+
- +
- +
-In fact we do not actually need to actively select the SD card via the Chip Select line. We can just always select it by grounding the signal. So in that case we only need 2 outputs. Now let's get to it and open our router to find what we need.+
- +
-=== How to open your router ===+
- +
-Check this Wiki [[How to open my router|How to open the Buffalo WHR-HP-G54]] to see how to open your router without breaking it. Inside you will find a printed circuit board(PCB).+
- +
-=== Finding suitable IO points ===+
- +
-Once you have opened the router you will have access to the PCB. We need to find several points on the board that we are going to use to build our SD/MMC interface. To find these points we will need our general purpose friend, the multi-meter.+
- +
-==== Finding Ground ====+
- +
-It is very easy to find a grounded point, because ground is present all over the PCB. In most cases the input power ground will also be the ground for the whole PCB. So start looking at the input power connector. This connector has quite big soldering pads, which makes it easy to add an extra wire. Once this point is found, verify it by checking big metal object on the PCB. Usually the metal housing around the transmitter (see pictures below to find it) will be grounded too. To verify that the points are connected use the conductivity check of the multi-meter. Make sure the router is powered down. The connection between the points should give you a very low resistance, about the same resistance as what you would get when just shorting the multi-meter probes.+
-With the Buffalo WHR-G54S I found that the metal mounting pins for the AOSS switch are also grounded(indicated with SD3/6 in the picture below). This gave me an easy ground access point, and is also a nice point for the routing of the wires.+
- +
-==== Finding power, 3.3 volt ====+
- +
-Once a grounded point is found we can start looking for the 3.3 volt power supply that we need. Check your power supply specification that is written on it. Check if it provides AC or DC at the output. Often AC is indicated with a wavy line: <font size="5">'''~'''</font>. DC is indicated like this: [[IMAGE:WHR_G54S_SD_MOD-DC_Symbol.gif]]. Verify the information on the power supply with a multi-meter.+
- +
-If the power supply output is 3.3 volt DC, then check the power socket connection at the PCB for 3.3 volt. To verify this you need to power up the router. Be very careful with this, as it is very easy to short circuit the board with some parts lying around. Switch the multi-meter to DC volt measurement, range 0-20 volt. The actual value that you find might be slightly higher or lower than 3.3 volt(3.1-3.5 volt). If you power supply states an output voltage higher than 3.3 volt (usually 5 or 12 volts) then the PCB contains a power regulator to lower the input voltage to 3.3 volt DC. You will need to find this power converter, and it's 3.3 volt DC output. The power converter is a big component, usually close to the input power socket. Power up the router and connect one multimeter probe to a grounded point. Then carefully use the other probe to check the voltage at big pads of the big components close to the power socket until you find the 3.3 volt DC power supply. Below you can see what is printed on my power supply. It states that it delivers 3.3 volts DC, and maximal 2 amps. How convenient!+
- +
-[[image:WHR_G54S_SD_MOD-Power_Supply.jpg]]+
- +
-==== Finding general IO output points ====+
- +
-To control the SD card we need some outputs, which are connected to the inputs of the SD card. Routers usually contain LED's to signal their status. This gives us a easy opportunity to find some output points. The only disadvantage of this is that we will lose the signaling functionality of the LED's because they are now used for the SD card communication. What we first should establish is which LED's we can control by software. To do this login to the router and use the "gpio" command. So under Windows type in your dos box:+
- +
- telnet <router IP address>+
- +
-The default IP address is 192.168.1.1. Telnet needs to be enabled for this, which it is by default. You can enable or disabled it in the services tab of the web interface.+
- +
-The login name is: "root", even if you changed the router name. The default password is "admin".+
- +
-The syntax of the gpio command is like this:+
- +
- gpio enable <IO pin number> # to enable a IO pin, which switches the LED off+
- gpio disable <IO pin number> # to disable a IO pin, which switches the LED on+
- gpio poll <IO pin number> # to read the status of a switch+
- +
-For the ''<IO pin number>'' use numbers between 0 and 14. So watch the LED's closely while giving the gpio commands. You can also use this little command line to make your life easier:+
- +
- while true; do gpio disable 1; sleep 3; gpio enable 1; sleep 3; done+
- +
-It will switch on the LED for 3 seconds, then switch if off for 3 seconds, and so on.+
-You will need to press <CTRL> + "c" to exit from this command.+
- +
-Replace the "1" in two places to change it for other IO pin numbers. In the screen capture below you can see how it should look.+
- +
-[[Image:WHR_G54S_SD_MOD-Telnet_DOS_BOX2.png]]+
- +
- +
-'''There is one important thing to consider!''' The IO pins can be used for input and for output purposes, and as you might know, there is usually a reset switch on a router. So what would happen if you write the status of the pin that is used to see if the reset button was pressed!? Right, you create a reset. This is not a problem, when this happens you will lose the telnet connection and see the LED's flashing like when you reset the router. When the router restarts it can happen that the reset button is still "pressed", which will cause the router to reset the NVRAM to factory default values. It should be clear that you cannot use this IO pin for the SD card interface.+
- +
-Now go through all the IO numbers and record accurately which LED's are software controllable by which IO pin number. In many cases you will not see a LED changing. This means that the IO is not in use, or perhaps is used for input purposes. For my buffalo this yielded this:+
- +
- GPIO 1 - Bridge LED (Green, 3rd LED from top on front panel+
- GPIO 2 - WLAN LED (Green)+
- GPIO 3 - Extra LED between bridge and WLAN (Green, not visible from the outside)+
- GPIO 6 - AOSS LED (Orange, on top)+
- GPIO 7 - Diag LED (Red)+
- +
-And I found that the reset button is behind GPIO 4:+
- +
- GPIO 4 - Reset Button+
- +
- +
-The power LED is not software controllable in my router.+
-We need 2 or 3 outputs and we 5 found, so let's make some choices. Let's use the extra LED and the AOSS LED, the bridge LED is optional.+
- +
-So now we have found some LED's that we can control by software. Each LED has 2 connections, a positive site (anode) and a negative site (cathode). So an important question arises.+
-'''Which side of the LED do we need to connect to?'''+
- +
-To answer this we need to use the multi-meter again. Make the LED that needs to be analyzed flash with the command described above. Ground one probe and measure the voltage on each side of the LED. We need to use the side of the LED that that changes between about 0.2 volt when it is on, and 3.3 volt when it is off. The '''wrong''' side will be at about 2 volts when the LED is on, and 3.3 volt when it is off.+
- +
-In the Buffalo router one side of the LED is marked with a "+", we will need to use the '''other side''' of the LED.+
- +
-==== Finding a general IO input point ====+
- +
-We need to find 1 input. The switches on the router are the candidates for this. The Buffalo WHR-G54S router has 3 switches:+
- +
-* A reset switch, which is not suitable to use as it has some side effects ;)+
-* The AOSS switch+
-* The Auto/Bridged switch+
- +
- +
-We can use the "gpio" command again, this time to read the IO status:+
- +
- gpio poll <IO pin number> # to read the status of a switch+
- +
- +
-This command will wait until a change in the switch position is detected and signal this by printing "00" or "01". So execute the command and press all (except reset) switches and check if you see some output on the screen.+
- +
-We will need to press <CTRL> + "c" to exit from this command. Try this with all IO numbers that were not connected to a LED.+
- +
- +
-In my case this yielded:+
- +
- GPIO 0 - AOSS button on top (State 00 is down, state 01 is up)+
- GPIO 5 - Auto/Bridge Switch (State 00 is "bridge", state 01 is "Auto")+
- +
-I already knew that the reset switch was behind GPIO 4. I choose to use the auto/bridges switch because this switch is not very useful. With the DD-WRT firmware it not used anyway. The router mode is defined by the software settings, not by the switch.+
- +
-The switch has several leads going into the PCB. So we need to find out which lead/soldering pad we need to access so the system can read the IO status from the pin. To find this pad we need a multi-meter again. We need to find the soldering pad that is at about 3.3 volt when the switch is in 1 position, and close to 0 volt when it is the other position. See the picture below to see which solder pad I found. +
- +
-'''It is very important to leave the switch in the position where the multi-meter reads 3.3 volt, otherwise the switch is forcing the IO line to a certain level, which makes it unusable. Here we need to leave the switch in the "Auto" position.'''+
- +
-=== The wiring layout ===+
- +
-In total this yielded the following wiring layout:+
- +
-{| border="1" cellpadding="4" cellspacing="2" style="text-align:center"+
-|-+
-! colspan="3" | SD CARD !! colspan="3" | Router !! The SD card pin assignment+
-|-+
-|Pin || Function(SPI Mode) || Direction || IO || Function || Direction || rowspan="11" | [[Image:WHR_G54S_SD_MOD-SD_Card.png]]+
-|-+
-| 1 || Chip Select (CS) * || IN || Ground (or GPIO 1) || (Bridge LED) || OUT +
-|-+
-| 2 || Data In (DI) || IN || GPIO 6 || AOSS LED || OUT +
-|-+
-| 3 || Ground || - || Ground || Ground || - +
-|-+
-| 4 || Vcc (3.3v) || - || Vcc (3.3v) || Vcc (3.3v) || - +
-|-+
-| 5 || Clock (CLK) || IN || GPIO 3 || Extra LED || OUT +
-|-+
-| 6 || Ground || - || Ground || Ground || - +
-|-+
-| 7 || Data Out (DO) || OUT || GPIO 5 || Bridge/Auto switch || IN +
-|-+
-| 8 || Reserved || - || - || - || -+
-|-+
-| 9 || Reserved || - || - || - || -+
-|-+
-| style="text-align:left" colspan="6" | (*) A ''low'' level on "Chip Select" selects the chip+
-|}+
- +
- +
-'''The use of GPIO 1 for the "Chip Select" signal is optional. If you don't use it then just ground SD pin 1.''' You might swap around the LED's any way you like, but make sure to reflect this also in the DD-WRT Gui(see below). I've seen that some people build this modification and connect router outputs to the SD card output. '''This is confirmed to work too, but is not recommended!''' It might destroy your router and/or your SD card. The reason why it works is because the IO's are general purpose IO's, which means that they can be reconfigured in software to work as an input or output. But what happens during boot up, when the LED's are flashing!? Just don't do this!+
- +
-=== Getting a SD card adapter ===+
- +
-It is possible to directly solder the wires to the SD card, but I recommend against this as it reduces the flexibility a lot. I recommend getting a SD card adapter.+
-Of course one can buy this items, but there are also quite a number of alternatives:+
- +
-'''1)''' Use a mini-SD to SD card adapter. In many cases this adapter comes for free with a mini-SD card, but one sometimes can buy them separately too. The wires can be soldered to the adapter. This is not a very sturdy solution.+
- +
-[[IMAGE:WHR_G54S_SD_MOD-MiniSD_Adapter.jpg]]+
- +
-'''2)''' Disassemble a USB to SD card adapter. This is what I did. I bought a tiny adapter for 15 rmb(about 1.5 euro or 2 US$) and disassembled it. The adapter is so tiny that I did not need to remove the adapter from the circuit board at all. I just removed all components that were not needed(smd resistors, LED, USB connector, x-tal). The USB SD card adapter I used is shown below.+
- +
-[[IMAGE:WHR_G54S_SD_MOD-SD_Adapter.jpg]]+
- +
- +
-'''3)''' Use a 5.25 inch floppy disk cable connector. The pitch of this cable is the same as what is used with SD cards. This is quite a bulky solution, but it works fine. I'm not sure if you will be able to close your router when choosing this solution.+
- +
-[[IMAGE:WHR_G54S_SD_MOD-5.25_Inch_floppy_connector.jpg]]+
- +
-=== Implementing the modification ===+
- +
-Now it's time to implement the modification. For this we need some pieces of thin wire, some soldering tin, and a soldering iron with a small tip. I recommend soldering irons with 20 to 40 watts or even better irons with a controllable temperature. I used 400 degrees, which is quite high, but needed because these days the solder used has a higher melting point because of the "lead free" requirements.+
- +
- +
-The pictures below show which points need to be soldered to the SD adapter. SD1 refers to SD card pin 1. Be very careful when soldering, especially when soldering the LED's. The LED's drop of easily if one heats them too long. So go for a short accurate soldering action of about 1 second. If it fails then let the LED cool down and try again. Once the connection is established you can use some rubber glue to fixate the wires so they don't come of so easily anymore. I also used rubber glue to fixate the SD card adapter to some large components present on the PCB.+
- +
- +
-[[Image:WHR_G54S_SD_MOD-Component_Side2.PNG]]+
- +
-[[Image:WHR_G54S_SD_MOD-PCB_Backside2.png]]+
- +
-[[Image:WHR_HP_G54_SD_MOD-Component_Side.png]]+
- +
-=== Setting up DD-WRT to support the modification ===+
- +
-We will need to configure the MMC interface in the DD-WRT GUI (firmware V2.4). Set it up as indicated in the screenshot of the Administration screen below. If you soldered SD Pin 1(Chip Select) to ground then you can use any(0-9) '''unused''' GPIO output number in the CS field. +
-The screenshot also indicates that modification is working, the available disk space is shown. In case something is wrong I usually found that 3,008.00 KB is reported. This also happens if no SD card is inserted.+
- +
- +
-[[Image:WHR_G54S_SD_MOD-Management_Screen3.png]]+
- +
- +
-'''Be careful now, all data on the SD card will be erased without warning once you boot the router.''' If everything works correctly then DD-WRT will format the SD card with the EXT2 file system if this file system in not present on the card. This will take some time, so be patient. If everything works, then the DD-WRT gui will report the available disk space. An extra reboot might be required for this.+
- +
-=== Some tips and information ===+
- +
-* The SD card is automatically mounted at: "/mmc". +
-* It is possible to automatically run a script from the SD card. To do this create a executable script in: "/mmc/etc/config".+
-* Windows does not support the EXT2 file system, but this can be solved with a driver that can be found here: [http://www.fs-driver.org http://www.fs-driver.org]+
-* To access the router memory and SD card you can use [http://winscp.net/eng/index.php WinSCP]. To use this you need to enable SSH, which can be found in the services tab. (See picture below)+
- +
-[[Image:WHR_G54S_SD_MOD-Secure_Shell.png]]+
- +
-=== Some pictures of the modification ===+
- +
-[[IMAGE: WHR_G54S_SD_MOD-Inside_view1.jpg]]+
- +
-[[IMAGE: WHR_G54S_SD_MOD-Inside_view2.jpg]]+
- +
-[[IMAGE: WHR_G54S_SD_MOD-Outside_view.jpg]]+
- +
- +
-'''Your feedback, questions and remarks are welcome, just drop [http://www.dd-wrt.com/phpBB2/profile_sec.php?mode=viewprofile&u=20181 Iron] a message in the forum.'''+
-=Results (when it didn't work)=+
-''The tutorial above did not work on our WHR-HP-G54's when attempted. If you cannot get this modification to work, or if you just want to directly try what did work for [https://www.dd-wrt.com/phpBB2/profile_sec.php?mode=viewprofile&u=2384 sdoboze] and [http://forum.openwrt.org/profile.php?id=7533 JohnS] modify your wiring as follows:''+
-==Equipment Used==+
-* 6€ 15 Watt soldering iron.+
-* 5€ Lead-containing fine electrical solder (S-Sn60 Pb38Cu2, Typ HS10, Fg. (flux content) 2.5%).+
-* 3€ Soldering Stand & Sponge.+
-* 5€ USB to MMC/SD card reader (same as in original tutorial).+
-==Post-Tutorial Modifications==+
-It's a little confusing, in the original tutorial there are two locations for SD7 (Auto-Bridge GPIO5 Connection). The Center Pin, as pictured in the first image with 'SD7', on the bottom of the board, does not work. The '''second''' image shows the location which does work: [[Image:WHR_HP_G54_SD_MOD-Component_Side.png]]+
-For all the GPIO connections: move (re-solder) the wires '''before''' the resistors (tiny black surface-mount components next to the LED's). This means generally, solder the wire to the side of the resistor away from the LED. Details & Photos:<br>+
-* GPIO, Board silkscreen, Common Name+
-* GPIO1-LED5-Bridge LED, simply re-solder wire to the other side of R5, '''away''' from LED5.+
-* GPIO3-LED4-'''Missing''' LED, leave this one alone, if there is no resistor or LED. If older model with '''Extra''' LED, simply re-solder wire to the side of R4 '''away''' from LED4.+
-* GPIO6-LED1-AOSS LED, simply re-solder wire to the other side of R1, '''away''' from LED1.+
-* Photo: [[Image:WHR-HP-G54, SDMMC - GPIO1, GPIO3, GPIO6.jpg]]+
-* GPIO5/Auto-Bridge switch. The wire must be moved to the top of the board, soldered between the resistor R151 and capacitor C242. It is in a difficult location.+
-* Photo: [[Image:WHR-HP-G54, SDMMC - GPIO5 Auto-Bridge R151 Closeup.jpg]]<br>+
-Other Photos:+
-* +3.3v connection: [[Image:WHR-HP-G54, SDMMC - +3.3v Closeup.jpg]]+
-* Socket: [[Image:WHR-HP-G54, SDMMC - socket closeup.jpg]]+
-Credits: [http://forum.openwrt.org/profile.php?id=7533 JohnS] and [https://www.dd-wrt.com/phpBB2/profile_sec.php?mode=viewprofile&u=2384 sdoboze]+
- +
-==Other Resources==+
-Look [http://wiki.openwrt.org/OpenWrtDocs/Customizing/Hardware/MMC here] at the "Porting to other platforms" Section, very bottom of page.+
-Forum links: [http://forum.openwrt.org/viewtopic.php?id=12439]. Yes. I know it's OpenWRT. Before anyone gets juvenile or hostile, DD-WRT is based on OpenWRT.+

Current revision