2024-10-08 03:11 PM
Referring to AN5050 as well as an online guide for creating a QuadSPI loader for a W25Q32 flash IC, I have written code for a W25Q64 flash IC that I am interfacing in QuadSPI mode using the OctoSPI peripheral on the U599.
When I try reading the flash address in cubeprogrammer I get the following error
Error: Data read failed
Verbose level 3 does not log anything else relevant to the error.
When I try fully erasing the IC as well, I get the error -
Error: Mass erase operation failed.Please verify flash protection
I have attached my code below, could someone assist me in identifying the error in the same?
Thank you
2024-10-08 05:09 PM
If the Read fails it suggests that the Init() and Memory Mapping isn't working.
The log should show the PC side interaction, for the STM32 side you'd need to instrument and output diagnostics through an available UART. You could also debug the code in application space prior to integration, or via a framework that calls the loader functions.
Here's a loader for your pin configuration.
https://github.com/cturvey/stm32extldr/blob/main/u5_w25q64/README.md
2024-10-08 11:00 PM
Hello,
Yes, this was my assumption as well, that memory mapped mode or Init in general was not working as intended, but chip erase not working as well threw me off. I will try debugging my code in an application
And thank you for sharing a loader for my configuration, it is working as expected on my end, so until I am able to figure out and resolve the bugs in my code, I can test out my application with this.
I do get a warning though -
Warning: The core is locked up
Is this something I should be concerned about, or is it expected? What does it mean in general?
Much thanks again!
2024-10-09 07:47 AM
Hello @Hareesh_S ,
Could you please check the OCTOSPI configuration.
The W25Q64FV memory has a 64Mbit/8Mbyte size. So, you need to configure Device Size in STM32CubeMx at 23 as mentioned in AN5050.
Also, it is recommended to enable Sample shifting (SSHT) in STR mode and disabled in DTR mode. And for Delay hold quarter cycle (DHQC) enabled in DTR mode and disabled in STR mode.
May these resources can help you to check your configuration:
I hope this help you to solve your issue.
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.
2024-10-10 11:41 PM
Hello,
Thank you for the input, I was referring to the QSPI loader series on ST's YouTube page and took the flash size calculation from there. Just to clarify, the device size calculation is different for QSPI and OSPI peripherals, correct?
Regarding DTR mode, I am not using DTR in any of my QSPI messaging. I did not consider SSHT or DHQC to reduce the potential variables as I was not familiar with their effect - I will look into understanding the same and using them as recommended.
And thank you for the resource links. I will go through them this weekend
2024-10-11 02:46 AM
Hello @Hareesh_S ,
I hope these resources can help you.
Yes you are right.
About the QUADSPI configuration in STM32CubeMX, the Flash Size= FSIZE when FSIZE is calculated according number of bytes in Flash memory = 2^[FSIZE+1].
About the OCTOSPI configuration in STM32CubeMX, the Device Size defines the memory size in number of byte. So, number of bytes in Flash memory = 2^[Device Size] = 2^[DEVSIZE+1].
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.