---+ Using a second Serial Port On the ESP32 UART0 is normally reserved for interactive use with REPL. Sometimes we need a !UART to communicate with external devices. Typical examples are: * fingerprint readers using a serial communication protocol * GPS modules The ESP32 has 3 !UARTs of which however UART1 is reserved for use with flash memory. *However UART2 is free.* Connect the USB to Serial adapter to the ESP32 as shown in the table below | USB to Serial Adapter | ESP32 pins | | Rx | GPIO 17 | | Tx | GPIO 16 | | Gnd | Gnd | As a first quick test we can try to write "Hello World to UART2 to which we connect a minicom virtual terminal. _thonny_ is connected to UART0 on /dev/ttvUSB0 (connect this first). <i>minicom </i>is connected to UART2 on /dev/ttyUSB1. Start minicom with: _minicom -D /dev/ttyUSB1_ Here is the screen dump of the REPL session <img alt="uart2.png" height="191" src="%ATTACHURL%/uart2.png" title="uart2.png" width="599" /> And this is what we see on minicom: <img alt="uart2-minicom.png" height="209" src="%ATTACHURL%/uart2-minicom.png" title="uart2-minicom.png" width="559" /> ... if you are too lazy to type, here is the corresponding script: %ATTACHURL%/uart.py.txt -- %USERSIG{UliRaich - 2020-05-09}% ---++ Comments %COMMENT%
Attachments
Attachments
Topic attachments
I
Attachment
History
Action
Size
Date
Who
Comment
txt
uart.py.txt
r1
manage
0.2 K
2020-05-09 - 20:01
UliRaich
png
uart2-minicom.png
r1
manage
23.7 K
2020-05-09 - 19:57
UliRaich
png
uart2.png
r1
manage
23.6 K
2020-05-09 - 19:57
UliRaich
This topic: IoT_Course_English
>
WebHome
>
SerialPorts
Topic revision: r1 - 2020-05-09 - UliRaich
Copyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback