cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U5A9J-DK OctalFlash Read failure

JKim.2
Associate III

Hello,

 

I generated a project for STM32U5A9J-DK with STM32CubeIDE (v1.16.0). It doesn’t include the OctalFlash test code. So, I used the test codes in chapter "Octo-SPI FLASH in Regular-command protocol example" of attached AN5050.

The mounted OctalFlash is MX25UM51245G. With the program, the data output was shifted by one byte as below.

After I use the HAL_OSPI_DELAY_BLOCK, the pass rate becomes higher but still fails. Please help.

 

Thanks.

 

  • result from the default program w/o HAL_OSPI_DELAY_BLOCK

FAILURE index 0x00000000 Expect 0x20 Output 0x50

FAILURE index 0x00000001 Expect 0x50 Output 0x20

FAILURE index 0x00000002 Expect 0x72 Output 0x50

FAILURE index 0x00000003 Expect 0x6F Output 0x72

FAILURE index 0x00000004 Expect 0x67 Output 0x6F

FAILURE index 0x00000005 Expect 0x72 Output 0x67

FAILURE index 0x00000006 Expect 0x61 Output 0x72

FAILURE index 0x00000007 Expect 0x6D Output 0x61

SUCCESS index 0x00000008 Expect 0x6D Output 0x6D

FAILURE index 0x00000009 Expect 0x69 Output 0x6D

FAILURE index 0x0000000A Expect 0x6E Output 0x69

FAILURE index 0x0000000B Expect 0x67 Output 0x6E

  • result from the modified program with HAL_OSPI_DELAY_BLOCK
  • FAILURE index 0x00000000 Expect 0x20 Output 0x40

    SUCCESS index 0x00000001 Expect 0x50 Output 0x50

    FAILURE index 0x00000002 Expect 0x72 Output 0x50

    SUCCESS index 0x00000003 Expect 0x6F Output 0x6F

    FAILURE index 0x00000004 Expect 0x67 Output 0x6F

    SUCCESS index 0x00000005 Expect 0x72 Output 0x72

    SUCCESS index 0x00000006 Expect 0x61 Output 0x61

    SUCCESS index 0x00000007 Expect 0x6D Output 0x6D

    SUCCESS index 0x00000008 Expect 0x6D Output 0x6D

    SUCCESS index 0x00000009 Expect 0x69 Output 0x69

    FAILURE index 0x0000000A Expect 0x6E Output 0x68

    SUCCESS index 0x0000000B Expect 0x67 Output 0x67

1 ACCEPTED SOLUTION

Accepted Solutions
KDJEM.1
ST Employee

Hi @JKim.2 ,

 

For DTR read, I used the delay block in order to fine tune the data-received sampling clock. Also the delay block role is used to apply a phase-shift to the clock or DQS signal when reading from external memory. You can find in the attachment file a project with successful DTR OCTAL Read.

KDJEM1_0-1726132141796.png

For more information for the delay block, I advise you to take a look at AN5050 Section 6 OCTOSPI and HSPI/XSPI interface calibration process.

Please let me know if your issue is solved or not?

 

Thank you.

Kaouthar

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

17 REPLIES 17
KDJEM.1
ST Employee

Hi @JKim.2 ,

 

Could you please check the dummy cycle. Incorrect dummy cycles can cause data misalignment.

May this discussion Solved: External Flash downloader shift 1 byte in flash ar... - STMicroelectronics Community and this example BSP can help you.

 

Thank you.

Kaouthar

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hi Kaouthar,

Thank you for the answer. I tried longer and shorter dummy cycles but still failing. How can I run the BSP on STM32CubeIDE?

 

/* USER CODE BEGIN Private defines */

/* MX25LM512ABA1G12 Macronix memory */

/* Flash commands */

#define OCTAL_IO_DTR_READ_CMD 0xEE11

#define OCTAL_IO_READ_CMD 0xEC13

#define OCTAL_PAGE_PROG_CMD 0x12ED

#define OCTAL_READ_STATUS_REG_CMD 0x05FA

#define OCTAL_SECTOR_ERASE_CMD 0x21DE

#define OCTAL_WRITE_ENABLE_CMD 0x06F9

#define READ_STATUS_REG_CMD 0x05

#define WRITE_CFG_REG_2_CMD 0x72

#define WRITE_ENABLE_CMD 0x06

