Skip to main content
Graduate II
June 5, 2025
Question

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

  • June 5, 2025
  • 2 replies
  • 466 views

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

 

    This topic has been closed for replies.

    2 replies

    Super User
    June 5, 2025

    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.

     

     

    Super User
    June 5, 2025

    @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.