Hello experts,
I debug the example: Example S32K144 PDB ADC DMA S32DS.ARM.2018.R1, I download the codes from: https://community.nxp.com/docs/DOC-343295
I used S32K144 EVM board , and the SDK version is S32SDK_S32K1xx_RTM_3.0.0.
But I did’t understand it very well.
The RM reads “Each PDB supports 4 slots/4 triggers channel, and each channel supports 8 pre-triggers.” . In the demo, PDB0 has 8 channels,but ADC0 has 16 channels. If the ADC0 channels are not ADC0_SE12, and the 16 channels of ADC0 are ADC0_SE0 to ADC0_SE15.
Does it mean:
1.channel0 of PDB0 pre-triggers from ADC0_SE0 to ADC0_SE7? channel1 of PDB0 pre-triggers from ADC0_SE8 to ADC0_SE15?
2. Are channel2 ~ channel3 of PDB0 not used?
3. if there is something wrong with channel ADC0_SE10, the circuit is disconnected, will the AD never be completely converted? will the DMA interrupt never be generated?
4. LPIT is trigger source, but is PDB0 pulse-out also a trigger source? I don’t understand why is PDB0-pulse-out used.
5. the RM reads “For trigger sources other than PDB and LPIT, software is required to provide ADC pre-triggers.“ How can I do to realize software pre-trigger?
hello Petr Stancik,
i have an example for multi ADC channel sampling then trigger DMA interrupt.
now i have a new requirement from customer. for example. now i have 5 ADC0 channel, and every ADC channel need sampling 80datas, after get 5x80 = 400 data, then trigger one time DMA interrupt. how to realize this?
Hi,
1) the assignment is following
PDB0 ch0 pretrigger0 ... ADC0_SC1A
PDB0 ch0 pretrigger1 ... ADC0_SC1B
...
PDB0 ch0 pretrigger7 ... ADC0_SC1H
PDB0 ch1 pretrigger0 ... ADC0_SC1I
PDB0 ch1 pretrigger1 ... ADC0_SC1J
...
PDB0 ch1 pretrigger7 ... ADC0_SC1P
Using ADC0_SC1n you can configure which external channel/pin will be converted and result stored in respective Rn (n is A to P)
2) just 2 PDB channels are implemented in S32K144, see Table 44-1 of the RM
3) if the conversion is not finished, COCO is not set then DMA is not triggered and DMA interrupt could not apear
4) PDB0 pulse-out is used for debug perposes only. It shows start of conversion sequence as the pulse on selected pin.
5) software pretriggers need to be configured using SIM_ADCOPT[ADCxSWPRETRG].
BR, Petr
PDB0 pulse-out is used for debug perposes only. how to disable this function?when use this project,the pulse display on PTA1,it effects adc sample because i use this pin to sample.
Hi, Petr Stancik:
I want to know the follow sequence,when the ADC0_SC1H complete convert, when ADC0_SC1I start convert?
Because I found ADC0 interrupt m times and then don't go into interrupt again.
PDB0 ch0 pretrigger7 ... ADC0_SC1H
PDB0 ch1 pretrigger0 ... ADC0_SC1I
In my job,I set the code:
PDB_DRV_SetTimerModulusValue(INST_PDB1,pdb1_IntValue);
PDB_DRV_SetValueForTimerInterrupt(INST_PDB1,pdb1_IntValue/2);
PDB_DRV_SetAdcPreTriggerDelayValue(INST_PDB1, 0UL, 0UL, 0/*pdbIntValue*/); //starts immediately
PDB_DRV_SetAdcPreTriggerDelayValue(INST_PDB1, 1UL, 0UL,(pdb1_IntValue/4));
Is there any wrong in my code? thank you!
Hi,
ADC0_SC1I is started upon PDB0 ch1 pretrigger 0 is asserted, i.e. when PDB0 counter is equal to PDB0 ch1 delay 0 register. this delay is set by PDB_DRV_SetAdcPreTriggerDelayValue(INST_PDB1, 1UL, 0UL,(pdb1_IntValue/4)); assuming INST_PDB1 means PDB0.
This delay must be properly set to ensure previous conversions from PDB0 ch0 are finished.
BR, Petr
Hello Stancik,
Thanks very much for your detailed answer. I understand these.
Wish you a happy day.