diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2013-08-08 12:38:43 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2013-08-08 12:38:43 +0000 |
commit | 9728e44141592787faff89d858ffba528de70f61 (patch) | |
tree | 453aa3ac87d639129a8a50a5d7131c7e0861307d /os/halnew | |
parent | 0ef4a97438fdcd3b1a26dbf258dbbaf2732358af (diff) | |
download | ChibiOS-9728e44141592787faff89d858ffba528de70f61.tar.gz ChibiOS-9728e44141592787faff89d858ffba528de70f61.tar.bz2 ChibiOS-9728e44141592787faff89d858ffba528de70f61.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6105 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/halnew')
-rw-r--r-- | os/halnew/platforms/STM32/st_lld.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/os/halnew/platforms/STM32/st_lld.c b/os/halnew/platforms/STM32/st_lld.c index d0788bf93..debfde38f 100644 --- a/os/halnew/platforms/STM32/st_lld.c +++ b/os/halnew/platforms/STM32/st_lld.c @@ -104,8 +104,19 @@ void st_lld_init(void) { #if OSAL_ST_MODE == OSAL_ST_MODE_FREERUNNING
/* Free running counter mode.*/
rccEnableTIM2(FALSE);
+
+ /* Initializing the counter in free running mode.*/
+ STM32_TIM2->PSC = STM32_TIMCLK2 / OSAL_SYSTICK_FREQUENCY - 1;
+ STM32_TIM2->ARR = 0xFFFFFFFF;
+ STM32_TIM2->CCMR1 = 0;
+ STM32_TIM2->CCR[0] = 0;
+ STM32_TIM2->DIER = 0;
+ STM32_TIM2->CR2 = 0;
+ STM32_TIM2->EGR = TIM_EGR_UG;
+ STM32_TIM2->CR1 = TIM_CR1_CEN;
+
+ /* IRQ enabled.*/
nvicEnableVector(STM32_TIM2_NUMBER, ST_TIMER_PRIORITY);
- STM32_TIM2->PSC = STM32_TIMCLK2 / OSAL_SYSTICK_FREQUENCY - 1;
#endif
#if OSAL_ST_MODE == OSAL_ST_MODE_PERIODIC
@@ -117,6 +128,7 @@ void st_lld_init(void) { SysTick_CTRL_ENABLE_Msk |
SysTick_CTRL_TICKINT_Msk;
+ /* IRQ enabled.*/
nvicSetSystemHandlerPriority(SysTick_IRQn, ST_TIMER_PRIORITY);
#endif
}
|