2013-11-24 05:30 PM
I am using a discovery kit to evaluate some timer functions. I need to time a data packet send/receive. So, I would like to use one of the timers for this. My plan is to send the last byte of the data packet out a USART and then start a 40ms timer. In the meantime I have to continue processing other data so I can't just simply delay for ''some ms'' waiting for a response from the packet just sent. As soon as I enable TIM2 interrupts in the NVIC the
TIM_IT_Update interrupt fires. Is this normal?2013-11-25 06:48 AM
Is this normal?
Yes, the Update is a Zero/Reset event, so unless you clear pending interrupt it's likely to interrupt when you enable it. Not sure I understand your approach here, I'd be tempted to free run the timer and pull timestamp values at the points you want to measure, and compute a delta (difference) between them. If it's just a matter of marking time, have SysTick provide a 1ms (or whatever) timebase and have a task flag or start the next transfer every 40.