/* Dummy clocks cycles */

#define DUMMY_CLOCK_CYCLES_READ 7 //6(original)

#define DUMMY_CLOCK_CYCLES_READ_REG 4

Best Regards,

Jeff

DUMMY 7 cycles

SUCCESS index 0x00000000 Expect 0x20 Output 0x20
FAILURE index 0x00000001 Expect 0x50 Output 0x10
SUCCESS index 0x00000002 Expect 0x72 Output 0x72
FAILURE index 0x00000003 Expect 0x6F Output 0x29
SUCCESS index 0x00000004 Expect 0x67 Output 0x67
SUCCESS index 0x00000005 Expect 0x72 Output 0x72
SUCCESS index 0x00000006 Expect 0x61 Output 0x61
SUCCESS index 0x00000007 Expect 0x6D Output 0x6D

 

DUMMY 5CYCLES

SUCCESS index 0x00000000 Expect 0x20 Output 0x20
FAILURE index 0x00000001 Expect 0x50 Output 0x30
SUCCESS index 0x00000002 Expect 0x72 Output 0x72
FAILURE index 0x00000003 Expect 0x6F Output 0x29
SUCCESS index 0x00000004 Expect 0x67 Output 0x67
SUCCESS index 0x00000005 Expect 0x72 Output 0x72
SUCCESS index 0x00000006 Expect 0x61 Output 0x61
SUCCESS index 0x00000007 Expect 0x6D Output 0x6D

 

 

KDJEM.1
ST Employee

Hello @JKim.2 ,

 

Thank you for updating post and come back to the community.

You can run the BSP example by open this example using STM32CubeIDE toolchain. Please take a look at UM2609.

KDJEM1_0-1725351565620.png

Also, I think OSPI_NOR_MemoryMapped can help you.

Do you observe the same behavior when you run these examples?

Thank you.

Kaouthar

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hi Kaouthar,

I imported the project but it can't be compiled as below. How to solve those errors?

Best Regards,

Jeff

 

17:41:27 **** Build of configuration Debug for project OSPI_NOR_MemoryMapped ****

make -j8 all

arm-none-eabi-gcc "C:/Users/jekim/Documents/Work/STM32U5A9J-DK/STM32CubeU5-main/Projects/STM32U5x9J-DK/Examples/OSPI/OSPI_NOR_MemoryMapped/Src/main.c" -mcpu=cortex-m33 -std=gnu11 -g3 -DDEBUG -DSTM32U5A9xx -DUSE_HAL_DRIVER -c -I../../Inc -I../../../../../../../Drivers/STM32U5xx_HAL_Driver/Inc -I../../../../../../../Drivers/STM32U5xx_HAL_Driver/Inc/Legacy -I../../../../../../../Drivers/CMSIS/Device/ST/STM32U5xx/Include -I../../../../../../../Drivers/CMSIS/Include -I../../../../../../../Drivers/BSP/STM32U5x9J-DK -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -fcyclomatic-complexity -MMD -MP -MF"Example/User/main.d" -MT"Example/User/main.o" --specs=nano.specs -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mthumb -o "Example/User/main.o"

arm-none-eabi-gcc "C:/Users/jekim/Documents/Work/STM32U5A9J-DK/STM32CubeU5-main/Projects/STM32U5x9J-DK/Examples/OSPI/OSPI_NOR_MemoryMapped/Src/stm32u5xx_hal_msp.c" -mcpu=cortex-m33 -std=gnu11 -g3 -DDEBUG -DSTM32U5A9xx -DUSE_HAL_DRIVER -c -I../../Inc -I../../../../../../../Drivers/STM32U5xx_HAL_Driver/Inc -I../../../../../../../Drivers/STM32U5xx_HAL_Driver/Inc/Legacy -I../../../../../../../Drivers/CMSIS/Device/ST/STM32U5xx/Include -I../../../../../../../Drivers/CMSIS/Include -I../../../../../../../Drivers/BSP/STM32U5x9J-DK -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -fcyclomatic-complexity -MMD -MP -MF"Example/User/stm32u5xx_hal_msp.d" -MT"Example/User/stm32u5xx_hal_msp.o" --specs=nano.specs -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mthumb -o "Example/User/stm32u5xx_hal_msp.o"

