All analog pins in Nucleo-F103RB

Post here first, or if you can't find a relevant section!
Post Reply
Reza Bodaghi
Posts: 1
Joined: Sat Feb 20, 2021 9:27 am
Location: Iran

All analog pins in Nucleo-F103RB

Post by Reza Bodaghi »

Hello.
I am trying to set D0 and D1 pins on the Nucleo-F103RB board as analog input. These two pins are PA3 and PA2 and are the third and second inputs of ADC (in STM32F103RB). I have written this program and connected the output pin of a potentiometer to PA2. I change the voltage on PA2 between 0 and 3.3 volts. The result of the program should be a change in the blinking speed of the built-in LED. The blinking speed of the LED should be constant when the potentiometer position is constant. But the blinking speed is not constant and its speed is random.

Code: Select all

void setup()
{
	analogReadResolution(12);	
	pinMode(LED_BUILTIN, OUTPUT);
}

void loop()
{
	delay(analogRead(PA2)); // or delay(analogRead(digitalPinToAnalogInput(D1)));
	digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));	
}

I discovered the Nucleo-F103RB analog pins as follows:

A6 -> D11 (PA7)
A7 -> D12 (PA6)
A8 -> D13 (PA5)
A9 -> pin 35 on CN7 (PC2)
A10 -> pin 37 on CN7 (PC3)
A11 -> pin 24 on CN10 (PB1)
A12 -> pin 34 on CN10 (PC4)
A13 -> pin 6 on CN10 (PC5)


But A14 and A15 are not defined.
I am using Arduino IDE. Sorry for my poor English.
Thank you for your guidance.
User avatar
fpiSTM
Posts: 1745
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: All analog pins in Nucleo-F103RB

Post by fpiSTM »

Hi @Reza Bodaghi
as the PA2/PA3 are the pins used by Serial they are not define as analog. Anyway it could be, I'm currently reworking all variant and I will add them.
Anyway you will have to disconnect STLink VCP.
Post Reply

Return to “General discussion”