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.
9 years, 11 months ago.
Have any UART example code for UART3
Hi All,
I need example code for UART3 ie PTC16 & PTC17 pins. Could you please share the link for the same. I've seen some default example code, 'Serial pc(USBTX, USBRX);"
Where is that USBTX and RX pins ? Is that virtual port used through USB (J26) which used while programming ?
I need some code for real UART hardware that I need to use RFID interfacing.
Please share if we have any code for RFID interfacing too.
Regards, Titus S.
2 Answers
9 years, 11 months ago.
USBTX and USBRX are pins connected to the interface IC, and is indeed used for the virtual com port you get when using the USB SDA connector.
But did you check: http://developer.mbed.org/handbook/Serial ? It you want to use PTC16 and PTC17 simply do:
Serial rfid(PTC17, PTC16); //TX first, then RX
9 years, 11 months ago.
It's as simple as Serial myUart(PTC16,PTC17);
(or maybe the other way around depending on which of those is transmit)
Yes USBTX and USBRX are the virtual port used for programming, that port is also the default location for stdio and stderr. The names are a little misleading since USBTX and USBRX are aliases for a normal UART and have nothing to do with the CPUs internal USB device.
P.S. in the future it would help if you said which of the 40+ mbed boards you were using ;-)