cancel
Showing results for 
Search instead for 
Did you mean: 

OSPI_NOR_MemoryMapped example on STM32U5x9J-DK returns garbage on read

RC123
Visitor

Board: STM32U5x9J-DK (Discovery)

MCU: STM32U5xx (U5G9J series)

STM32Cube package: STM32Cube_FW_U5_V1.8.0

Example path:

STM32Cube\Repository\STM32Cube_FW_U5_V1.8.0\Projects\STM32U5x9J-DK\Examples\OSPI\OSPI_NOR_MemoryMapped

File: main.c (write/read operations performed in switch(step), case 1)

IDE / toolchain: (please mention your IDE, e.g., STM32CubeIDE v1.19.0)

 

Running the example on the Discovery board: the write appears to run, memory-mapped mode is entered, but reading back returns garbage — the mismatch counter res always becomes 256 (I interpret that as every byte failed the compare). The write/read block is in case 1 of the main loop.

case 1:
  if (CmdCplt != 0)
  {
    CmdCplt = 0;
    /* ... set up mem-mapped write/read ... */

    /* Writing Sequence ----------------------------------------------- */
    mem_addr = (uint8_t *)(OCTOSPI1_BASE + address);
    for (index = 0; index < BUFFERSIZE; index++)
    {
      *mem_addr = aTxBuffer[index];
      mem_addr++;
    }

    HAL_Delay(MEMORY_PAGE_PROG_DELAY);

    /* Reading Sequence ----------------------------------------------- */
    mem_addr = (uint8_t *)(OCTOSPI1_BASE + address);
    for (index = 0; index < BUFFERSIZE ; index++)
    {
      if (*mem_addr != aTxBuffer[index])
      {
       res++;
      }
      mem_addr++;
    }

    if (res != 0)
    { BSP_LED_On(LED_RED); }
    else
    { BSP_LED_Toggle(LED_GREEN); HAL_Delay(50); }
    /* ... */
  }
  break;
 

 

0 REPLIES 0