uart_echo example

TheoSh
Posts: 5
Joined: Sun Aug 01, 2021 3:09 am

uart_echo example

Postby TheoSh » Sun Aug 01, 2021 7:12 am

Hello! Could you help me with uart_echo example? I need setup interaction between my pc (ubuntu) with esp32. I used example from esp-idf with these variables:
```
CONFIG_EXAMPLE_UART_PORT_NUM=0
CONFIG_EXAMPLE_UART_BAUD_RATE=115200
CONFIG_EXAMPLE_UART_RXD=3
CONFIG_EXAMPLE_UART_TXD=1
CONFIG_EXAMPLE_TASK_STACK_SIZE=2048
```
I tried it with this simple python app:
```
import serial;

ser = serial.Serial('/dev/ttyUSB0',115200, timeout=3, writeTimeout=3)
data = b"test\n"
error = ser.write(data)
data = ser.readline()
print(data)
ser.close()
```
It works but very unstable. First 1-3 it responses correctly, but then it freezes and it seems like esp32 reboots. How can I solve it? Thx!

TheoSh
Posts: 5
Joined: Sun Aug 01, 2021 3:09 am

Re: uart_echo example

Postby TheoSh » Fri Aug 06, 2021 6:44 am

It seems like uart0 is reserved for logging and download according to https://docs.espressif.com/projects/esp ... ction.html
So, I need additional UART-to-USB converter to stable send/receive commands.

ESP_Sprite
Posts: 8926
Joined: Thu Nov 26, 2015 4:08 am

Re: uart_echo example

Postby ESP_Sprite » Sat Aug 07, 2021 2:07 am

You could also disable logging, or remap the UART0 port to different pins and map UART1 to the pins the USB-to-serial converter is mapped to. That would mean you would still see some startup chatter, but as soon as your app is properly running, it should have the serial channel to itself.

TheoSh
Posts: 5
Joined: Sun Aug 01, 2021 3:09 am

Re: uart_echo example

Postby TheoSh » Sun Sep 05, 2021 4:21 am

Thx a lot, it worked!

Who is online

Users browsing this forum: No registered users and 129 guests