Trigger ADC via PDB

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Trigger ADC via PDB

364 Views
abicash
Contributor III

Hello

 

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

ADCSC2 = ADCSC2_ADTRG_MASK; 

 

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

Labels (1)
0 Kudos
1 Reply

249 Views
ankur_kala
NXP Employee
NXP Employee

Hi Abhijit,

PDB generally does not have a output pin associated. Can you please tell which device you are working on so that we can cross verify.

Meanwhile to check the syncing, you can enable ADC ISR and toggle a GPIO in it.

Note: In case you find the answer helpful/correct, please mark the same.

Regards,

Ankur

0 Kudos