Closed DreamSilverFox closed 1 year ago
This problem also in esp-idf 4.X(But in 3.x "source_clk" not be set).
@DreamSilverFox ,
Thank you for your issue. Please note that the esp-modbus component is actually suppots esp-idf v4.1 - v5.1 and the esp32c2 support is not merged yet. However, the code can be simply modified right as you suggested above and you can use the the clock option of UART_SCLK_DEFAULT
.
I suggest to use the macro to check the IDF version as below:
port/portserial_m.c:
uart_config_t xUartConfig = {
.baud_rate = ulBaudRate,
.data_bits = ucData,
.parity = ucParity,
.stop_bits = UART_STOP_BITS_1,
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
.rx_flow_ctrl_thresh = 2,
#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0))
.source_clk = UART_SCLK_DEFAULT,
#else
.source_clk = UART_SCLK_APB
#endif
};
It is also required to change the file main/Kconfig.projbuild. Some tricks are also possible to compile the modbus under v3.3, but this is not recommended as obsolete. Please let me know some specific information about your project if you need more help.
This issue is taken into account to add support for other chips.
Thank you.
Merged in commit aca48fa7. The issue will be closed.
esp32-c2 haven't UART_SCLK_APB.
In ESP32:
In ESP32-C2:
Can use UART_SCLK_DEFAULT inside of it?