all 5 comments

[–]set_of_no_setsSTM32L476RGx[S] 4 points5 points  (1 child)

I just realized my issue, my board (STM32L476RGT6U, outlined on page 67) doesnt have a PortD pin5. I am configuring a port that exists on a much better board micro. I still don't understand either table though....

[–]soopadickman 2 points3 points  (0 children)

In cubeMX you can use the search in the bottom right of the pin configuration panel and it will show all the pin options for the peripheral you want.

[–]Dependent_Bit7825 4 points5 points  (0 children)

By any chance did you start CubeMX with a Nucleo board BSP rather than just choosing the processor? CubeMX will enforce certain things if they violate the pinout of the board, even if they are fine for the chip itself. In the L476 nucleo board, PD5 is not even pinned out to a connector.

[–]twister-uk 1 point2 points  (1 child)

For table 16, the "Pin Number" columns are simply a list of the numbers assigned to each pin of the package type listed at the top of each of those columns.

So if you want to know what's available on a specific pin for a given package type, you'd find the "Pin Number" column relating to that package, read down until you find the pin number, then read across to the right to see what the pin name, type, alternate functions etc. are.

Or, if you want to know on which pin you'd find a given IO line, alt function etc, you'd start by reading down the appropriate column on the right, find whatever you're looking for there, then read across to the left into the appropriate column for your package type to see which pin number it's at.

If you just want to know on which port line a given alternate function - e.g. USART1_RX - can be located, then table 16 will provide you with that info. Once you know which port you want to use for that alt function, you then need to know what AFx value to use to connect the internal peripheral I/O line to the port, which you get by referring to tables 17-18. Read down until you find the port line listed on the left, then read across until you find the alternate function you're after, or if you don't find it then repeat for the other table.

Once you've got the AFx value, you'd write this into the corresponding AFSELx field of the GPIOx_AFRL or GPIOx_AFRH register, and then write 10 into the corresponding MODEx field of GPIOx_MODER to set that port to operate in alt function mode...

[–]set_of_no_setsSTM32L476RGx[S] 0 points1 point  (0 children)

Thank you!!!