2020-12-14 03:10 AM
The STM32 IDE project shows some "default" mapping to use in the U[S]ART1-6. For example, UART1 has PA9(TX) and PA10(RX). Are these GPIO pins fixed? Can any be used? Is there any restriction on which pin can be used with which UART block?
In particular, we have an STM32F407.
Thanks,
Marco
Solved! Go to Solution.
2020-12-14 05:48 AM
If you don't want to play pin mapping bingo several months into the project it is probably better to do the due diligence up front, and get the pins assigned to all critical interfaces you're going to need, and then use the available slack GPIO for LEDs, buttons, or things that can be readily reassigned.
2020-12-14 04:12 AM
There are a handful of usuable pins.
There is a pin matrix in the part's Data Sheet, I suggest using that as a guide.
2020-12-14 04:23 AM
> There is a pin matrix in the part's Data Sheet, I suggest using that as a guide.
IMHO the first source to go to.
This is where Cube IDE pulls it from. And adds some Copy&Paste errors occasionally.
2020-12-14 05:07 AM
Thanks all! The issue I have is how do I change what PIN is mapped to what UART using the IDE. I really would like to keep the code as close as possible to that which is generated with the "Generate Code" option. If all pin mapping need redoing manually, every time something changes, those changes will have to be ported. No a big deal, but as the project grows and different people put their hands on it, it becomes messy...
2020-12-14 05:48 AM
If you don't want to play pin mapping bingo several months into the project it is probably better to do the due diligence up front, and get the pins assigned to all critical interfaces you're going to need, and then use the available slack GPIO for LEDs, buttons, or things that can be readily reassigned.
2020-12-14 06:02 AM
Thanks. That is always a good idea, unless it has already been done otherwise by someone else ... I guess the question now is: can you change the "default" the STM32IDE comes up with easily? For example, if you enable UART1 you get automatically PA9 and PA10. How do you select PB6 for UART1(TX), which is possible setting ALT7 to GPIO pin PB6 ... ?
Thanks!!
Marco
2020-12-14 06:09 AM
OK, I do apologize for wasting your time guys .. .I found it. You do not have the choice in the pane where you configure the UART, but you can do that by previously re-assigning the GPIO function in the PIN definition (where you have all the pins shown around the chip). By doing that, now you see the "right" pin appearing when you select UART1.
Thanks all!
Marco