Skip to content

Tasmota changes #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 29 commits into from
Feb 17, 2023
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0ad68df
Tasmota changes
Jason2866 Jan 15, 2023
9079da9
Merge branch 'espressif:master' into Tasmota/207
Jason2866 Jan 27, 2023
abdd82b
Update install-platformio-esp32.sh
Jason2866 Feb 6, 2023
1e1ddc1
Fix conflicts
Jason2866 Feb 6, 2023
519142e
Merge pull request #189 from tasmota/espressif_master
Jason2866 Feb 6, 2023
366d297
Tasmota repos
Jason2866 Feb 6, 2023
1bec616
Merge branch 'Tasmota/207' into espressif_master
Jason2866 Feb 6, 2023
40ebf94
Merge pull request #190 from tasmota/espressif_master
Jason2866 Feb 6, 2023
0695d57
Merge branch 'espressif:master' into Tasmota/207
Jason2866 Feb 6, 2023
8563b31
overlooked `timeout` change to `timeout_ms`
Jason2866 Feb 6, 2023
2768fe7
Merge branch 'espressif:master' into Tasmota/207
Jason2866 Feb 7, 2023
18c0a6c
Update toolchains and openocd for ESP-IDF v4.4.4
me-no-dev Feb 8, 2023
0ee74ee
Update get.py to support Apple ARM64
me-no-dev Feb 8, 2023
e531341
Update package version
me-no-dev Feb 8, 2023
1376ee0
Update ESP-IDF libs to v4.4.4
me-no-dev Feb 8, 2023
5456de7
Merge branch 'espressif:master' into Tasmota/207
Jason2866 Feb 8, 2023
997542c
Fix compilation issue caused by ESP-Insights
me-no-dev Feb 9, 2023
3324aff
Update esptool to v4.4
me-no-dev Feb 9, 2023
664e36e
Merge branch 'espressif:master' into Tasmota/207
Jason2866 Feb 10, 2023
353ce92
Merge branch 'Tasmota/207' into release/v2.x
Jason2866 Feb 10, 2023
7ff5055
Merge pull request #191 from tasmota/release/v2.x
Jason2866 Feb 10, 2023
8a458d1
Update esptool to v4.5
me-no-dev Feb 13, 2023
1ab3a68
Merge branch 'espressif:release/v2.x' into release/v2.x
Jason2866 Feb 13, 2023
cfd008b
Merge branch 'espressif:master' into Tasmota/207
Jason2866 Feb 13, 2023
2ac2764
Merge pull request #194 from tasmota/Tasmota/207
Jason2866 Feb 13, 2023
d2662f2
Sets correct code for UART baud rate detection
Jason2866 Feb 14, 2023
1ca741e
Merge branch 'master' into release/v2.x
me-no-dev Feb 15, 2023
5e27555
Merge branch 'espressif:release/v2.x' into release/v2.x
Jason2866 Feb 15, 2023
a3c4a0e
General examples updates (#7727) (#196)
Jason2866 Feb 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Sets correct code for UART baud rate detection
Co-authored-by: Rodrigo Garcia <[email protected]>
  • Loading branch information
Jason2866 and SuGlider authored Feb 14, 2023
commit d2662f26b74636579081eed7c8dd2713b4b9cca9
26 changes: 13 additions & 13 deletions cores/esp32/esp32-hal-uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,8 @@ void log_print_buf(const uint8_t *b, size_t len){
*/
unsigned long uartBaudrateDetect(uart_t *uart, bool flg)
{
#ifndef CONFIG_IDF_TARGET_ESP32S3
// Baud rate detection only works for ESP32 and ESP32S2
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2
if(uart == NULL) {
return 0;
}
Expand Down Expand Up @@ -679,6 +680,8 @@ void uartStartDetectBaudrate(uart_t *uart) {
//hw->conf0.autobaud_en = 0;
//hw->conf0.autobaud_en = 1;
#elif CONFIG_IDF_TARGET_ESP32S3
log_e("ESP32-S3 baud rate detection is not supported.");
return;
#else
uart_dev_t *hw = UART_LL_GET_HW(uart->num);
hw->auto_baud.glitch_filt = 0x08;
Expand All @@ -694,7 +697,8 @@ uartDetectBaudrate(uart_t *uart)
return 0;
}

#ifndef CONFIG_IDF_TARGET_ESP32C3 // ESP32-C3 requires further testing - Baud rate detection returns wrong values
// Baud rate detection only works for ESP32 and ESP32S2
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2

static bool uartStateDetectingBaudrate = false;

Expand All @@ -707,22 +711,14 @@ uartDetectBaudrate(uart_t *uart)
if (!divisor) {
return 0;
}
// log_i(...) below has been used to check C3 baud rate detection results
//log_i("Divisor = %d\n", divisor);
//log_i("BAUD RATE based on Positive Pulse %d\n", getApbFrequency()/((hw->pospulse.min_cnt + 1)/2));
//log_i("BAUD RATE based on Negative Pulse %d\n", getApbFrequency()/((hw->negpulse.min_cnt + 1)/2));


#ifdef CONFIG_IDF_TARGET_ESP32C3
//hw->conf0.autobaud_en = 0;
#elif CONFIG_IDF_TARGET_ESP32S3
#else
uart_dev_t *hw = UART_LL_GET_HW(uart->num);
hw->auto_baud.en = 0;
#endif

uartStateDetectingBaudrate = false; // Initialize for the next round

unsigned long baudrate = getApbFrequency() / divisor;

//log_i("APB_FREQ = %d\nraw baudrate detected = %d", getApbFrequency(), baudrate);

static const unsigned long default_rates[] = {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 74880, 115200, 230400, 256000, 460800, 921600, 1843200, 3686400};
Expand All @@ -741,7 +737,11 @@ uartDetectBaudrate(uart_t *uart)

return default_rates[i];
#else
#ifdef CONFIG_IDF_TARGET_ESP32C3
log_e("ESP32-C3 baud rate detection is not supported.");
#else
log_e("ESP32-S3 baud rate detection is not supported.");
#endif
return 0;
#endif
}
Expand Down Expand Up @@ -795,4 +795,4 @@ int uart_send_msg_with_break(uint8_t uartNum, uint8_t *msg, size_t msgSize)
{
// 12 bits long BREAK for 8N1
return uart_write_bytes_with_break(uartNum, (const void *)msg, msgSize, 12);
}
}