Enrico Marinoni
/
NucleoL152RE_and_USART2
How to use USART2 on NUCLEO-L152RE and Mbed
main.cpp
- Committer:
- emcu
- Date:
- 2014-05-02
- Revision:
- 2:1b5f5a433ae8
- Parent:
- 1:e9d1c42a73ae
File content as of revision 2:1b5f5a433ae8:
// Bye www.emcu.it // Tested on NUCLEO_L152RE // for more info see here: http://www.emcu.it/NUCLEOevaBoards/U2andL152/U2andL152.html#How_to_use_USART2 // // This program send a character via USART2 and via USB (Virtual Com) // USART2 is connected to STLINK that send data via USB. // ATTENTION: // For connect USART2 to D1/TX and D0/RX it is necessary do a bridge on SB63 and SB62 that are on the rear of NUCLEO_L152RE board. // I suggest to use TeraTerm to connect the NUCLEO via CN1 (USB) // Configure TeraTerm with these parameters: // Baud: 9600 - Data: 8bit - Parity: None - Stop: 1bit - Flow Control: None #include "mbed.h" Serial pc(SERIAL_TX, SERIAL_RX); // tx, rx USB Virtual COM int main() { while(1) { if(pc.readable()) { pc.putc(pc.getc()); } wait(0.1); pc.printf("E"); } }