2022-04-13 03:18 PM
My program hangs on xQueueSend call:
if (xQueueSend(msg_queueHandle, (void *)&msg, 10) != pdTRUE) {
When I step through the code, I see it reaches the xQueueGenericSend function but exits on the first line of that function where the following is called:
configASSERT( pxQueue );
Any ideas on why configASSERT would always exit the function?
2022-04-14 12:06 AM
Simply because the queue handle pxQueue is (still) NULL which usually means the queue wasn’t created before used. Hence the valuable assert catching this sort of programming error.
2022-04-14 04:35 AM
When I pause the debugger with no break-points, the cursor ends up on configASSERT(pxQueue) line of the xQueueGenericSend function. The pxQueue is not null.
2022-04-14 05:15 AM
Then just step into the code to see why it's stuck there and/or check how you did #define the configASSERT macro (in your FreeRTOSConfig.h).
2022-04-14 05:25 AM
I'm a bit further along.
The main issue I have now is I used CubeMX to configure a queue named msg_queueHandle and it is set in freertos.c. How do I get CubeMX to expose msg_queueHandle as global so that I can access it from my blink_led_task.c file? There is no freertos.h file created by CubeMX to include in blink_led_task.c.
2022-04-14 06:05 AM
Sorry - I don't use cube.
2022-04-14 06:34 AM
> How do I get CubeMX to expose msg_queueHandle as global
If Cube does not generate it as static, it is already exposed as global.
Otherwise add a small function in user area of main.c, like:
QueueHandle_t get_my_queue() { return msg_queueHandle; }
May this be your biggest problem ;)
2022-04-14 06:50 AM
I tried setting CubeMX to generate the queue with both Dynamic and Static and still not showing as global scope. I'm confused as to why mx does not expose msg_queueHandle globally? I was hoping I could simply add the queue in MX and have it in the global scope.
I also tried the getter function you recommended and msg_queueHandle is still generating a compile error as undefined.
2022-04-14 07:08 AM
Sovled! I was able to get my code working by adding the following to blink_led_task.h file which was calling msg_queueHandle:
extern osMessageQueueId_t msg_queueHandle;
If I place code in a file outside of main.c than I add the declaration.