STMCube IDE problems with Queues
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-08 3:34 AM
Im creating an RTOS queue in the configuration tool. Whowever if I try to place anything in the queue the program crashes.
Configuration:
Generated Initialization
Place item in queue (btn.dec is a uint8_t variable)
Debug
As you can see the item size is wrong, although the two queues are created equal.
What could cause this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-08 4:14 AM
Hello @tarmogr,
Ensure that the data you're sending (btn.dec) is indeed a uint8_t. If btn.dec is not a single byte, this could be the source of the problem.
Also, check in the queue creation, that the item size parameter (sizeof(uint8_t)) matches the actual size of the items you will place in the queue.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-08 4:49 AM
Thank you Sarra for your reply. Just to remove any doubts I defined a new uint8_t variable which i am sending to the queue. For me this does not seem to be an issue. Any more ideas?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-08 4:52 AM
And also one interesting thing to note. My MCU only seems to crash while in debug mode. When I run it normaly it runs fine or at least not often enough to notice immediately.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-08 6:11 AM
Use the debugger to check the fault registers and stack frame to determine the source of the fault.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-09 1:05 AM
So I was checking the heap size of my FreeRTOS task. There is this "chargerTask". I know that I dynamically allocate about 431 bytes in it. The settings in configuration was as follows:
I can only edit "stack size" on the first image. which is in words. In bytes it is then 512 bytes. According to my understanding it is enough for my dynamic memory, or am i wrong?
Anyway after increasing the stack size to 1024 the problem does not occur anymore.
What would be the correct way of calculating heap/stack size here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-14 7:07 AM
Hello @tarmogr,
Please check Heap memory management
Typically, you would implement a stack overflow detection mechanism by using the configCHECK_FOR_STACK_OVERFLOW configuration constant in your FreeRTOSConfig.h file, also check Stack usage and Stack Overflow Checking
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-28 3:37 AM - edited ‎2024-05-28 3:38 AM
It seems there were indeed some heap size problem. However a problem with one of the queues still persist. In debug view it shows some randomly high number as an item size. Both queues are created by configuration tool. Any idea what could cause this?
in main.c:
