DevKitC goes to Baud 76923 when starting new serial connection

EierLukas
Posts: 2
Joined: Sun Jun 04, 2017 10:57 am

DevKitC goes to Baud 76923 when starting new serial connection

Postby EierLukas » Sun Jun 04, 2017 12:39 pm

Hi there,

I have an issue with my ESP32 DevKitC. When I connect to serial using the USB port two times, the baud rate suddenly reverts to 76923 from the previous 115200 (or any other rate set, for that matter).

This can be easily reproduced with this code:

Code: Select all

$ cat main.c
#include "esp_log.h"
#include "esp_event.h"

void app_main(void)
{
    while (true) {
        ESP_LOGI("FOO", "BAR");
        vTaskDelay(300 / portTICK_PERIOD_MS);
    }
}
To connect to the serial communication I use miniterm like this:

Code: Select all

$ python -m serial.tools.miniterm  /dev/ttyUSB0 115200
The first connection attempt works as it should

Code: Select all

$ python -m serial.tools.miniterm  /dev/ttyUSB0 115200
--- Miniterm on /dev/ttyUSB0  115200,8,N,1 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
I (1220) FOO: BAR
I (1520) FOO: BAR

--- exit ---
The second attempt does not work anymore

Code: Select all

$ python -m serial.tools.miniterm  /dev/ttyUSB0 115200
--- Miniterm on /dev/ttyUSB0  115200,8,N,1 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
��␃���ln�␀␌bp�l␌�␜�lb��ll␞␀�␒b�␎�␂ln␎l��␂��ln�␀␌bp�l�␜�lb��ll␞␀�␒b�␎�␂ln␎l��␂��ln�␀␌bp��␌�␌lb��ll␞␀�␒b�␎�␂$'␇$��␂��ln�␀␌bp���␌lb��ll␞␀�␒b�␎�␂ln␎l��␂���ln�␀␄#p����␜�$#��$$␟␀�␛#�␇�␃$'␇$��␂���ln�␀␄"p��$�␌$b��l,␞␀�␒b�␆�␂$&␆l��␂���ln�␀␄"p��Č␌,"��l,␞␀�␒#�␇�␂$&␆d��␂��ln�␀␌bp��l�␜�lb��ll␞␀�␒b�␎�␂ln␎l
--- exit ---
Measuring with a logic analyzer I have determined that the Baud rate is not 115200 anymore but rather 76923, which as I presume is the default baudrate for the bootloader. However I cannot detect a reboot (no reboot log messages are sent), the log messages continue as they should except for the wrong baudrate. When setting the baudrate to 79623 in miniterm the log messages arrive correctly:

Code: Select all

$ python -m serial.tools.miniterm  /dev/ttyUSB0 115200
--- Miniterm on /dev/ttyUSB0  115200,8,N,1 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
��␂��ln�␀␌bp���r�␌lb��ll␞␀�␒b�␎�␂ln␎l��␂���$'�␀␄#8����␄,"��l,␞␀�␒b�␇�␂$'␎l
--- Baudrate: ��␂��ln�␀␄"p��p�␌,b��l,␞␀�␒b�␇�␂l'␎l��␂���$'�␀␄#8�쎎␜�lb��ll␞␀�␒b�␎�␂ln␎l7��␂��ln�␀␌bp�쎎␜�lb��ll␞␀�␒b�␎�␂ln␎l69��␂��ln�␀␌bp�␌␌�␌lb��ll␞␀�␒b�␎�␂ln␎l��␂��ln�␀␌bp�␌�␌lb��ll␞␀�␒b�␎�␂ln␎l��␂��ln�␀␌bp�␌��␜�lb��ll␞␀�␒b�␎�␂ln␎l2��␂���$'�␀␄#8�␄$�␄$#��$$␟␀�␛#�␇�␃$'␇$3

--- Settings: /dev/ttyUSB0  76923,8,N,1
--- RTS: active    DTR: active    BREAK: inactive
--- CTS: inactive  DSR: inactive  RI: inactive  CD: inactive
--- software flow control: inactive
--- hardware flow control: inactive
--- serial input encoding: UTF-8
--- serial output encoding: UTF-8
--- EOL: CRLF
--- filters: default
I (109220) FOO: BAR
I (109520) FOO: BAR
I (109820) FOO: BAR
I (110120) FOO: BAR
I (110420) FOO: BAR

--- exit ---
Is this a known issue or can anyone verify this issue?

Best Regards

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: DevKitC goes to Baud 76923 when starting new serial connection

Postby ESP_Angus » Thu Jun 08, 2017 1:39 am

Hi Eier,

Thanks for the detailed report, sorry it's taken a little while to reply.

Unfortunately I'm not able to reproduce this with Linux and the Core Board I have here.

Are you sure the ESP32 is changing its baud rate and not the USB/serial interface (CP2102)? The solution of switching the configured baud rate would work in both cases. Suggesting this because I think I've seen something like that once or twice before (the driver somehow gets confused about the base frequency for setting baud rates).

If you're certain the ESP32 is changing baud rate, that's very unusual - and extra unusual if it happens without a reset.

If you have a logic analyzer, are you able to please capture the pins UART0_TX, UART0_RX, GPIO0, EN at the highest sample rate possible, while the bug triggers, and then provide the capture? Thanks.

EierLukas
Posts: 2
Joined: Sun Jun 04, 2017 10:57 am

Re: DevKitC goes to Baud 76923 when starting new serial connection

Postby EierLukas » Thu Jun 08, 2017 9:01 pm

Hi there,

I have provided a capture as an attachment. I am using salea logic, so I am limited to the formats provided by that software. Can you work with the provided files, or do you need them in another format?

For my testing I am using an ESP32_Core_board_V2. I will try to get a hold of another one, to verify if the problem is only related to this specific unit.

The change in the Baudrate might be induced by the cp2102, I am not completely sure about that.

I can see a very short low on EN (1.333 µs), which might reset the UART controller, however not the rest of the chip. Could that be possible?

Shall I provide a video, to better show the timeline of events leading to my problem?

Best Regards
Attachments
baud_reset.zip
(14.52 KiB) Downloaded 509 times

Who is online

Users browsing this forum: No registered users and 20 guests