AnsweredAssumed Answered

Trigger ADC via PDB

Question asked by Abhijit Jagtap on Jul 7, 2014
Latest reply on Jul 7, 2014 by Ankur Kala



I am not able to get this right.


I have an 8KHz FTM2 Edge-Aligned PWM and i need to trigger a ADC channel to read a value.


The count for the FTM2 MOD is 250.

I set the PDB1 as such

void PDB1_init() { PDB1CTRL1 = 0xB0; PDB1CTRL2 = 5 ; //Trig 5 by FTM2 //PDB1CTRL2_PRESCALER = 5 ; //5=div by 32 so 32MHz/32 = 1MHz = half of FTM2 PDB1DLYB  = FTM2_OVERFLOW/4;//FTM2_OVERFLOW = 250 PDB1SCR = 0xC0;//view on pin PDB1SCR_PDBEN = 1; PDB1CTRL1_LDOK = 1; } 


I set ADC to trigger from this trigger



In the FTM2 overflow ISR

.//some code . ADCSC1_ADCH = 11 ; SetVoltage = ADCR ;  //read value in a variable . .//other code 


Now i do get the value read.

I want to see whether it is synced to FTM2 , for which i have enabled the PDB1 output pin.

But i am not able to see a train of pulses on this pin, with reference to FTM2 PWM pulses.


Am i doing something wrong??


Please help..tried too many things..maybe i am doing a very fundamental mistake