Skip to main content
lekanteto
Associate
December 4, 2014
Question

Pin versus port in STM32Cube example

  • December 4, 2014
  • 2 replies
  • 725 views
Posted on December 04, 2014 at 01:32

I changed the pins in the UART_TwoBoards_ComPolling example for the Nucleo STM32L152RE board.

It did not work until i also changed the port. Is there a fixed connection between pin and port? How do I know which pin belongs to which port?

#define USARTx_TX_PIN GPIO_PIN_6
#define USARTx_TX_GPIO_PORT GPIOB

#define USARTx_TX_PIN GPIO_PIN_9
#define USARTx_TX_GPIO_PORT GPIOA

    This topic has been closed for replies.

    2 replies

    Tesla DeLorean
    Guru
    December 4, 2014
    Posted on December 04, 2014 at 03:15

    How do I know which pin belongs to which port?

    Well there's a data sheet that associates all the pins with all the peripherals, perhaps that would be a good place to start?

    http://www.st.com/web/en/catalog/mmc/SC1169/SS1295/LN962/PF259539

    http://www.st.com/st-web-ui/static/active/en/resource/technical/document/datasheet/DM00098321.pdf

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    lekanteto
    lekantetoAuthor
    Associate
    December 4, 2014
    Posted on December 04, 2014 at 14:11

    Thanks for your anwer. I had already looked at that document.

    Now that I have thought some more about it I figured out that the second letter of the pin name equals the port name.

    e.g. pin name PB6 means pin 6 and port B.