Hello,
I try to read the documentation of chibios and stm32f429.
I understood the fields of ADCConversionGroup, and how the bits are affecting the ADC conversion.
What I can't understand is how once I choose an analog input (for example PA1 or PC12 and so on) how to link this input with an ADC unit and then which conversion channel among the 1-16 availables (for example ADC_CHANNEL_IN12) I have to configure.
I have an stmf429 processor, from the datasheet
Can I say that for PA1 the adc to use is indifferently 1,2 or 3 with channel 1?
Thanks
ADC how to link and input to an adc unit
-
- Posts: 106
- Joined: Thu Mar 12, 2015 10:15 am
- Has thanked: 2 times
- Giovanni
- Site Admin
- Posts: 14461
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
-
- Posts: 106
- Joined: Thu Mar 12, 2015 10:15 am
- Has thanked: 2 times
Re: ADC how to link and input to an adc unit
from the example inside testhal, they were used PC1 and PC2 which seems to be linked with adc123 11 and adc123 12 that are indeed the channels used in the code
Am I right?
Code: Select all
static const ADCConversionGroup adcgrpcfg2 = {
TRUE,
ADC_GRP2_NUM_CHANNELS,
adccallback,
adcerrorcallback,
0, /* CR1 */
ADC_CR2_SWSTART, /* CR2 */
ADC_SMPR1_SMP_AN12(ADC_SAMPLE_56) | ADC_SMPR1_SMP_AN11(ADC_SAMPLE_56) |
ADC_SMPR1_SMP_SENSOR(ADC_SAMPLE_144) | ADC_SMPR1_SMP_VREF(ADC_SAMPLE_144),
0, /* SMPR2 */
ADC_SQR1_NUM_CH(ADC_GRP2_NUM_CHANNELS),
ADC_SQR2_SQ8_N(ADC_CHANNEL_SENSOR) | ADC_SQR2_SQ7_N(ADC_CHANNEL_VREFINT),
ADC_SQR3_SQ6_N(ADC_CHANNEL_IN12) | ADC_SQR3_SQ5_N(ADC_CHANNEL_IN11) |
ADC_SQR3_SQ4_N(ADC_CHANNEL_IN12) | ADC_SQR3_SQ3_N(ADC_CHANNEL_IN11) |
ADC_SQR3_SQ2_N(ADC_CHANNEL_IN12) | ADC_SQR3_SQ1_N(ADC_CHANNEL_IN11)
};
Am I right?
- Giovanni
- Site Admin
- Posts: 14461
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: ADC how to link and input to an adc unit
Correct, the authoritative source is the data sheet for this kind of info.
Giovanni
Giovanni
-
- Posts: 106
- Joined: Thu Mar 12, 2015 10:15 am
- Has thanked: 2 times
Re: ADC how to link and input to an adc unit
Giovanni thanks for the answer!
But if it is true that most input are connected to all DAC, it is not true that I can choose randomly the adc channel to use. Using the example in testhal, if I choose PC1 I must use ADC_CHANNEL_IN11 and not for example ADC_CHANNEL_IN1.
But when I choose which ADC to use, I can enable STM32_ADC_USE_ADC1 or STM32_ADC_USE_ADC2 or STM32_ADC_USE_ADC3 indifferently.
But if it is true that most input are connected to all DAC, it is not true that I can choose randomly the adc channel to use. Using the example in testhal, if I choose PC1 I must use ADC_CHANNEL_IN11 and not for example ADC_CHANNEL_IN1.
But when I choose which ADC to use, I can enable STM32_ADC_USE_ADC1 or STM32_ADC_USE_ADC2 or STM32_ADC_USE_ADC3 indifferently.
-
- Posts: 106
- Joined: Thu Mar 12, 2015 10:15 am
- Has thanked: 2 times
Re: ADC how to link and input to an adc unit
Sorry for my last post, you were already writing the answer when I was posting mine.
Thanks a lot for the clarification!
Thanks a lot for the clarification!
Who is online
Users browsing this forum: No registered users and 9 guests