-
Notifications
You must be signed in to change notification settings - Fork 195
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
QSPI still times out on 32F769IDISCOVERY #82
Comments
On the STM32769NI at least this patch is required for stable QSPI use. Enable it uncondtionally in case other boards need it too. Further discussions: ARMmbed#10049 ARMmbed#15108 STMicroelectronics/STM32CubeF7#52 STMicroelectronics/STM32CubeF7#82
On the STM32769NI at least this patch is required for stable QSPI use. Enable it uncondtionally in case other boards need it too. Further discussions: ARMmbed#10049 ARMmbed#15108 STMicroelectronics/STM32CubeF7#52 STMicroelectronics/STM32CubeF7#82
* STM32F7: Unconditionally enable QSPI workarounds On the STM32769NI at least this patch is required for stable QSPI use. Enable it uncondtionally in case other boards need it too. Further discussions: ARMmbed#10049 ARMmbed#15108 STMicroelectronics/STM32CubeF7#52 STMicroelectronics/STM32CubeF7#82 * QSPIF: Attempt 4-byte addressing on Macronix chips mbed-os PR 11531 introduced 4-byte addressing in the QSPIF block device: ARMmbed#11531 During testing it was found that this code broke on the NRF52840_DK and DISCO_F769NI. The NRF52840_DK controller seems unable to handle 4-byte addressing at all and has been disabled entirely in another code section. The DISCO_F769NI breakage was attributed to the flash chip but after more research I believe this is related to the QSPI controller, not the 4-byte addressing itself. Now that the QSPI controller has a workaround, enable 4-byte addressing again and hope it works fine this time.
I observed similar effect with -O3 gcc flag. First operation sometimes fails with timeout, but second is successful. Set optimisation for size -Os fixes the problem. STM32F777, QSPI Nor Flash MX25L12833F at 108MHz/54MHz clock. arm-none-eabi toolchain version 7q2 works fine even with -O3, but others fails with -O3 and -O2 |
On the STM32769NI at least this patch is required for stable QSPI use. Enable it uncondtionally in case other boards need it too. Further discussions: ARMmbed#10049 ARMmbed#15108 STMicroelectronics/STM32CubeF7#52 STMicroelectronics/STM32CubeF7#82
Are you sure it fixes it, or it just doesn't reproduce the issue?
…On Sun, May 07, 2023 at 01:23:28AM -0700, Ivaylo Iltchev wrote:
I observed similar effect with -O3 gcc flag. First operation sometimes fails with timeout, but second is successful. Set optimisation for size -Os fixes the problem.
--
Reply to this email directly or view it on GitHub:
#82 (comment)
You are receiving this because you authored the thread.
Message ID: ***@***.***>
|
Jookia, everything works just fine. I have a lot Robot Framework tests about this, customers stop complain and finally I removed workaround code about this. This code is used by the bootloader, external flash loader for Stm32CubeProgrammer and 4 application firmwares. |
Could you show me how to reproduce this? I would like to compare assembly output.
…On Mon, May 08, 2023 at 02:03:48AM -0700, Ivaylo Iltchev wrote:
[Jookia](https://github.com/Jookia), everything works just fine. I have a lot Robot Framework tests about this, customers stop complain and finally I removed workaround code about this.
--
Reply to this email directly or view it on GitHub:
#82 (comment)
You are receiving this because you authored the thread.
Message ID: ***@***.***>
|
This is a pretty big project > .5 mil of lines, FreeRTOS, RNDIS, LwIP, Ethernet. I have FatFs on the half of this QSPI NOR Flash memory, another half is used for recovery application, FPGA image etc. First I hit this problem when checking crc32 of the file. Normally this takes around a second, but when read fails (not all, but up to 5 from 2000 blocks) it is takes more than 5 sec (5 sec for every timeout). If block fails, I had a workaround to read again - only one repeat was enough. |
|
|
D-CACHE + C-CACHE are enabled. |
Stm32CubeIDE 1.12.1, gnu arm-none-eabi 12rel1 -O3
|
Stm32CubeIDE 1.12.1, gnu arm-none-eabi 12rel1 -O3
|
I think it's above my knowledge level to try and debug that but I suspect this is somehow making the a potential timing issue go away. I'm going to try and dig through some errata today and see if I can reproduce this easier. |
I dug through errata sheets for the chips the fix currently is applied for and found this in ES0290 which applies to the F74xx and F75xx: (Begin quote) 2.4.1 Extra data written in the FIFO at the end of a read transfer (End quote) Looking at the conditions, all of those seem to be set up on my board in Mbed aside from DDR mode. Or being an F47xx or F75xx chip. I'm not sure about the timing. ES0392, ES0396 ES0445 and for the STM32H7 series include this errata: (Begin quote) 2.5.1 QUADSPI hangs when QUADSPI_CCR is cleared 2.5.2 QUADSPI cannot be used in Indirect read mode when only (End quote) I tried to trigger 2.5.2 but couldn't. I have no idea what's happening here. |
I did some more testing today out of curiosity. First, I somewhat minimized the test case to this:
This will reproduce the error after around 45 minutes, or 227,652,225 or so calls. I just added a breakpoint to the error handling for HAL_QSPI_Command. Interestingly if you remove the set_frequency and configure_format call it will reproduce the error after around 45 minutes still, but it will take 32,889,065 calls. The settings used for QSPI in that case is single bus width, 24 bit address size, no dummy cycles and prescaler of 215 or 5MHz. I don't know what this implies. When inspecting this bug with my original tests I found the following data dumped from gdb. First data is the QUADSPI_TypeDef, second is the Instance. Remember that each read of the Instance dumps the QSPI registers and reads the FIFO. Crash 1:
In this case there is an extra byte in the FIFO after reading 4 bytes. We clear the FIFO threshold of 1 byte by reading 1 byte. This means the FIFO was never full. Crash 2:
In this case after reading 4 bytes we still have an additional 8 bytes in the FIFO. Crash 3:
This case is much more complicated. After the driver returns we have a full FIFO and the transfer isn't complete. We have to manually read 48 bytes to get back to a working state. We did 'recently' have a read of 48 bytes, so maybe that bled over? Crash 4, with the simpler test suite and no quad data:
In this case there's an extra 4 bytes in the FIFO. |
After running my board overnight with the abort fix used to flush the FIFO I'm pretty sure that's the correct fix. As for whether it's the same errata just triggered differently, I don't know. Something is up the QSPI controller on this chip, and it seems (publicly) undocumented. |
Describe the set-up
I'm using the 32F769IDISCOVERY board and Mbed OS 6.17.
Describe the bug
The HAL_QSPI_Transmit sometimes times out instead of returning data.
How To Reproduce
Run this using Mbed CLI1:
Watch on serial (115200 baud) for an error. This took half an hour for me, and an hour for a friend.
Additional context
I've reported this bug before as #52 . There was a release afterwards but this didn't fix it. I decided to give it some time and try again to see if the issue still happens.
I'm confident the fix is still the same: Clear the busy bit like some other chip variants do.
Edit: I have backported the v1.17 QSPI driver to Mbed and have the same results.
The text was updated successfully, but these errors were encountered: