UART clock source
Posted: Thu Apr 30, 2020 1:28 pm
Hello.
ESP32 communicate with host over UART0 using custom binary protocol with CRC validation.
If I use 200K baudrate, the link is ok. When I increase baud to 1M baud communication is still works, but it is very unstable, very often i get message "CRC invalid". When I sniff data exchange, I saw that sometimes ESP32 receive 0x28 instead 0x14.
Here is code for UART initialization:
That interesting that if I change use_ref_tick to false communication work without any error.
ESP-IDF: v4.0-rc-10-g08219f3cf
power manager configuration:
pm_esp32: Frequency switching config: CPU_MAX: 80, APB_MAX: 80, APB_MIN: 80, Light sleep: DISABLED
What the difference beetween UART clocking from REF_TICK and APB?
I need to use dynamic frequence changing so I should use REF_TICK as clock source, but UART doesn`t properly work with 1M baud and REF_TICK source. What I need to do for make it works?
Hope for help. Thanks in advance!
ESP32 communicate with host over UART0 using custom binary protocol with CRC validation.
If I use 200K baudrate, the link is ok. When I increase baud to 1M baud communication is still works, but it is very unstable, very often i get message "CRC invalid". When I sniff data exchange, I saw that sometimes ESP32 receive 0x28 instead 0x14.
Here is code for UART initialization:
Code: Select all
uart_config_t uart_config = {.baud_rate = COMM_UART_BAUDRATE,
.data_bits = UART_DATA_8_BITS,
.parity = UART_PARITY_DISABLE,
.stop_bits = UART_STOP_BITS_1,
.flow_ctrl = UART_HW_FLOWCTRL_RTS,
.rx_flow_ctrl_thresh = 100,
.use_ref_tick = true};
// Configure UART
uart_param_config(COMM_UART, &uart_config);
uart_set_pin(COMM_UART, COMM_UART_TX_PIN, COMM_UART_RX_PIN, COMM_UART_RTS_PIN, COMM_UART_CTS_PIN);
uart_driver_install(COMM_UART, COMM_UART_DRV_RX_BUFF, 0, COMM_UART_RX_EVENT_QUEUE, &eventQueue, 0);
ESP-IDF: v4.0-rc-10-g08219f3cf
power manager configuration:
pm_esp32: Frequency switching config: CPU_MAX: 80, APB_MAX: 80, APB_MIN: 80, Light sleep: DISABLED
What the difference beetween UART clocking from REF_TICK and APB?
I need to use dynamic frequence changing so I should use REF_TICK as clock source, but UART doesn`t properly work with 1M baud and REF_TICK source. What I need to do for make it works?
Hope for help. Thanks in advance!