arm-none-eabi-gcc "C:/Users/jekim/Documents/Work/STM32U5A9J-DK/STM32CubeU5-main/Projects/STM32U5x9J-DK/Examples/OSPI/OSPI_NOR_MemoryMapped/Src/stm32u5xx_it.c" -mcpu=cortex-m33 -std=gnu11 -g3 -DDEBUG -DSTM32U5A9xx -DUSE_HAL_DRIVER -c -I../../Inc -I../../../../../../../Drivers/STM32U5xx_HAL_Driver/Inc -I../../../../../../../Drivers/STM32U5xx_HAL_Driver/Inc/Legacy -I../../../../../../../Drivers/CMSIS/Device/ST/STM32U5xx/Include -I../../../../../../../Drivers/CMSIS/Include -I../../../../../../../Drivers/BSP/STM32U5x9J-DK -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -fcyclomatic-complexity -MMD -MP -MF"Example/User/stm32u5xx_it.d" -MT"Example/User/stm32u5xx_it.o" --specs=nano.specs -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mthumb -o "Example/User/stm32u5xx_it.o"

arm-none-eabi-gcc "../Example/User/syscalls.c" -mcpu=cortex-m33 -std=gnu11 -g3 -DDEBUG -DSTM32U5A9xx -DUSE_HAL_DRIVER -c -I../../Inc -I../../../../../../../Drivers/STM32U5xx_HAL_Driver/Inc -I../../../../../../../Drivers/STM32U5xx_HAL_Driver/Inc/Legacy -I../../../../../../../Drivers/CMSIS/Device/ST/STM32U5xx/Include -I../../../../../../../Drivers/CMSIS/Include -I../../../../../../../Drivers/BSP/STM32U5x9J-DK -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -fcyclomatic-complexity -MMD -MP -MF"Example/User/syscalls.d" -MT"Example/User/syscalls.o" --specs=nano.specs -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mthumb -o "Example/User/syscalls.o"

arm-none-eabi-gcc "../Example/User/sysmem.c" -mcpu=cortex-m33 -std=gnu11 -g3 -DDEBUG -DSTM32U5A9xx -DUSE_HAL_DRIVER -c -I../../Inc -I../../../../../../../Drivers/STM32U5xx_HAL_Driver/Inc -I../../../../../../../Drivers/STM32U5xx_HAL_Driver/Inc/Legacy -I../../../../../../../Drivers/CMSIS/Device/ST/STM32U5xx/Include -I../../../../../../../Drivers/CMSIS/Include -I../../../../../../../Drivers/BSP/STM32U5x9J-DK -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -fcyclomatic-complexity -MMD -MP -MF"Example/User/sysmem.d" -MT"Example/User/sysmem.o" --specs=nano.specs -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mthumb -o "Example/User/sysmem.o"

arm-none-eabi-gcc -mcpu=cortex-m33 -g3 -DDEBUG -c -x assembler-with-cpp -MMD -MP -MF"Example/Startup/startup_stm32u5a9njhxq.d" -MT"Example/Startup/startup_stm32u5a9njhxq.o" --specs=nano.specs -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mthumb -o "Example/Startup/startup_stm32u5a9njhxq.o" "../Example/Startup/startup_stm32u5a9njhxq.s"

make: *** No rule to make target 'C:/Users/jekim/Documents/Work/STM32U5A9J-DK/STM32CubeU5-main/Drivers/STM32U5xx_HAL_Driver/Src/stm32u5xx_hal.c', needed by 'Drivers/STM32U5xx_HAL_Driver/stm32u5xx_hal.o'. Stop.

make: *** Waiting for unfinished jobs....

In file included from C:/Users/jekim/Documents/Work/STM32U5A9J-DK/STM32CubeU5-main/Projects/STM32U5x9J-DK/Examples/OSPI/OSPI_NOR_MemoryMapped/Src/main.c:21:

../../Inc/main.h:24:10: fatal error: stm32u5xx_hal.h: No such file or directory

24 | #include "stm32u5xx_hal.h"

| ^~~~~~~~~~~~~~~~~

compilation terminated.

C:/Users/jekim/Documents/Work/STM32U5A9J-DK/STM32CubeU5-main/Projects/STM32U5x9J-DK/Examples/OSPI/OSPI_NOR_MemoryMapped/Src/stm32u5xx_hal_msp.c:20:10: fatal error: stm32u5xx_hal.h: No such file or directory

20 | #include "stm32u5xx_hal.h"

