Trigger ADC via PDB

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Trigger ADC via PDB

375件の閲覧回数
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

ラベル(1)
0 件の賞賛
1 返信

260件の閲覧回数
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 件の賞賛