STM32F103C What GPIO Port is PA,PB,PC

Hi Everybody.

I would like to know what GPIO Port PA,PB and PC is connected to on the STM32F103C.

I did do a lot of searching and also the RM0008 Ref Manual did not help.

Pin diagrams does not show the PORTS.

Thanks for any help.

That would be in the data sheet. Or, are you referring to some specific board pinouts such as on the Blue Pill? If so you need to tell us which board you have. There are literally hundreds of different F103 boards.

Yes the Blue Pill.

The datasheet refers to GPIOx so the x can be A,B,C,D .

Does this help in combination with the datasheet?

Usually the portpins ( PA1, PA2 .... ) are printed on the blue pill board. Can You post a picture of your board? Or am I misunderstanding your question?

1 Like

The drawing is to small to read but I will search for a drawing .. Thanks.

Yes the pins is marked on the Blue Pill.
But what I want to know is.

PAx pins is connected to GPIOA

PBx pins is connected to GPIOB

PCx pins is connected to GPIOC .. ?

Click on it.

a7

PA0 is connected to GPIOA Bit 0
PA1 is connected to GPIOA Bit 1
....
....
It's straight forward, but this can also be remapped to other peripherals. That's documented in RM008

OK..Is PB0 then connected to GPIOB Bit 0

and

PC13 connected tp GPIOC Bit 13 ?

What page number?

Yes of course - its straight forward, nothing special with it.

The remapping to alternate functions is spread throughout the document. Mainly where the peripherals are describd, but there are also tables.

If you get the chip "datasheet" ( https://www.st.com/resource/en/datasheet/stm32f103c8.pdf )(aka DocID13587), "Table 5" has a summary of the alternate functions for each pin. (no useful data on how to USE anything, though...)

If you are going to use an Arduino core (there are maybe 3, one of which is supported by STM) to develop software for the Bluepill, you may also find a diagram such as this to be useful:

There is also a forum which is more focussed on the STM microcontrollers such as the Bluepill (STM32F103C8T6) here : https://www.stm32duino.com/

Yes found it.Test with LEDS on pins.

void setup()
{
  pinMode(PA0, OUTPUT);
  pinMode(PB0, OUTPUT);
  pinMode(PC13, OUTPUT);
}

void loop()
{
  GPIOA->ODR |= 1 << 0;//Write to Output Data Register
  delay(100);
  GPIOA->ODR &= ~(1 << 0);
  delay(100);

  GPIOB->ODR |= 1 << 0;
  delay(100);
  GPIOB->ODR &= ~(1 << 0);
  delay(100);

  GPIOC->ODR |= 1 << 13;
  delay(100);
  GPIOC->ODR &= ~(1 << 13);
  delay(100);
}
void setup() {

    pinMode(PC13, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(PC13, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(PC13, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}

This does not say that PC is GPIOC.

This confirms that PC is GPIOC.

GPIOC->ODR |= 1 << 13;

On a Nano with the Pins A0 - A7 .
PORTA = 0X00; Gives a error.
but
PORTB = 0X00; Does compile .So a Nano does not have a PORTA.

The pin numbering scheme of a nano is completely different to that of the blue pill. A0 to A7 refer to analog inputs. The pin numbering doesn't include any named reference to port numbers of the processor - opposed to the PA0 .... PC13 pin numbering of the blue pill.

That's true, there are only Ports B...D

look post #12
on stm32 add P
Pins PA0 - PA7