| ^~~~~~~~~~~~~~~~~

compilation terminated.

make: *** [Example/User/subdir.mk:31: Example/User/main.o] Error 1

make: *** [Example/User/subdir.mk:33: Example/User/stm32u5xx_hal_msp.o] Error 1

C:/Users/jekim/Documents/Work/STM32U5A9J-DK/STM32CubeU5-main/Projects/STM32U5x9J-DK/Examples/OSPI/OSPI_NOR_MemoryMapped/Src/stm32u5xx_it.c:22:10: fatal error: stm32u5xx_hal.h: No such file or directory

22 | #include "stm32u5xx_hal.h"

| ^~~~~~~~~~~~~~~~~

compilation terminated.

make: *** [Example/User/subdir.mk:35: Example/User/stm32u5xx_it.o] Error 1

"make -j8 all" terminated with exit code 2. Build might be incomplete.

 

17:41:28 Build Failed. 8 errors, 0 warnings. (took 480ms)

KDJEM.1
ST Employee

Hello @JKim.2 ,

 

Could you please try to download STM32CubeFW_U5 using STM32CubeMX toolchain as shown in the below figures/

KDJEM1_0-1725454504380.png

 

 

KDJEM1_2-1725454652056.png

Then, please try to open the OSPI example by following these steps:

KDJEM1_3-1725454855529.png

KDJEM1_4-1725454986071.png

 

Could you please share your OCTOSPI configuration?

 

Thanks and best regards,

Kaouthar

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hi Kaouthar,

The embedded software packages manager shows that the 1.3.0 STM32Cube MCU Package for STM32U5 is installed. I tried to install 1.6.0 from the local directory as below. It alerted "this package version is already available on current STM32CubeMX repository.". Is it fine? I opened the OSPI_NOR_MemoryMapped project again from file system. The compilation still has the same error message. The ioc file of the original project is attached for the OSPI configuration. The new project OSPI_NOR_MemoryMapped doesn't have the ioc file.

Best Regards,

Jeff

howto_install_stm32cube_mcu_package.PNG

howto_install_stm32cube_mcu_package2.PNG

KDJEM.1
ST Employee

Hello @JKim.2,

The embedded software packages manager shows that the 1.3.0 STM32Cube MCU Package for STM32U5 is installed.

Please use the latest STM32CubeMX version 6.12.0 and click on Refresh button to see the latest version of STM32CubeU5 firmware

KDJEM1_1-1725524717617.png

I tried to install 1.6.0 from the local directory as below. It alerted "this package version is already available on current STM32CubeMX repository.". Is it fine? I opened the OSPI_NOR_MemoryMapped project again from file system. The compilation still has the same error message. 

I advise you to delete all STM32CubeU5 firmware versions and to redownload again using STM32CubeMx or from this link STM32CubeU5 - STM32Cube MCU Package for STM32U5 series (HAL, Low-Layer APIs and CMSIS, USB, File system, RTOS, TF-M - coming with examples running on ST boards) - STMicroelectronics .

If you want to use GitHUB please take a look at this post.

About  the OCTOSPI configuration, I noted that the device size is wrong: For 512Mbits=64MBytes, the Device Size must be configured in .ioc file at 26.

Which mode are you using DTR mode or STR mode?

Note that, Sample shifting (SSHT) recommended to be enabled in STR mode and disabled in DTR mode and Delay hold quarter cycle (DHQC) enabled in DTR mode and disabled in STR mode.

Are you doing a OCTA Read Mode (8READ, ECh) or OCTA DTR Read Mode (8DTRD, EEh)?

May this main.c and main.h can help for checking OCTOSPI configuration.

 

Thanks and best regards,

Kaouthar

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hi Kaouthar,

I installed the latest STM32CubeMX version 6.12.0 as you suggested. btw, both remove and install button on STM32CubeMX are disabled as below? How to remove all the MCU Package for STM32U5 Series?

Best Regards,

Jeff

JKim2_0-1725526938010.png

 

KDJEM.1
ST Employee

Hi @JKim.2 ,

 

Click on STM32Cube MCU Package for STM32U5 Series to enable remove button. Then, click on Remove.

To install the latest version click on STM32Cube MCU package for STM32U5 series 1.6.0 version. Then, click on Install. 

KDJEM1_0-1725527364849.png

 

Thanks and best regards,

Kaouthar

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.