ADC module operation

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

ADC module operation

跳至解决方案
1,864 次查看
soaring_sun
Contributor III

Hi,

I wanted to use an ADC for measurements. In the previous microcontrollers that I had been using, I used to connect the PWM pin to the ADC, which starts calculating the values at compare match. Once the calculations are done, the ADC triggers an interrupt where the next actions take place. 

But after going through the reference manual and related posts, I understand that an FTM is used to trigger the ADC, correct? Or will I be able to follow the same procedure as stated above? Or does ADC work independently without having to use any trigger mechanism?

There is no example that explains the ADC module usage. Help me out.

0 项奖励
回复
1 解答
1,797 次查看
soaring_sun
Contributor III

Yes! I found them, thank you.

So, to conclude there are two ADCs - ADCA and ADCB both having 0 to 7 channels with a total of 15 ADC channels for analog calculations. The result of them can be configured to the CLIST 1 to 4 according to the user needs.

Here, in the in built function,

void CADC_SetSampleConfig(ADC_Type *base, uint16_t sampleIndex, const cadc_sample_config_t *config);

the sample index can vary from 0 to 15 and the same number cannot be used to measure more than one ADC value.

Am I right about this?

Help me understand better. Thanks in advance.

在原帖中查看解决方案

0 项奖励
回复
5 回复数
1,798 次查看
soaring_sun
Contributor III

Yes! I found them, thank you.

So, to conclude there are two ADCs - ADCA and ADCB both having 0 to 7 channels with a total of 15 ADC channels for analog calculations. The result of them can be configured to the CLIST 1 to 4 according to the user needs.

Here, in the in built function,

void CADC_SetSampleConfig(ADC_Type *base, uint16_t sampleIndex, const cadc_sample_config_t *config);

the sample index can vary from 0 to 15 and the same number cannot be used to measure more than one ADC value.

Am I right about this?

Help me understand better. Thanks in advance.

0 项奖励
回复
1,770 次查看
Alexis_A
NXP TechSupport
NXP TechSupport

Hello @soaring_sun,

You're understanding is right. The CLIST defines the channel sample according to the user needs and in case you need to sample multiple times has the advantage that, depending on the mode enabled in the ADC_CTRL1.SMODE, you can perform sequential or parallel conversions.

Best Regards,

Alexis Andalon

0 项奖励
回复
1,763 次查看
soaring_sun
Contributor III

Thanks @Alexis_A That clears my doubts.

0 项奖励
回复
1,851 次查看
soaring_sun
Contributor III

Okay, so I found that inspite of triggering the ADC with various other methods (using FTM, DMA...) it can also be triggered using PWM pin. The reference manual states so in both the ADC and PWM sub headings. The following is the reference manual that I'm referring.

mkv46f256vll16_reference_manual 

Capture.PNG

Capture.PNG

But no where in the manual it is said how to access these bits. Or is it something I'm missing. I have also gone through a few inbuilt functions. But I don't see any that comes close to this. Although, I found one information regarding the same under PWMA_DTSRCSEL heading, but it states that it is mainly used for the dead-time calculations. So, if I'm not using a dead time for that particular PWM, operating it in the independent mode, then is this bit acting as a external trigger to ADC?

Capture.PNG

If so, then I should be using the inbuilt function

 Capture.PNG

But it is just not making any sense to me. Please help me out with this, asap. 

0 项奖励
回复
1,811 次查看
Alexis_A
NXP TechSupport
NXP TechSupport

Hello @soaring_sun,

In the SDK, in the section of demo examples, there's one called cadc_pwm_trigger, the registers are accessed using the  XBARA_SetSignalsConnection API.

Best Regards,
Alexis Andalon

0 项奖励
回复