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.
8 years, 8 months ago. This question has been closed. Reason: Off Topic
UART loopback test
Hello,
I'm new to mbed and embedded development and trying to get a simple UART loopback working. I'm using the Nucleo-F411RE and have shorted D0 to D1. My code to simply echo a character on UART is below.
UART Loopback test
#include "mbed.h"
Serial pc(D1, D0);
int main()
{
pc.putc('a');
char ch = pc.getc();
}
The above code will freeze on the pc.getc() statement. When I use offline tools it is blocked on serial_readable(). This appears to be similar to Rafael's issue in https://developer.mbed.org/questions/75851/Serial-loopback-Nucleo-F446RE.
I've also attached an image of how I've setup my loopback in case I've done that improperly. I'd appreciate the help for whatever I've done improperly.
Thanks
--
2/28 edit - Upon further research I found that UART2 is dedicated to USB and not really usable. I moved the code and jumper to UART1 and it worked as expected.