cancel
Showing results for 
Search instead for 
Did you mean: 

CubeF4.10 + FreeRTOS + USB CDC + F427VI = Hardfault

ersan
Associate II
Posted on April 09, 2014 at 23:52

Hi,

I generated a project with an lqfp100 STM32F427VIT6 and I had following setup:

- FreeRTOS

- USB CDC FS

- FatFS / SD Card

- Keil MDK-ARM 4.74

- no DMA

- freertos default settings

The generated Project is building fine with no errors.

1)

While in the debuger window & step by step execution, the Init of the Peripherial is working fine. When I'm entering osTaskCreate the MCU goes into a hardfault.

What could causes the problem? Are there some Stack or heap settings required to manage the USB Task?

2)

For the USB CDC it would be nice if you guys could integrate a printf / put/get feature into the HAL. How can I now add these manually?

Kind regards

Emi
1 REPLY 1
Nawres GHARBI
ST Employee
Posted on April 10, 2014 at 12:53

Hi Emilio,

1)

While in the debuger window & step by step execution, the Init of the Peripherial is working fine. When I'm entering osTaskCreate the MCU goes into a hardfault.

What could causes the problem? Are there some Stack or heap settings required to manage the USB Task? 

This issue may be caused by:

1- The Memory: I advice you to set the heap to 4000 and the stack to 2000

2- The Priorities: When using the FreeRTOS you have to set the priority grouping to 4 bits for preemption and 0 bits for sub-priority as shown in the figure below

0690X00000605eUQAQ.png

2)

For the USB CDC it would be nice if you guys could integrate a printf / put/get feature into the HAL. How can I now add these manually?

You can have the debug messages in the IO Terminal by activating the USB debug level in the MW configuration as shown in the figure below:

0690X00000605ZLQAY.png

Hoping it helps you, please let me know if it works for you.

Best Regards,

Nawres.