AnsweredAssumed Answered

read input level on PA32 FTM2 input capture channel?

Question asked by Ann Renner on Aug 12, 2015

FTM2 channel on 9S08PA32VLH is configured for rising edge input capture. No issues with interrupts or related routines. Same port pins have inputs enabled (in PORT_PTCIE).


If I disable input capture (by writing 0 to FTM2CxSC), I can connect the input to Vcc or Ground and read the input levels just fine. But, as soon as I enable input capture (by writing 0x44 to FTM2CxSC), the Port input level gets "stuck". In other words, I can change the level at the input, but the result from reading PORT C never changes.


I have tried disabling all interrupts as well as clearing the interrupt flag before reading. I have looked at the port contents and related registers (PORT_PTCD, PORT_PTCIE, and FTM2 registers) directly using debug in Code Warrior as well as with an LED when hardware is not attached via BDM. No difference.


I also tried deleting all FTM2 init code and just using the Processor Expert capture component with Enable, Disable, and GetPinValue methods. Still no difference.


My memory could be faulty, but I do not recall this being an issue with TPM on other S08 processors. The reference manual for this device is somewhat ambiguous on whether GPIO will work with a FTM channel.


Is this just the way it is supposed to work? Or is there something else in configuration I could be missing? Currently, clock  gating is already enabled for all. Or is this a bug in the chip?


I can always change my interrupt routine to handle this (for example by using both edges and temporarily disabling capture to read the level), but I would really like to know how this is supposed to work.


Thanks for any and all input.