cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_GetTick() crash mcu

thom_as
Associate II
Posted on April 28, 2016 at 10:17

I created a simple project using STCubeMX for my nucleo-f446ZE(STM32F446ZET6).

The project should be a USB device HID but it fail to start. After messing around with the debugger, I discovered that the MCU PC register go to 0x00000000 or 0xFFFFFFFF or sometimes random invalid value.

I didn't modify any code. I compiled the code with MDK-ARM (modified GCC, Vision IDE), and with GCC (openSTM32) and the same thing happen.

Callstack :

  • Main
  • SystemClock_Config
  • HAL_RCC_ClockConfig (632)
  • Hal_GetTick

Ps: RAM got corrupted after 0x080149A and that why the program do weird stuff Image

http://i.stack.imgur.com/1VVLb.png

#stm32f4-nucleo-f446-stcubemx-hal
3 REPLIES 3
Nesrine M_O
Lead II
Posted on April 28, 2016 at 12:45

Hi none.thomas,

I recommend you also to have a look to the USB examples under the STM32F4 cube firmware package: 

STM32Cube_FW_F4_V1.11.0\Projects\STM32446E_EVAL\Applications\USB_Device\HID_Standalone : This application is a part of the USB Device Library package using STM32Cube firmware. It describes how to use USB device application based on the Human Interface (HID) on the STM32F446xx devices.

For more details about the STM32Cube USB Device library, please refer to UM1734 ''STM32Cube USB Device library''.

-Syrine –

Posted on April 28, 2016 at 15:15

Not sure there is enough detail to make any kind of diagnosis.

I would check the stack configuration, and PLL/FLASH settings. See if turning off optimization changes the failure.

What exactly gets corrupted in RAM, ie what is supposed to be, and what gets written instead.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
thom_as
Associate II
Posted on April 29, 2016 at 09:28

Misconfiguration of PLL set has SYSCLK later corrupt data in rom and ram.

The solution is here :

http://stackoverflow.com/questions/36908369/hal-gettick-crash-mcu/36909221

Thank you for your help