2019-03-02 01:14 PM
Hi,
I am writing code for the STM32f103 involving ADC conversion.
I understand you have to select a list of "channels" you want to be converted and put them either in a regular or injected list. These lists are contained in the ADC_SQRx (or ADC_JSQR for injected) registers.
I am using for this the reference manual RM0008 rev 20.
I presume each "channel" is connected to a given pin (say PA0, PA1,... provided they are configured as analogue input of course) or some internal signal (Vcc,Temperature).
The problem I have is that I find nowhere the list of channel numbers and what they are connected to, which render impossible the task of reading any analogue input.
Can somebody help on this and point me to the right direction ?
Where can I find documentation on channel numbers for STM32f103 ?
Solved! Go to Solution.
2019-03-02 04:38 PM
The Data Sheet for your specific part. There will be a pin enumeration like ADC12_CH5, which is CH5 pin ADC1 and ADC2
2019-03-02 04:38 PM
The Data Sheet for your specific part. There will be a pin enumeration like ADC12_CH5, which is CH5 pin ADC1 and ADC2
2019-03-03 03:34 AM
Thank you very much. That indeed was where the information was hidden :-))
for the sake of future readers, here is what comes out:
For STM32F103RB (and all chips STM32F103x8 or STM32F103xB)
00000 channel 00 of ADC1 and ADC2 ---> PA0
00001 channel 01 of ADC1 and ADC2 ---> PA1
00010 channel 02 of ADC1 and ADC2 ---> PA2
00011 channel 03 of ADC1 and ADC2 ---> PA3
00100 channel 04 of ADC1 and ADC2 ---> PA4
00101 channel 05 of ADC1 and ADC2 ---> PA5
00110 channel 06 of ADC1 and ADC2 ---> PA6
00111 channel 07 of ADC1 and ADC2 ---> PA7
01000 channel 08 of ADC1 and ADC2 ---> PB0
01001 channel 09 of ADC1 and ADC2 ---> PB1
01010 channel 10 of ADC1 and ADC2 ---> PC0
01011 channel 11 of ADC1 and ADC2 ---> PC1
01100 channel 12 of ADC1 and ADC2 ---> PC2
01101 channel 13 of ADC1 and ADC2 ---> PC3
01110 channel 14 of ADC1 and ADC2 ---> PC4
01111 channel 15 of ADC1 and ADC2 ---> PC5
10000 channel 16 of ADC1 ---> temperature sensor
10000 channel 16 of ADC2 ---> Vss
10001 channel 17 of ADC1 ---> temperature sensor
10001 channel 17 of ADC2 ---> Vss
There is no ADC3.
2019-03-03 03:46 AM
An for those who uses the evaluation board with the Arduino connector,
here is the cheat :)
00000 channel 00 of ADC1 and ADC2 ---> PA0 ---> Arduino A0
00001 channel 01 of ADC1 and ADC2 ---> PA1 ---> Arduino A1
00010 channel 02 of ADC1 and ADC2 ---> PA2 ---> Arduino D1
00011 channel 03 of ADC1 and ADC2 ---> PA3 ---> Arduino D0
00100 channel 04 of ADC1 and ADC2 ---> PA4 ---> Arduino A2
00101 channel 05 of ADC1 and ADC2 ---> PA5 ---> Arduino D13
00110 channel 06 of ADC1 and ADC2 ---> PA6 ---> Arduino D12
00111 channel 07 of ADC1 and ADC2 ---> PA7 ---> Arduino D11
01000 channel 08 of ADC1 and ADC2 ---> PB0 ---> Arduino A3
01001 channel 09 of ADC1 and ADC2 ---> PB1
01010 channel 10 of ADC1 and ADC2 ---> PC0 ---> Arduino A5
01011 channel 11 of ADC1 and ADC2 ---> PC1 ---> Arduino A4
01100 channel 12 of ADC1 and ADC2 ---> PC2
01101 channel 13 of ADC1 and ADC2 ---> PC3
01110 channel 14 of ADC1 and ADC2 ---> PC4
01111 channel 15 of ADC1 and ADC2 ---> PC5
10000 channel 16 of ADC1 ---> temperature sensor
10000 channel 16 of ADC2 ---> Vss
10001 channel 17 of ADC1 ---> temperature sensor
10001 channel 17 of ADC2 ---> Vss
2020-11-05 02:32 AM
Thank you @Frederic Cloth