UART baud rate >460800 leads to partial garbage

rosenrot
Posts: 25
Joined: Wed Jan 01, 2020 9:28 pm

Re: UART baud rate >460800 leads to partial garbage

Postby rosenrot » Tue Jun 16, 2020 10:16 pm

I think I found it. I use the hello_world example.

Any help is welcome.

Issue:

Code: Select all

#
# Power Management
#
CONFIG_PM_ENABLE=y
# CONFIG_PM_DFS_INIT_AUTO is not set
# CONFIG_PM_PROFILING is not set
# CONFIG_PM_TRACE is not set
# end of Power Management
No issue:

Code: Select all

#
# Power Management
#
# CONFIG_PM_ENABLE is not set
# end of Power Management
A side question: Which settings can't be updated via OTA? Only the menuconfig settings inside the "bootloader" menu? The reason why I'm asking is that I need the power management option to set the cpu frequency programmatically. However, only enabling this option in the menuconfig seems to have a negativ impact on the CPU timing. Thus, it would be nice if I could deactive the power management and set a different CPU frequency via an OTA. Is that possible?

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

Re: UART baud rate >460800 leads to partial garbage

Postby ESP_Angus » Tue Jun 16, 2020 11:53 pm

Thanks for the extra information. This makes sense now.

When PM is enabled the UART is switched to the REFTICK clock source not the APB clock source, because the REFTICK clock source can maintain the same frequency when changing the CPU & APB clock speeds at runtime.

The REFTICK clock is set at 1MHz, so dividing it to 921600bps is probably not possible and 2000000 is definitely not possible.

It may be possible to set the console baud rate to exactly 1Mbps and have this work (I haven't tried this yet).

This is still a bug in ESP-IDF, the available UART console configuration settings should have been limited when PM was enabled. Will fix the config settings, but this still won't allow higher baud rates when PM is on.
Which settings can't be updated via OTA? Only the menuconfig settings inside the "bootloader" menu? The reason why I'm asking is that I need the power management option to set the cpu frequency programmatically. However, only enabling this option in the menuconfig seems to have a negativ impact on the CPU timing. Thus, it would be nice if I could deactive the power management and set a different CPU frequency via an OTA. Is that possible?
In general the bootloader and some of the other top-level menus (like Security, Partition Table and some of the Serial Flasher Settings). there are a few outliers which are also compiled into the bootloader but they won't cause failure to boot - the UART console baud rate is an example, if this is changed and the app is OTA updated then the bootloader still has the old value, but the app has the new value.

Power Management is entirely part of the app, you should be able to change any PM settings and OTA update a new app without any restrictions.

mikemoy
Posts: 627
Joined: Fri Jan 12, 2018 9:10 pm

Re: UART baud rate >460800 leads to partial garbage

Postby mikemoy » Wed Jun 17, 2020 12:47 am

I am glad the solution was found. But next time you might want to mention that you messed with menuconfig.
It helps others to know that you were not running stock.

boborjan
Posts: 9
Joined: Thu Sep 19, 2019 5:46 pm

Re: UART baud rate >460800 leads to partial garbage

Postby boborjan » Thu May 13, 2021 10:31 am

I have a very similar issue but without CONFIG_PM set. Baudrates 460800 and 921600 work just fine until the device first goes to light sleep. I can program the flash, see the printouts, everything is OK. After the device enters light sleep (and comes back), I see garbage. The very same setup works without issues on 230400 and below. Does the uart config change from APB clock to REFTICK during light sleep? If so, how can I change it back?

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot] and 273 guests