mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
feat(esp_modbus): examples add support of esp32c5 target
This commit is contained in:
parent
f477682938
commit
2fa78094ef
@ -172,12 +172,14 @@ examples/protocols/l2tap:
|
|||||||
examples/protocols/modbus:
|
examples/protocols/modbus:
|
||||||
<<: *default_dependencies
|
<<: *default_dependencies
|
||||||
disable:
|
disable:
|
||||||
- if: IDF_TARGET in ["esp32c5", "esp32c61"]
|
- if: IDF_TARGET in ["esp32c61"]
|
||||||
temporary: true
|
temporary: true
|
||||||
reason: not supported yet # TODO: [ESP32C5] IDF-8697, [ESP32C61] IDF-9298
|
reason: not supported yet [ESP32C61] IDF-9298
|
||||||
depends_filepatterns:
|
depends_filepatterns:
|
||||||
|
- examples/common_components/protocol_examples_common/**/*
|
||||||
- examples/protocols/modbus/mb_example_common/**/*
|
- examples/protocols/modbus/mb_example_common/**/*
|
||||||
|
|
||||||
|
|
||||||
examples/protocols/mqtt:
|
examples/protocols/mqtt:
|
||||||
<<: *default_dependencies
|
<<: *default_dependencies
|
||||||
disable:
|
disable:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
|
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
|
||||||
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
|
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
|
||||||
|
|
||||||
# Modbus Master Example
|
# Modbus Master Example
|
||||||
|
|
||||||
@ -96,8 +96,8 @@ Define the communication mode parameter for master and slave in Kconfig - CONFIG
|
|||||||
Configure the slave address for each slave in the Modbus segment (the CONFIG_MB_SLAVE_ADDR in Kconfig).
|
Configure the slave address for each slave in the Modbus segment (the CONFIG_MB_SLAVE_ADDR in Kconfig).
|
||||||
```
|
```
|
||||||
------------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------------
|
||||||
| UART Interface | #define | Default pins for | Default pins for | External RS485 Driver Pin |
|
| UART Interface | #define | Default pins for | Default pins for ESP32-S2 | External RS485 Driver Pin |
|
||||||
| | | ESP32 (C6) | ESP32-S2 (S3, C3, C2, H2) | |
|
| | | ESP32 (C6, P4) | (S3, C3, C2, C5, H2) | |
|
||||||
| ----------------------|--------------------|-----------------------|---------------------------|---------------------------|
|
| ----------------------|--------------------|-----------------------|---------------------------|---------------------------|
|
||||||
| Transmit Data (TxD) | CONFIG_MB_UART_TXD | GPIO23 | GPIO9 | DI |
|
| Transmit Data (TxD) | CONFIG_MB_UART_TXD | GPIO23 | GPIO9 | DI |
|
||||||
| Receive Data (RxD) | CONFIG_MB_UART_RXD | GPIO22 | GPIO8 | RO |
|
| Receive Data (RxD) | CONFIG_MB_UART_RXD | GPIO22 | GPIO8 | RO |
|
||||||
|
@ -5,12 +5,12 @@ menu "Modbus Example Configuration"
|
|||||||
config MB_UART_PORT_ONE
|
config MB_UART_PORT_ONE
|
||||||
bool
|
bool
|
||||||
default y
|
default y
|
||||||
depends on (ESP_CONSOLE_UART_NUM !=1) && (SOC_UART_NUM > 1)
|
depends on (ESP_CONSOLE_UART_NUM !=1) && (SOC_UART_HP_NUM > 1)
|
||||||
|
|
||||||
config MB_UART_PORT_TWO
|
config MB_UART_PORT_TWO
|
||||||
bool
|
bool
|
||||||
default y
|
default y
|
||||||
depends on (ESP_CONSOLE_UART_NUM !=2) && (SOC_UART_NUM > 2)
|
depends on (ESP_CONSOLE_UART_NUM !=2) && (SOC_UART_HP_NUM > 2)
|
||||||
|
|
||||||
config MB_UART_PORT_NUM
|
config MB_UART_PORT_NUM
|
||||||
int "UART port number"
|
int "UART port number"
|
||||||
@ -33,7 +33,7 @@ menu "Modbus Example Configuration"
|
|||||||
range ENV_GPIO_RANGE_MIN ENV_GPIO_IN_RANGE_MAX
|
range ENV_GPIO_RANGE_MIN ENV_GPIO_IN_RANGE_MAX
|
||||||
default 22 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32C6 || IDF_TARGET_ESP32P4
|
default 22 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32C6 || IDF_TARGET_ESP32P4
|
||||||
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 || IDF_TARGET_ESP32H2
|
IDF_TARGET_ESP32C2 || IDF_TARGET_ESP32H2 || IDF_TARGET_ESP32C5
|
||||||
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.
|
||||||
@ -43,7 +43,7 @@ menu "Modbus Example Configuration"
|
|||||||
range ENV_GPIO_RANGE_MIN ENV_GPIO_OUT_RANGE_MAX
|
range ENV_GPIO_RANGE_MIN ENV_GPIO_OUT_RANGE_MAX
|
||||||
default 23 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32C6 || IDF_TARGET_ESP32P4
|
default 23 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32C6 || IDF_TARGET_ESP32P4
|
||||||
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 || IDF_TARGET_ESP32H2
|
IDF_TARGET_ESP32C2 || IDF_TARGET_ESP32H2 || IDF_TARGET_ESP32C5
|
||||||
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.
|
||||||
@ -54,7 +54,7 @@ menu "Modbus Example Configuration"
|
|||||||
default 20 if IDF_TARGET_ESP32P4
|
default 20 if IDF_TARGET_ESP32P4
|
||||||
default 18 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32C6
|
default 18 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32C6
|
||||||
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 || IDF_TARGET_ESP32H2
|
IDF_TARGET_ESP32C2 || IDF_TARGET_ESP32H2 || IDF_TARGET_ESP32C5
|
||||||
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.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
|
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
|
||||||
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
|
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
|
||||||
|
|
||||||
# Modbus Slave Example
|
# Modbus Slave Example
|
||||||
|
|
||||||
@ -46,8 +46,8 @@ Select Modbus Example Configuration menu item.
|
|||||||
Configure the UART pins used for modbus communication using the command and table below.
|
Configure the UART pins used for modbus communication using the command and table below.
|
||||||
```
|
```
|
||||||
------------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------------
|
||||||
| UART Interface | #define | Default pins for | Default pins for | External RS485 Driver Pin |
|
| UART Interface | #define | Default pins for | Default pins for ESP32-S2 | External RS485 Driver Pin |
|
||||||
| | | ESP32 (C6) | ESP32-S2 (S3, C3, C2, H2) | |
|
| | | ESP32 (C6, P4) | (S3, C3, C2, C5, H2) | |
|
||||||
| ----------------------|--------------------|-----------------------|---------------------------|---------------------------|
|
| ----------------------|--------------------|-----------------------|---------------------------|---------------------------|
|
||||||
| Transmit Data (TxD) | CONFIG_MB_UART_TXD | GPIO23 | GPIO9 | DI |
|
| Transmit Data (TxD) | CONFIG_MB_UART_TXD | GPIO23 | GPIO9 | DI |
|
||||||
| Receive Data (RxD) | CONFIG_MB_UART_RXD | GPIO22 | GPIO8 | RO |
|
| Receive Data (RxD) | CONFIG_MB_UART_RXD | GPIO22 | GPIO8 | RO |
|
||||||
|
@ -5,12 +5,12 @@ menu "Modbus Example Configuration"
|
|||||||
config MB_UART_PORT_ONE
|
config MB_UART_PORT_ONE
|
||||||
bool
|
bool
|
||||||
default y
|
default y
|
||||||
depends on (ESP_CONSOLE_UART_NUM !=1) && (SOC_UART_NUM > 1)
|
depends on (ESP_CONSOLE_UART_NUM !=1) && (SOC_UART_HP_NUM > 1)
|
||||||
|
|
||||||
config MB_UART_PORT_TWO
|
config MB_UART_PORT_TWO
|
||||||
bool
|
bool
|
||||||
default y
|
default y
|
||||||
depends on (ESP_CONSOLE_UART_NUM !=2) && (SOC_UART_NUM > 2)
|
depends on (ESP_CONSOLE_UART_NUM !=2) && (SOC_UART_HP_NUM > 2)
|
||||||
|
|
||||||
config MB_UART_PORT_NUM
|
config MB_UART_PORT_NUM
|
||||||
int "UART port number"
|
int "UART port number"
|
||||||
@ -33,7 +33,7 @@ menu "Modbus Example Configuration"
|
|||||||
range ENV_GPIO_RANGE_MIN ENV_GPIO_IN_RANGE_MAX
|
range ENV_GPIO_RANGE_MIN ENV_GPIO_IN_RANGE_MAX
|
||||||
default 22 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32C6 || IDF_TARGET_ESP32P4
|
default 22 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32C6 || IDF_TARGET_ESP32P4
|
||||||
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 || IDF_TARGET_ESP32H2
|
IDF_TARGET_ESP32C2 || IDF_TARGET_ESP32H2 || IDF_TARGET_ESP32C5
|
||||||
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.
|
||||||
@ -43,7 +43,7 @@ menu "Modbus Example Configuration"
|
|||||||
range ENV_GPIO_RANGE_MIN ENV_GPIO_OUT_RANGE_MAX
|
range ENV_GPIO_RANGE_MIN ENV_GPIO_OUT_RANGE_MAX
|
||||||
default 23 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32C6 || IDF_TARGET_ESP32P4
|
default 23 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32C6 || IDF_TARGET_ESP32P4
|
||||||
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 || IDF_TARGET_ESP32H2
|
IDF_TARGET_ESP32C2 || IDF_TARGET_ESP32H2 || IDF_TARGET_ESP32C5
|
||||||
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.
|
||||||
@ -54,7 +54,7 @@ menu "Modbus Example Configuration"
|
|||||||
default 20 if IDF_TARGET_ESP32P4
|
default 20 if IDF_TARGET_ESP32P4
|
||||||
default 18 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32C6
|
default 18 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32C6
|
||||||
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 || IDF_TARGET_ESP32H2
|
IDF_TARGET_ESP32C2 || IDF_TARGET_ESP32H2 || IDF_TARGET_ESP32C5
|
||||||
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.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
|
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
|
||||||
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
|
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
|
||||||
|
|
||||||
# Modbus TCP Master Example
|
# Modbus TCP Master Example
|
||||||
|
|
||||||
|
@ -397,7 +397,7 @@ static int master_create_slave_list(mdns_result_t* results, char** addr_table,
|
|||||||
cid_resolve_cnt++;
|
cid_resolve_cnt++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ESP_LOGI(TAG, "Resolved %d cids, with %d IP addresses", cid_resolve_cnt, ip_index);
|
ESP_LOGI(TAG, "Resolved %d cids, with %d address(es)", cid_resolve_cnt, ip_index);
|
||||||
return cid_resolve_cnt;
|
return cid_resolve_cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -659,7 +659,7 @@ static esp_err_t init_services(mb_tcp_addr_type_t ip_addr_type)
|
|||||||
#elif CONFIG_MB_SLAVE_IP_FROM_STDIN
|
#elif CONFIG_MB_SLAVE_IP_FROM_STDIN
|
||||||
int ip_cnt = master_get_slave_ip_stdin(slave_ip_address_table);
|
int ip_cnt = master_get_slave_ip_stdin(slave_ip_address_table);
|
||||||
if (ip_cnt) {
|
if (ip_cnt) {
|
||||||
ESP_LOGI(TAG, "Configured %d IP addresse(s).", ip_cnt);
|
ESP_LOGI(TAG, "Configured %d IP address(es).", ip_cnt);
|
||||||
} else {
|
} else {
|
||||||
ESP_LOGE(TAG, "Fail to get IP address from stdin. Continue.");
|
ESP_LOGE(TAG, "Fail to get IP address from stdin. Continue.");
|
||||||
return ESP_ERR_NOT_FOUND;
|
return ESP_ERR_NOT_FOUND;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
|
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
|
||||||
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
|
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
|
||||||
|
|
||||||
# Modbus Slave Example
|
# Modbus Slave Example
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user