Backup and Flash SPI Memory using Arduino

After a wrong upgrade firmware of a TP-Link router, the only alternative was to write the flash memory directly.

The strategy I used was: Update only the u-boot sector, which is responsible for loading the kernel, and then updating using tftp [link].

It is possible to write all the firmware, however I preferred this method because it is faster. Writing the whole flash (ex: 8mb) can take about 10min.

I’ve developed a sketch for this purpose, and it can be downloaded from the link:
https://github.com/ricardojlrufino/SerialFlashSPI

The entire wiring diagram and details is also on the link above.

Notes

Currently (04-2017), it is only compatible with Winbond memories, but can be adapted for other libraries

I used the Arduino DUE because it is 3.3v. If you are using another arduino, you need to create a voltage divider.

The u-boot has 128 kb, which corresponds to the “512 pages” of “256 bytes”. You should adjust the base file size to the multiples of 256. This can be configured directly on the serial console

Wiring

Diagram

 

 

Anúncios

Deixe um comentário

Preencha os seus dados abaixo ou clique em um ícone para log in:

Logotipo do WordPress.com

Você está comentando utilizando sua conta WordPress.com. Sair / Alterar )

Imagem do Twitter

Você está comentando utilizando sua conta Twitter. Sair / Alterar )

Foto do Facebook

Você está comentando utilizando sua conta Facebook. Sair / Alterar )

Foto do Google+

Você está comentando utilizando sua conta Google+. Sair / Alterar )

Conectando a %s