Wait until the timer peripheral is ready to continue. When built with -O0 this was not needed, but with -O2 the peripheral was not ready when it was accessed.

This commit is contained in:
marcoveeneman 2015-03-20 21:38:01 +01:00
parent 273b1fa525
commit bc7117e04c
1 changed files with 4 additions and 0 deletions

View File

@ -214,6 +214,10 @@ void st_lld_init(void)
/* Enabling timer clock.*/
ST_ENABLE_CLOCK();
/* TODO: dynamic for all timers instead of hardcoded.*/
while (!(SYSCTL->PRWTIMER & (1 << 5)))
;
/* Initializing the counter in free running down mode.*/
TIVA_ST_TIM->CTL = 0;
TIVA_ST_TIM->CFG = GPTM_CFG_CFG_SPLIT; /* Timer split mode */