Hi,
I have tested the HW timer in free mode and compare mode (with direct access to the registers in both cases) and all was fine (counter was ok and interrupt was generated in compare mode).
However, I have been trying to make the HW Timer to work in capture mode and I did not succeed at all. I am using AM3559 micro.
The dedicated input trigger seems not to work (no interrupt is raised, and no values are loaded into the TCAR registers). I have used TIMER4 input (I tried with TIMER7 later as well).
What I need is saving the current timer value into the TCAR registers when a change/pulse in the timer dedicated input is detected.
This is my configuration:
Multiplex:
Configure dedicated pin as TIMER4 peripheral.
Interrupts: (I suppose this should be fine, as interrupt triggers in compare mode)
Set register INTC_ILR92 to 0 (max priority)
Set bit 92%32 on INTC_MIR3 to 1 to enable interrupt
DMTimer module:
Disable timer: set TCLR to 0
Re-load 0 in overflow: set TLDR to 0
Clear initial count: set TCRR to 0
Enable interrupt: set TIMER_IRQ_CAPTURE to IRQENABLE_SET --> value = (1<<2)
Enable timer: set TIMER_START | TIMER_AUTORELOAD | TIMER_CAPTURE_RISING to TCLR --> value = 1 | (1<<1) | (1<<8)
Clear any pending associated interrupt.
(As a fallback solution I am now reading the free running timer value from a GPIO interrupt handler that detects the change; however I would need the most accurate timer value possible).
Thanks in advance.