2025-01-18 06:28 PM
I have read some posts about this topic already but unclear if this works or not. I used the STMCubeMX to create a project using FreeRTOS and USB Device CDC (USB-Serial) together and some LED GPIO's.
I can only get one or the other to work, but never at the same time. I have tried adjusting the memory settings heap/stack as suggested in some of the forums but that didn't help. Just wanted to check if anyone has this working or if I should switch to a different scheduler/OS? I am using a STM32F303RE; any help would be appreciated. Thank you
2025-01-20 06:35 AM
Hi @jayduino
I don't have example projects for all products. The attached one should be helpful in your case. You need to change the target and all dependencies to port the project properly to STM32F3.
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.
2025-01-20 10:12 AM
Thank you FBl.
I will give it a shot and get back to you!
2025-01-23 05:55 PM
I was able to review your example and I didn't see anything different in your code so I tried to run FreeRTOS with USB on another development kit with a STM32F405 and that ran perfectly fine right out of CubeMX!
When I try the same setup on my custom device using the STM32F303RE device (just a default task with osDelay(), no other extra code), it does not work. I also disabled USB and it still did not work. When I try to debug it, it shows that it is getting stuck inside this:
Default_Handler:
Infinite_Loop:
b Infinite_Loop
.size Default_Handler, .-Default_Handler
When comparing the code between the STM32F4 and the STM32F3, I did notice that
configTOTAL_HEAP_SIZE ((size_t)15360) was a lot smaller on the F3 device, so I bumped that up to match the 15360 with no change, still getting stuck in the default handler.
Is there something else that could cause the STM32 to jump into the default handler? The code does make it to the osdelay(), but it never makes it back a second time.
2025-01-23 07:14 PM
Never mind, I had to change to CMSIS_V1, and now the code is running but the USB COM port does not work. When I go to open the port, it will not open even though it does show up on my PC. Why would it work on the F4, but not on the F3?
2025-01-27 06:18 AM - edited 2025-01-27 06:21 AM
Any thoughts FBL?
Never mind, I had to change to CMSIS_V1, and now the code is running but the USB COM port does not work. When I go to open the port, it will not open even though it does show up on my PC. Why would it work on the F4, but not on the F3?
2025-01-27 07:28 AM
Hello again @jayduino
Did you manage to use USB VCP on your F3 standalone (without RTOS)? If not, check the example provided here. It might help you. Also, make sure to use external pull-up resistor on USB_DP, since this line doesn't embed. Otherwise, the USB assumes that there is nothing connected to the bus.
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.
2025-01-27 07:42 AM
Hi FBL, yes it does work without RTOS.
Let me look into the pull up design to see if that is setup correct. I will check and report back.
2025-01-27 07:45 AM - edited 2025-02-07 07:34 AM
@jayduino wrote:
Default_Handler:
Infinite_Loop:
b Infinite_Loop
If you jump to the default handler, this means you have an interrupt (NVIC enabled) that has been fired but you didn't define its IRQ handler. Check the defined IRQ interrupts in the working project (it.c) and compare it to the non working one. It could there is an IRQ handler is missing there.