-
Notifications
You must be signed in to change notification settings - Fork 26
Enable ICACHE, TRNG and WATCHDOG for STM32H5 #465
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
Enable ICACHE, TRNG and WATCHDOG for STM32H5 #465
Conversation
|
I can test this on my end to see what's up with the Ethernet tests. |
|
Interesting, it appears that this is the result of the workaround that you linked (for making the OTP memory non-cacheable) not actually working. Despite the workaround, we are seeing a data access violation when trying to access OTP memory. I think I figured out why, as well. If you look at I think the proper fix for this issue is to make STM32H5 use |
Thanks for looking into this! Yes, the workaround to make OTP memory non-cacheable is not working. But this is not because the mbed_mpu_init() function resets all the MPU regions, but because Armv8-M (unlike Armv7-M) does not allow MPU regions to overlap. The mbed_mpu_init() function is actually called before mbed_sdk_init() or SetSysClock(), so it won't wipe away our new region. We only need to change the address range of Region 0 from 0x00000000-0x0FFFFFFF to 0x00000000-0x08FFF7FF, and leave 0x08FFF800-0x0FFFFFFF to Region 5. |
…ult implementation for STM32F7/H7 with L1 cache override Cache_Init() function for STM32U5/H5 Cache_Init() function is called by mbed_sdk_init()
|
Ah, excellent find! I was not aware about that quirk of ARMv8! Tested your latest branch and it works perfectly with the network tests. |
Ah yeah, sounds like another interrupt is waking it up. I actually debugged a similar issue to this once on nRF52840, and I did it by manually disabling every single interrupt prior to entering deep sleep, then commenting out the disabling code one by one until the issue started happening again. That allowed me to narrow it down to the UART interrupt (turns out it was still sending stuff during the deep sleep test, causing the UART to wake it up). Is it possible that the system tick is waking it up? I am not sure but maybe we need to enable tickless mode? |
How did you fix the problem after you found out that it was the UART interrupt to wake up the system? Tickless mode is already enabled for STM32H5 family. Lines 3100 to 3103 in 40a020a
|
I still haven't been able to pass any of the nanostack tests, the lwipstack-tls test and the network-emac test. Actually, I'm getting compliation errors on the lwip test executables because OnboardNetworkStack::get_default_instance() has multiple definitions(see the attached log). They can be compiled if I comment out one of the definitions. |
In this case I had to add an additional sleep in the test so that it had time to finish printing everything before it went to sleep |
Huh, I don't see any compilation errors in the attached log. Also I don't think the github actions CI would pass if the tests didn't compile. What's the error you're running into? |
|
I checked the network tests with your branch, and everything seems to pass on my end except for two of the nanostack tests (which currently do not pass consistently, these are tests I recently added to confirm that nanostack actually works and are not expected to reliably pass). Also the TLS tests are failing but I do not think that's related to your branch. I am good to merge this except for the LP ticker issue. Would it be possible to revert adding LP ticker in this PR and make a separate PR for that one so we can dig deeper into the issue? |
In the attached greentea-ninja.txt: |
|
Ah I bet I know what happened, you need to pass when compiling greentea tests. That contains the critical line "nsapi.default-stack": null,which disables the definition of the network stack. It should say this in the docs somewhere, does it not? Maybe still need to add that X_X. |
|
Thanks so much for submitting this! |

Summary of changes
Enables ICACHE, LPTICKER, TRNG and WATCHDOG features for the STM32H5 family.
MPU Region 5 is used to avoid hardfaults when ICACHE is enabled:
https://community.st.com/t5/stm32-mcus/how-to-avoid-a-hardfault-when-icache-is-enabled-on-the-stm32h5/ta-p/630085
Impact of changes
Migration actions required
Documentation
None
Pull request type
Test results
I run GreenTea tests on a NUCLEO-H563ZI board and passed the LPTICKER, TRNG and WATCHDOG tests.
The hal-sleep test failed when LPTICKER is used as wakup source from deepsleep mode, but it seems unrelated to LPTICKER itself: even if I comment out the code that setup the LPTICKER interrupt, the system will still wake up from deepsleep mode after 309 ticks. The netsocket related tests failed with Hard Faults. I'm not sure how to setup the test environments for netsocket tests or skip them.
greentea-log-nucleo-h563zi.txt