Skip to content

[T CODE 0] UART

yudada31 edited this page Apr 8, 2019 · 3 revisions

Uart

This is a very simple tutorial that shows how to setup UART.

Objective:

The main objective to setup a universal asynchronous receiver-transmitter (UART) is to print some variables and helps us to debug.

Requirements:

  • A stm32.
  • A computer.

Steps:

Modify your code

Simply declare: Serial pc(SERIAL_TX, SERIAL_RX, 115200); as a global variable.

And whenever you want to print something in your code: pc.printf("Put your output here");.

This works like a basic printf in C.

### Get the output First, connect your stm32 and type mbed detect to get the port that your stm32 is connected to. It should look like /dev/ttyACM0.

Then, on a new terminal type screen <your port> 115200 and you should see the output of your code.

Clone this wiki locally