fix for esp32c2 support

This commit is contained in:
aleks
2022-05-13 15:39:53 +02:00
parent 31ea52cf17
commit 0ad0030073
3 changed files with 12 additions and 13 deletions

View File

@@ -37,9 +37,8 @@
#include "driver/uart.h" #include "driver/uart.h"
#include "port.h" #include "port.h"
#include "driver/uart.h" #include "driver/uart.h"
#include "hal/uart_types.h"
#include "freertos/queue.h" // for queue support #include "freertos/queue.h" // for queue support
#include "soc/uart_periph.h"
#include "driver/gpio.h"
#include "esp_log.h" // for esp_log #include "esp_log.h" // for esp_log
#include "esp_err.h" // for ESP_ERROR_CHECK macro #include "esp_err.h" // for ESP_ERROR_CHECK macro

View File

@@ -35,11 +35,11 @@
*/ */
#include <string.h> #include <string.h>
#include "driver/uart.h"
#include "soc/dport_access.h"
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/task.h" #include "freertos/task.h"
#include "freertos/queue.h" #include "freertos/queue.h"
#include "driver/uart.h"
#include "hal/uart_types.h"
#include "esp_log.h" #include "esp_log.h"
#include "sdkconfig.h" #include "sdkconfig.h"
@@ -290,7 +290,7 @@ BOOL xMBMasterPortSerialInit( UCHAR ucPORT, ULONG ulBaudRate, UCHAR ucDataBits,
.stop_bits = UART_STOP_BITS_1, .stop_bits = UART_STOP_BITS_1,
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE, .flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
.rx_flow_ctrl_thresh = 2, .rx_flow_ctrl_thresh = 2,
.source_clk = UART_SCLK_APB, .source_clk = UART_SCLK_APB
}; };
// Set UART config // Set UART config
xErr = uart_param_config(ucUartNumber, &xUartConfig); xErr = uart_param_config(ucUartNumber, &xUartConfig);

View File

@@ -4,8 +4,8 @@ menu "Modbus Example Configuration"
int "UART port number" int "UART port number"
range 0 2 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32S3 range 0 2 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32S3
default 2 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32S3 default 2 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32S3
range 0 1 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3 range 0 1 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32C2
default 1 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3 default 1 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32C2
help help
UART communication port number for Modbus example. UART communication port number for Modbus example.
@@ -22,8 +22,8 @@ menu "Modbus Example Configuration"
default 22 if IDF_TARGET_ESP32 default 22 if IDF_TARGET_ESP32
range 0 46 if IDF_TARGET_ESP32S2 range 0 46 if IDF_TARGET_ESP32S2
range 0 47 if IDF_TARGET_ESP32S3 range 0 47 if IDF_TARGET_ESP32S3
range 0 19 if IDF_TARGET_ESP32C3 range 0 19 if IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32C2
default 8 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32C3 default 8 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32C2
help help
GPIO number for UART RX pin. See UART documentation for more information GPIO number for UART RX pin. See UART documentation for more information
about available pin numbers for UART. about available pin numbers for UART.
@@ -34,8 +34,8 @@ menu "Modbus Example Configuration"
default 23 if IDF_TARGET_ESP32 default 23 if IDF_TARGET_ESP32
range 0 46 if IDF_TARGET_ESP32S2 range 0 46 if IDF_TARGET_ESP32S2
range 0 47 if IDF_TARGET_ESP32S3 range 0 47 if IDF_TARGET_ESP32S3
range 0 19 if IDF_TARGET_ESP32C3 range 0 19 if IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32C2
default 9 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32C3 default 9 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32C2
help help
GPIO number for UART TX pin. See UART documentation for more information GPIO number for UART TX pin. See UART documentation for more information
about available pin numbers for UART. about available pin numbers for UART.
@@ -46,8 +46,8 @@ menu "Modbus Example Configuration"
default 18 if IDF_TARGET_ESP32 default 18 if IDF_TARGET_ESP32
range 0 46 if IDF_TARGET_ESP32S2 range 0 46 if IDF_TARGET_ESP32S2
range 0 47 if IDF_TARGET_ESP32S3 range 0 47 if IDF_TARGET_ESP32S3
range 0 19 if IDF_TARGET_ESP32C3 range 0 19 if IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32C2
default 10 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32C3 default 10 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32C2
help help
GPIO number for UART RTS pin. This pin is connected to GPIO number for UART RTS pin. This pin is connected to
~RE/DE pin of RS485 transceiver to switch direction. ~RE/DE pin of RS485 transceiver to switch direction.