2025-01-13 12:45 AM - edited 2025-01-13 12:46 AM
Hello everyone,
I’m encountering an issue with the srand() function in my STM32H747 project, and I would appreciate your insights on what might be causing this problem.
Hardware:
Software setup:
Whenever I call the srand() function, my code immediately ends up in the exit handler.
To troubleshoot, I created a minimal project with no additional middleware (bare minimum setup), and in that setup, the srand() function works without any issues.
However, in my main project where I need both lwIP and FreeRTOS, calling srand() causes an exit. The project was created following this guide:
How to Create a Project for STM32H7 with Ethernet and lwIP Stack.
I made one modification to the guide: instead of using the default OS wrapper, I selected CMSIS_V2.
Currently, I am only using the M7 core.
I’ve attached an image showing the callstack where the issue occurs. I hope this helps in diagnosing the problem.
Here’s a link to my code: GitHub Repository
Does anyone have any ideas on what might be causing this issue? Could it be related to the use of CMSIS_V2, a conflict with FreeRTOS, or possibly a memory issue?
Thank you in advance for your help!
Best regards,
Oskar
2025-01-14 03:21 AM
Yes I got the Hardfault with your latest software but without srand() call (I commented it). So the question is: are you sure srand() is what causing your original issue?