Use PDB to trigger ADC0 and ADC1 at the same time

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Use PDB to trigger ADC0 and ADC1 at the same time

1,376 次查看
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 项奖励
回复
7 回复数

1,359 次查看
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 项奖励
回复

1,345 次查看
ivyxx
Contributor II

Hi VaneB,

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

0 项奖励
回复

1,329 次查看
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 项奖励
回复

1,279 次查看
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 项奖励
回复

1,255 次查看
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 项奖励
回复

1,220 次查看
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 项奖励
回复

1,197 次查看
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 项奖励
回复