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.
Solved! Go to Solution.
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.
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.
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
Thanks @Alexis_A That clears my doubts.
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
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?
If so, then I should be using the inbuilt function
But it is just not making any sense to me. Please help me out with this, asap.
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