Skip to main content
jose2
Associate
August 14, 2014
Question

STM32Cube MX (STM32F407G) HAL + FreeRTOS

  • August 14, 2014
  • 5 replies
  • 1289 views
Posted on August 14, 2014 at 18:46

hi,

I'm novice with  STM32CubeMX   HAL + FreeRTOS    with  KEIL  MDK-ARM ulink2

I have problems, with SysTick probably, HAL_RCC_ClockConfig, because it genere HardFault_Handler.

When xPortSysTickHandler() in SysTickHandler() in ''stm32f4xx_it.c''  is in comment, there's  no hard fault... and without RTos , I have no problems.

Do you know the problem or do you have basic exemples for STM32F4xx HAL+FreeRTOS ?

merci

Jose Ferreira

    This topic has been closed for replies.

    5 replies

    jwoolston
    Associate III
    August 14, 2014
    Posted on August 14, 2014 at 19:31

    If you go to your user directory in Windows you should see a folder ''STM32Cube''. In there go to ''STM32Cube->Repository->STM32Cube_FW_F4_V1.3.0->Projects->STM324xG_EVAL->Applications->FreeRTOS''. It will have several examples for the OS. Additionally, other board demos exist that may be more specific to your needs.

    rarthaud
    Visitor II
    August 18, 2014
    Posted on August 18, 2014 at 09:07

    Hello,

    I had the same problem and traced it down to the priority group.

    For some reason, it is set to NVIC_PRIORITYGROUP_0  with no way to change it in the GUI. This grouping only allows for subpriorities but no priority.

    Forcing it to NVIC_PRIORITYGROUP_3 solves the problem.

    Roland.

    rarthaud
    Visitor II
    August 18, 2014
    Posted on August 18, 2014 at 16:29

    Actually, I meant NVIC_PRIORITYGROUP_4.

    The priority group is global to the NVIC, but for some reason the generated code includes a HAL_NVIC_SetPriorityGrouping each time you have a peripheral requiring interrupts. And in my case, I don't know how I got the MX generator to have NVIC_PRIORITYGROUP_0 in my code, therefore preventing freeRTOS exception servicing.

    jose2
    jose2Author
    Associate
    August 19, 2014
    Posted on August 19, 2014 at 11:49

    Hi,

    I solve the  problem by regenerating code with  STM32Cube MX  with theses changes in FreeRTOS config : 

    USE_PREEMPTION  : disabled

    USE_TRACE_FACILITY  : disabled

    now it seems ok and I can discover my first RTOS...

    Thanks to Roland and Jared

    José

    jarno
    Associate III
    August 19, 2014
    Posted on August 19, 2014 at 12:44

    once faced the same problem, read following thread for another solution: [DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32Java/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Java/STM32CUBE%20%2b%20FreeRTOS%20%2b%20RTC%20HardFault&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000F9A0E3A95BA69146A17C2E80209ADC21]STM32CUBE + FreeRTOS + RTC HardFault