2023-02-14 06:29 AM
There are times where I would like a message queue of a single depth. In some similar OSes this is also how semaphores are created. I have hit a near brick wall in STM32CubeMX failing to create a queue with just one element.
In this case for the STM32F4 library, I get the following call where I set a "Queue Size" 1 in:
Middleware -> FreeROTS -> Tasks and Queues -> Queues -> Queue Size.
This creates a function:
I2CWriteQHandle = osMessageQueueNew (2, sizeof(i2c_data_type), &I2CWriteQ_attributes);
Note the "msg_count" argument is 2, despite all the I2CWriteQ_attributes being consistent with those being set in ST32CubeMX. If the queue is increased to say 16, msg_count remains at 2. Other queues with a osMessageQueueNew "msg_count" set at 16, remain at 16.
If I manually correct the "msg_count" argument, the new value is retained when (re)generating the code.
I presume this behaviour of unlinking "Queue Size" "msg_count" is unintened and not sure when this issue started. BTW I am using v6.7.1 and have applied the patch associated with this version.
Solved! Go to Solution.
2023-03-14 06:52 AM
I apologise for not replying earlier.
Soon after getting this issue I upgraded the CubeMX applications.
What I can say is that I can't reproduce the problem with STM32CubeMX v6.8.0
I've change the queue size and the corresponding numbers ("Queue Size" "msg_count") in freertos.c change as one might expect and the project compiles fine.
2023-02-23 01:55 AM
Hello @Community member
Frist let me thank you for posting.
I have an issue reproducing the described behavior.
I am using the following setup:
Down bellow screenshots from the CubeMx setting and the generated code:
Could you provide a project where the issue is reproduced or at least an *.ioc file.
Kind regards,
Semer.
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.
2023-03-14 06:52 AM
I apologise for not replying earlier.
Soon after getting this issue I upgraded the CubeMX applications.
What I can say is that I can't reproduce the problem with STM32CubeMX v6.8.0
I've change the queue size and the corresponding numbers ("Queue Size" "msg_count") in freertos.c change as one might expect and the project compiles fine.