Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stm32 flash ospi fails on stm32l5 and stm32u5 disco #46740

Closed
FRASTM opened this issue Jun 21, 2022 · 2 comments · Fixed by #46794
Closed

stm32 flash ospi fails on stm32l5 and stm32u5 disco #46740

FRASTM opened this issue Jun 21, 2022 · 2 comments · Fixed by #46794
Assignees
Labels
area: Flash bug The issue is a bug, or the PR is fixing a bug platform: STM32 ST Micro STM32 priority: low Low impact/importance bug

Comments

@FRASTM
Copy link
Collaborator

FRASTM commented Jun 21, 2022

Describe the bug
When testing the samples/drivers/spi_flash on b_u585i_iot02a or stm32l562e_dk
the error occurs : "SPI flash driver MX25LM51245 was not found!"

To Reproduce
Steps to reproduce the behavior:

  1. west build -p auto -b stm32l562e_dk samples/drivers/spi_flash
  2. west flash
  3. See error

Expected behavior

JEDEC OSPI-NOR SPI flash testing
==========================

Test 1: Flash erase
Flash erase succeeded!

Test 2: Flash write
Attempting to write 4 bytes
Data read matches data written. Good!!

Impact
regression after the merge of the #45917

Logs and console output

*** Booting Zephyr OS build zephyr-v3.1.0-582-gcefd74f0444f  ***

JEDEC OSPI-NOR SPI flash testing                                            
==========================                                                  
SPI flash driver MX25LM51245 was not found!                                 
[00:00:05.141,000] <err> flash_stm32_ospi: OSPI AutoPoll failed             
[00:00:05.141,000] <err> flash_stm32_ospi: OSPI flash busy failed           
[00:00:05.141,000] <err> flash_stm32_ospi: OSPI mode not config'd (8 rate 2)
[00:00:05.141,000] <dbg> flash_stm32: stm32_flash_init: Flash initialized. BS: 8
[00:00:05.141,000] <dbg> flash_stm32: stm32_flash_init: Block 0: bs: 2048 count: 256
[00:00:05.141,000] <dbg> flash_stm32: stm32_flash_init: Block 1: bs: 0 count: 0
[00:00:05.141,000] <dbg> flash_stm32: stm32_flash_init: Block 2: bs: 0 count: 0
[00:00:05.141,000] <dbg> flash_stm32: flash_stm32_write_protection: Disable write protection

Environment (please complete the following information):

  • OS: ubuntu
  • Toolchain zephyr-sdk-0.14.0
  • Commit SHA : cefd74f

Additional context

@FRASTM FRASTM added bug The issue is a bug, or the PR is fixing a bug area: Flash platform: STM32 ST Micro STM32 labels Jun 21, 2022
@FRASTM
Copy link
Collaborator Author

FRASTM commented Jun 21, 2022

In the stm32_ospi_write_enable() function, two commands are issued to the octoflash

  1. with SPI_NOR_(O)CMD_WREN instruction
  2. with SPI_NOR_(O)CMD_RDSR instruction
    In between some s_command parameters should be updated : .AddressMode, .DataMode

Also, I suspect a pb with the command.AddressSize and the stm32_ospi_hal_address_size badly init'd
--> in the flash_stm32_ospi_write()
cmd_pp.AddressSize = HAL_OSPI_ADDRESS_32_BITS;

Refering to the AN5050, the command.AddressSize is HAL_OSPI_ADDRESS_32_BITS except in quad mode.

@FRASTM
Copy link
Collaborator Author

FRASTM commented Jun 21, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Flash bug The issue is a bug, or the PR is fixing a bug platform: STM32 ST Micro STM32 priority: low Low impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants