This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

STM32 RTXKernel USB hardfault

Hello,
I am building a virtual-com port device using STM32F103RB which has a CortexM3 core. For the USB stack I used the code from Keil example itself but with RTX-Kernel enabled in the project.

Compiling and linking does not bother me at all (without the IMPORT SWI_Handler addition in the startup file, since I read somewhere that it is not required for M3 cored devices).

The problem starts when the os_sys_init function is called. System simply goes into the hard_fault handler routine.

In my main function I am initializing the RCC, NVIC then USB clock configuration, NVIC entry and the usb library initialization just as mentioned in the example, but no luck. So I commented the os_sys_init call and replaced it with the infinite loop from the USB example (which simply checks for new data at the USB port) and modified it so as to echo the data received. Still it didn't work. Then I commented all code pertaining to systick initialization, and then it worked. It stated echoing the characters I typed in through Hyperterinal.

Now I am guessing that it is not RTXKernel that is bringing me this trouble, but the systick interrupts.

I also confirmed that without USB routines the system is working fine with RTXKernel (and for that matter systick as well).

Any clues? please help.