Hello,
I attempt to trigger ADC via PDB in back to back fashion.
I have read other link on how to do this. The link provides an example where
initial trigger is performed by software trigger. However, I would like to perform
the initial trigger by trigger delay from PDB. I can't get it to work with my
PDB configuration. Below, is some of relevant PDB configuration that I think
is critical. Basically, I try to trigger 2 A2D channel (Ch0 and Ch1 of ADC0).
Ch0 is triggered by pre-trigger delay of PDB, Ch1 is triggered after it receives
COCO flag from Ch0 (back to back).
...
SIM_CHIPCTL[PDB_BB_SEL] = 0;
PDB0->MOD = 950;
PDB0->CH[0].C1 | = PDB_C1_BB(0b00000010) //Pretrigger Back to Back: 0= disabled, 1=enabled
| PDB_C1_TOS(0b00000001) //Pretrigger Output Select: 0=bypassed , 1=enabled
| PDB_C1_EN(0b00000001); //Pretrigger Enable: 0=enabled , 1=enabled
PDB0->CH[0].DLY[0] = 200;
The behavior that I see is in the debugger, Ch0 of ADC0 seems get triggered.
It generates COCO flag, however Ch1 of ADC0 doesn't seem to respond to COCO flag
from Ch0.
Thank you in advance for your help.
Tanto
Hi All,
I found out the problem is with sequence in which initialization of ADC and PDB configuration
is being called in my main code. In my main code, PDB initialization is called before ADC.
The ADC initialization routine that I have contains auto-calibration.
Once I comment out the auto-calibration part from my ADC initialization, or swap ADC and PDB
initialization, my program runs just fine.
I suspect auto-calibration of ADC might run longer than one PDB period (maximum count on PDB as specified by
PDB->MOD). I am not quite clear behavior of S32 micro, when PDB goes over several cycles when ADC
doesn't get a chance to respond to previous pre-trigger. Is it simply just reporting the error to PDB->CHnS
register, or it will do something about it.
Thanks,
Tanto
Hi Tanto,
Yes, the PDB.CHnS[ERR[m]] gives a feedback about wrong trigger sequence. A sequence error typically happens because the delay m is set too short and the pre-trigger m asserts before the previously triggered ADC conversion finishes.
BR, Petr