2017-04-24 08:30 AM
Hi All,
I'm using STM32L486RG microcontroler, And 1Wire EEPROM.
I have to use Timer to compute delays type ( delay for 5 �s to 500 �s).
And I'm asking on How to Re-configure Timer on it's interrupt callBack and restart it.
However, I was successfully able to disable the timer once IT callBack was generated. and I restarted it in my freeRTOS task,
I was able to visualize time from oscilloscope, and it was correct timing.and now, I have to reduce more and more CPU charge by Restatring It on it's Interruption CallBack.
Below my IRQ handler Algorithm:void TIM1_UP_TIM16_IRQHandler (void)
{ if(LL_TIM_IsActiveFlag_UPDATE(TIM1) == 1) { /* Clear the update interrupt flag*/ LL_TIM_ClearFlag_UPDATE(TIM1); /* Disable the Timer*/ LL_TIM_DisableIT_UPDATE(TIM1);/* Reconfigure the Timer and restart*/
LL_TIM_SetAutoReload(TIM1, XXX); // Another Timer Period (depending on my 1Wire EEPROM state) LL_TIM_EnableIT_UPDATE(TIM1); } }Using this method, Timing is not correct, and my eeprom is not working correctly.
Can you help me please ?
Best Regards.
#stm32l4 #eeprom #microseconds #1wire #free-rtos #stm32l4-timer #timer-interruptSolved! Go to Solution.
2017-04-24 08:39 AM
200 KHz is perhaps a rather aggressive interrupt rate.
You should just need to write the TIM1->ARR with the new period, You'd want to preload (immediate), otherwise it will load at the next update.
2017-04-24 08:39 AM
200 KHz is perhaps a rather aggressive interrupt rate.
You should just need to write the TIM1->ARR with the new period, You'd want to preload (immediate), otherwise it will load at the next update.
2017-04-24 09:23 AM
Alternatively, use a free running timer with say 1000 usec period. Then, if you need a delay or precise cascaded delay, use an output compare interrupt. Disabling the capture interrupt does not freeze timer counting time. It gives you 2 strategies:
- you program a delay from now by reading current timer, add the delay and write the compare register.
- you program a delay from the previous output compare timestamp for exact delays between interrupts...
Output compares can be output to gpios, so it could directly generate the right waveform by hw assistance.
2017-04-25 03:29 AM
Thank you
Turvey.Clive.002
,I wrote in TIM1->ARR Register with the new period, then I restarted it,
It seems working correctly,
Thank you very much