Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years, 10 months ago.
Is there a function to remap UART1 (STM32F103)
I need to remap the UART1 ports on an STM32F103CB, is there a function in mbed to do this? i use the CLI and SW4STM32 project not the online compiler. Thanks
1 Answer
6 years, 10 months ago.
Hello Hoel,
If you would like to use UART1 via the "remap" alternate pins (PB_6, PB_7) rather than over the "default" alternate pins (PA_9, PA_10) (see Table 5 - 'Pin definitions' in the Datasheet) then a definition like
Serial uart1(PB_6, PB_7);
will do the job.
NOTE: I'm afraid that it's impossible to map UART1 to any other alternate pins except those indicated in the datasheet.
Thank you, i was looking to use remap alternate anyway (PB6 PB7), glad to see it does the job automatically by specifying only the ports. I have now a subsidiary question since i found cannot use the remap alternate of UART1, i need to use UART3 on it default ports (PB10 PB11) the question is: what will append when i set my serial port with PB10 and PB11, will mbed recognize them as UART3 or will it make a softserial?
posted by 08 Jan 2018If you define a Serial
object like:
Serial uart(PB_10, PB_11);
then mbed will map UART3's TX to PB_10 and RX to PB_11. So you can use it as a fully-fledged UART.
posted by 08 Jan 2018Thank you for the confirmation, i tried Serial uart(PB_10, PB_11); unfortunately it locks up when reaching printf or puts, the USB CDC port is working fine, i have yet to investigate why UART3 locks up.
EDIT: it works when i export a test project from CLI, so the problem was with the MBED-DEV of the test project, all fine
posted by 09 Jan 2018