cancel
Showing results for 
Search instead for 
Did you mean: 

How to write data to external flash (w25q128) by sending a hex file over UART

freeflyer
Associate II

I want to write data to an external flash (w25q128 with SPI) by sending a hex file from a PC to the STM32 over UART using tools such as Realterm or a python script

I have seen examples using the external loader with STM32CubeProgrammer, but I want to avoid doing it this way and just use UART. 

The reason being is that for production I want the user to be able to simply flash new data without the need for ST programming hardware and software tools. 

Are the any examples or can anyone help me achieve this ?

I am using the NUCLEO-L433RC-P board with the w25qxx driver....

https://stm32world.com/wiki/STM32_W25Qxx

 

2 REPLIES 2
Pavel A.
Super User

No any special examples are needed. Just make a "driver" for the flash, then make the communication part via the UART, then glue both together. That simple. Of course, be sure to test well.

 

 

Andrew Neil
Super User

@freeflyer wrote:

Are the any examples or can anyone help me achieve this 


Examples of what, exactly?

Certainly, there are plenty of examples for using the UART.

Also examples of using SPI.

Intel-Hex is well-established and well-documented; decoding it would not be specific to STM32.

Once SPI is working, writing to the Flash should be easy ...

 

PS:

It seems you already have the SPI driver:

https://community.st.com/t5/stm32-mcus-embedded-software/how-to-modify-stm32-w25qxx-example-code-to-use-spi-with-dma/td-p/808478

Don't forget to mark the solution in that thread.

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.