4 years, 7 months ago.

STM32F103C8T6( aka Blue Pill) some analog pins doesn't working

Hi everybody. When I set analog input pin PA_2 or PA_3. Code compiled successfully , and mcu programmed. But program doest run. But I look datasheet can see clearly PA2, PA3 is analog in2,in3 can be analog input. Why program doesnt run and how can solve this problem?

My code branch out hudakz' hello code

Import programSTM32F103C8T6_Hello

Using low cost Bluepill (STM32F103C8T6) boards with mbed.

I using linux terminal for code edit and build so I exported code setting target selected NUCLEO_F103RB, toolchain selected: Make GCC.

2 Answers

4 years, 7 months ago.

Hi Zoltan,

I checked STM32F103C8T6 board and it looks like that PA_2 and PA_3 pins are only for UART2_TX and RX. Look this mbedOS board document: https://os.mbed.com/platforms/ST-Nucleo-F103RB/

Regards, Pekka

Accepted Answer
4 years, 7 months ago.

Hello Abdurrahman,

Pekka is right. You can check that also in the "Board Pinout" picture at https://os.mbed.com/users/hudakz/code/STM32F103C8T6_Hello. If you'd like to use the PA_2 and PA_3 pins as AnalogIn then you have to select different pins for Serial.

For example:

// ...

Serial   pc(PA_9, PA_10); // TX, RX
AnalogIn analoIn_1(PA_2);
AnalogIn analogIn_2(PA_3);

// ...

Then also make sure your USB to Serial converter is connected to the PA_9 and PA_10 pins.

Best regards, Zoltan

Hi Zoltan, The nucleo-f103rb pin picture and blue pill pin picture different. I think nucleo-f103rb picture should be reference picture. Cause my serial pin already different from pa_2 , pa_3.

posted by abdurrahman uslu 27 Sep 2019