KSDK 2.0 + Kinetis Bootloader v1.2.0 + FreeRTOS V8.2.3

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

KSDK 2.0 + Kinetis Bootloader v1.2.0 + FreeRTOS V8.2.3

972 次查看
thcooke77
Contributor III

A warning to all:

If you are using the Stock Kinetis Bootloader v1.2.0 and a Project using the FreeRTOS included with KSDK 2.0 there is a problem with the Systick initialization.

 

The Kinetis Bootloader uses Systick for its timers. When in the bootloader deinits the Systick it does not clear the SYSTICK_CURRENT_VALUE_REG. When the freertos scheduler starts under certain situations the Systick will not fire untill the SYSTICK_CURRENT_VALUE_REG completely rolls over causing an assert to happen when using tickless idle mode.

 

If you do not want to change the stock bootloader code you must make a  slight change to the vPortSetupTimerInterrupt() initialization in port.c (or define your own because it is weakly defined).

 

Below is what will always work (Additions in blue):

/* Configure SysTick to interrupt at the requested rate. */

// Clear out the CTRL Register (Just in case it happened to be running)

portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CTRL_REG &

       ~( portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT |

            portNVIC_SYSTICK_ENABLE_BIT );

// Load the reload value

portNVIC_SYSTICK_LOAD_REG = ( configSYSTICK_CLOCK_HZ / configTICK_RATE_HZ ) - 1UL;

// Clear out any current values from the bootloader

portNVIC_SYSTICK_CURRENT_VALUE_REG = 0;

// Enable the systick timer

portNVIC_SYSTICK_CTRL_REG = ( portNVIC_SYSTICK_CLK_BIT |

            portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT );

 

Terry Cooke

标签 (1)
0 回复数