Part Number: CC2640
Other Parts Discussed in Thread: CC2650STK
Tool/software: TI-RTOS
Background - trying to gather hardware interrupts pulses from IR sensor. I am receiving the correct number of pulses based on the IR host protocol, but the timings are off.
The data is based on pulse duration, something like: base pulse length + 90 Us * n where N is a number between 0-F (a nibble), so min accuracy I need is less then 90 Us.
Problem - The timestamps I seem to be getting are not accurate enough. I am collecting the timings by storing previous ticks - "Clock_getTicks", then once i have collected enough pulses, i disable IR handler and notify main task to process, which when done processing, it will just re-enable the interrupt that particular data pin.
IR Handler sample:
void IR_Interrupt_Handler(void)
{
uint32 tick_now = Clock_getTicks();
//store pulse: tick_now - IR_data.last_activity_ticks ( I later mutiple these values by "Clock_tickPeriod" to make them in Us (microseconds).
if (received required number of pulses)
{
//1. disable interrupt
//2. notify main task to process the data (which, when done, resets receive buffer and enables interrupts to kick the receiving of more IR data
}
IR_data.last_activity_ticks = tick_now;
}
Note: I tried disabling interrupt on this datapin inside the IR handler and then, re-enabling it at the end of it, which does not change my result, however when i do this it seems to lock up after some iterations, about 200-300 cycles pulses
is there a better way to timestamp hardware interrupts?