Skip to main content
Visitor II
June 3, 2025
Question

HPDMA XSPI flash all zeros are written

  • June 3, 2025
  • 2 replies
  • 476 views

Hi. I'm trying to get HPDMA to write to flash memory on the stm32n6570-dk board. I did the DMA configuration exactly like the XSPI_NOR_ReadWhileWrite_DTR example for the STM32H7. The problem is that all zeros are written and I've run out of ideas what's wrong.  The memory is erased before writing. When I replace HAL_XSPI_Transmit_DMA() with HAL_XSPI_Transmit() the data is written. Maybe someone has an idea why all zeros are written?

 

Artur

    This topic has been closed for replies.

    2 replies

    Technical Moderator
    June 4, 2025

    Hello @Artur5;

     

    Could you please give more details about the issue:

    Are you using PSRAM or NOR memory?

    What is the frequency of XSPI?

    Can you write in the memory when using GPDMA?

    Could you please use HPDMA channel 12 to 15 with FIFO = 64Bytes.

    Thank you.

    Kaouthar

    Artur5Author
    Visitor II
    June 4, 2025

    Hi. It's about access to flash memory. I used HPDMA channel 3 and 4. After changing to GPDMA, writing works correctly. I also noticed that for some reason in the code generated by CubeMx for HPDMA there is no interrupt initialization, i.e. HPDMA_init is empty, after adding interrupts, communication seems to work correctly except that only zeros are written.

    Artur

    Graduate II
    June 4, 2025

    All-Zeros?

    That's typically an issue where you keep writing at the same address range, and if done enough, with a random stream, it will knock down all cells to Zero.

    Watch for the NOR FLASH's  Write Page Buffer size, and issues related to spanning that. I haven't looked at you case, but a lot of Micron and Winbond NOR FLASH has only a 256-byte page buffer, so that's the write limit, even less if you don't start with an address on a 256-byte aligned boundary.

    Graduate II
    June 4, 2025

    Page Program only 256-bytes, check what template you're using for Memory Mapped Write

    https://www.macronix.com/Lists/Datasheet/Attachments/8742/MX66U1G45G,%201.8V,%201Gb,%20v1.4.pdf