Use PDB to trigger ADC0 and ADC1 at the same time

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

Use PDB to trigger ADC0 and ADC1 at the same time

1,355 Views
ivyxx
Contributor II

Hi,

I use ADC0, ADC1, PDB0, PDB1 to convert ADC bandgap voltage at the same time. The CPU is S32K146. In some boards, the value converted by ADC1 is lower than ADC0. Can ADC0 and ADC1, or PDB0 and PDB1 be used at the same time?

The ADC bus clock is SIRCDIV2, conversion clock is input clock/2, trigger mode is HW trigger. System clock is FIRC.

PDB0 and PDB1 use same config:

PCC->PCCn[PCC_PDB0_INDEX] |= PCC_PCCn_CGC_MASK;
PDB0->SC |= PDB_SC_TRGSEL(0xF) | PDB_SC_PRESCALER(1) |PDB_SC_MULT(0) | PDB_SC_PDBEN_MASK; 
PDB0->CH[0].C1 |= PDB_C1_BB(0xFE) | PDB_C1_TOS(0x00) | PDB_C1_EN(0xFF); 
PDB0->SC |= PDB_SC_LDOK_MASK; 

Then I enable sw trigger of PDB0 and PDB1 at the same time and read the result:

PDB0->SC |= PDB_SC_SWTRIG_MASK; 
PDB1->SC |= PDB_SC_SWTRIG_MASK;

while(((ADC1->SC1[7] & ADC_SC1_COCO_MASK)>>ADC_SC1_COCO_SHIFT) == 0);

rawvalue0 = ADC0->R[1];

rawvalue1 = ADC1->R[1]

 

0 Kudos
Reply
7 Replies

1,338 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @ivyxx 

Could you clarify if you are trying to measure the same pad with both ADC?

 

B.R.

VaneB

0 Kudos
Reply

1,324 Views
ivyxx
Contributor II

Hi VaneB,

Yes. I want to measure ADC bandgap voltage(27) in both ADC.

0 Kudos
Reply

1,308 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @ivyxx 

It is not recommended to measure the same pad with two different ADC. You can get interference or noise in any of the channels.

0 Kudos
Reply

1,258 Views
ivyxx
Contributor II

Hi VaneB,

Just want to make sure, does the same pad means two ADCs connect to the same pin?

Do two ADCs share the same bandgap voltage measure pin?

0 Kudos
Reply

1,234 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @ivyxx 

I am sorry if I was not clear.

I mean two MCU pins each from a different ADC measuring a single pin from your (let's say) external device.

0 Kudos
Reply

1,199 Views
ivyxx
Contributor II

 

Hi VaneB,

I thought the Bandgap voltage is the internal pin? I do not know the hardware in the chip, but I want to confirm do the two ADCs measure the same bandgap voltage if I set ADCx->ADCH to 27 in both ADCs.

ivyxx_1-1687846510991.png

 

 

0 Kudos
Reply

1,176 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @ivyxx 

Thanks for the feedback and sorry I misunderstood what you were looking to measure.

The same situation that I mentioned before continues to apply, when measuring the same reference voltage, in this case, the Bandgap, there may be an interference from an ADC if it is measured at the same time.

What you could verify is measuring at different times, that is, first the ADC0, wait a while, and then ADC1.

Let me know if you notice a difference in the values obtained and please share the values.

0 Kudos
Reply