Hi, I recently got in my hands an old router. I was trying to update i'ts firmware, but the places where I can download the firmware, are a bit doggy, and I don't want to ruin my router. That's why I want to dump the flash memory, if in case something goes wrong, I can get it back to working conditions. The thing is the next. I'm a noob at programming with Arduino, so I need the help of someone, that knows about this. I've been searching a bit, and AFAIK, the only necessary things are that, the flash chip that you are trying to dump, must have an SPI interface and you MUST remove the chip from the board before working on it. I know that my flash chip has a SPI interface (in the datasheet it says "The MX25L6445E features
a serial peripheral interface and software protocol allowing operation on a simple 3-wire bus"). The only thing that i don't have is a way to read its contents. I have 3 Arduino nano (2 in working condition for the moment), but I don't have any code to do what I want. The chip is a MX25L6445E. Here is the datasheet:
Probably, if I can get the dump of the flash chip, I will come back, with another flash chip that I want to read its contents.
I have 3 Arduino nano
How much memory is there in the Nano? How much data does the MX25L6445E flash memory hold?
You need to either find a programmer for the MX25L6445E or you need something PC based as you need a place to store the data you copy from the MX25L6445E.
We (my business) update loads of routers without problems, the firmware should be available from the manufacturer's web site, no need to look elsewhere.
The MX25L6445E has 67,108,864 bits of flash storage. The arduino nano has only 32kb. I don't know if the whole firmware can fit in 32k of flash of the arduino nano, because in the MX25L6445E datasheet, it talks about bits, and not bytes, so, I don't really know the difference. What I'm trying to avoid is to buy a proper programmer, just to use it one time. The first think that I did was contact with the router manufacturer asking them for the firmware, and they said that they won't give me the firmware because they can confirm that I'm a direct customer (because the router is from an ISP, so they are correct). If you, in your work, have casually made a firmware dump of a ZTE ZHXN H108N R1A, I would really appreciate if you can give me the download link. If not, I'm still thinking about dumping the firmware. One thing that passed through my mind, is to make the arduino, read all bits of the flash chip, and while reading, sending them via the serial port, and with an external program, on my PC, gathering all those bits, and putting them together to form a proper filesystem or IMG.
You could implement a separate SPI flash to store the firmware
router_flash -- SPI -- Nano -- SPI -- external_SPI_flash
Basically, you read the router_flash one page at a time, store it in SRAM on the Nano, then write it to the external_flash, and do it until all the pages on the router_flash in read.
You can use the SPI chip select pin to determine which SPI slave you are talking too
-- reading from the router_flash
-- writing to the back_up_flash
What can I use as a separate spi flash? A micro SD card? When I say a micro SD card, I say, just a micro SD card, with no adapters or anything, directly soldered to the arduino. And, exists a code that can do that?
You can use a variety of SPI flash
The maximum you can get for a through-hole component is 32 Mbit.
For an SOIC-8 part, you can get 128 Mbit for less than 4 bucks. You just need to find a way to solder connect to it (like an SOIC to DIP adapter)
But, what I want is to extract the firmware to my PC. Copying the whole flash chip to another flash chip would be helpful, but, I don't have extra flash chips, and if I have to buy one of them, I'll use it only one time. What I'm looking for, is an easy way to do this, trying to avoid buying anything that I will use only one time, and using what I have (just the arduinos). If it's possible to dump the flash chip WITHOUT any other extra parts or chips, I will really appreciate if you can tell me. And, btw, isn't there any arduino code that "traducts" the micro SD card interface to a spi interface? If that its possible, I can probably use what you told me in the #3 comment
The easiest way for an Arduino to talk to a PC is via the serial console.
What you can do then is read the router_flash per page(you consult the datasheet of what the appropriate size is), store that into SRAM, and then send it out via the serial console. Since you will be reading a binary file, you would have to convert it to hex string first before sending it to the serial console. You could then use a terminal program to save the session into a file.
In Putty, you can record a session into a text file.
That looks viable me for my case. Is there any code that does that? I don't really know how spi works.
SPI is the easy part, the harder part is the actual driver for your particular MX25L6445E flash. You might have to write a driver for it first to be able to read from it. The flash library I posted above does not list the MX25L6445E chip as supported.
I don't have a dump of the router firmware, sorry. I think the suggestion of copying to another flash memory is a good one. I do wonder why you are so keen to keep an old router for which you can't get up to date firmware though. We use DrayTek routers, good quality at reasonable prices with firmware updates from their website.
I bit is a single binary integer, 1 or 0. A byte is 8 bits.
I'm trying to use this router as a "repeater" with a wired bridge. The thing is that I can, and I'm actually using the router, but in its current state, it's very unstable. I think it could be because of the old firmware. I tried looking for OpenWRT but the variant that I've got isn't compatible. I like the idea of "cloning" the flash chip, but if I have to buy a flash chip, to use it once, I don't really know if I want to do that.
What I've said in one of my comments, is if there is any possibility to make my own sdcard 2 spi interface, and directly save the dump onto a microsd, and have it on my PC, using the same flash chip clone concept
No Idea, sorry, I’m out of suggestions.
SD card is basically an SPI flash with a different storage technology. But it uses the same SPI interface. SDcard drivers for the Arduino are well known and abundant so no issues there.
Do intend of "reading" the dumped firmware on your computer? You would need a file system on the SDcard for that (FAT32 is fairly common)
Or if your goal is to just archive the firmware into the sdcard, then you won't need a filesystem. Just write raw data on the SDcard.
Not that you'll be able to "read" the firmware anyway since it would just be a bunch of hex code on your PC.
Guys, I've opened the ZTE router that I want to update it's firmware, and, first, I've found that it has a MX25L12845EMI, it's bigger than the one we where talking until now. Second, the router has a 4 pin header. I don't know for what is ment. I've heard that in some routers, is met for firmware updates, or recovering the router. I don't know if we can use it for something.
And, @hzrnbgy, can I connect the SD card directly to the arduino? Do you know any code or library that can read and write directly to sdcards?
You can connect directly an SD card to the Arduino. There are shields that have built-in SDcard slots. I don't supposed you'll be soldering anything on the sd card, since that would make it "un-insertable" in a regular PC card reader
The pin headers on the router is probably a debug port. Maybe you are lucky and the manufacturer provided a UART debug port on these header