How to Set AT Port Pins
This document introduces how to modify AT port pins in the firmware for ESP32-C2 series of products. By default, ESP-AT uses two UART interfaces as AT ports: one is to output logs (named as log port below) and the other to send AT commands and receive responses (named as command port below).
If you already have the ESP32-C2 AT firmware and only need to modify the command port pins, you can directly modify the firmware using the at.py Tool to generate a new firmware for your module. Otherwise, if you need to modify the AT port pins of your ESP32-C2 device, you need to complete the following steps:
modify the pins either in the menuconfig utility or the factory_param_data.csv table;
compile the project to generate the new bin in
build/customized_partitions/factory_param.bin
;
This document focuses on modifying the pins. Click the links above for details of other steps.
Note
To use other interfaces as the AT command port, please refer to AT through SDIO , AT through SPI , or AT through socket for more details.
ESP32-C2 Series
The log port and command port pins of ESP32-C2 AT firmware can be user-defined to other pins. Refer to ESP32-C2 Technical Reference Manual for the pins you can use.
Modify Log Port Pins
By default, the ESP32-C2 AT firmware provided by Espressif uses the following UART0 pins to output log:
TX: GPIO20
RX: GPIO19
When compiling your ESP-AT project, you can modify them to other pins with the menuconfig utitlity:
./build.py menuconfig
–>Component config
–>ESP System Settings
–>Channel for console output
–>Custom UART
./build.py menuconfig
–>Component config
–>ESP System Settings
–>UART TX on GPIO#
./build.py menuconfig
–>Component config
–>ESP System Settings
–>UART RX on GPIO#
Modify Command Port Pins
By default, UART1 is used to send AT commands and receive AT responses, and its pins are defined in Column uart_port
, uart_tx_pin
, uart_rx_pin
, uart_cts_pin
, and uart_rts_pin
of the factory_param_data.csv .
You can change them directly in your factory_param_data.csv table:
Open your local factory_param_data.csv file.
Locate the row of your module.
Set
uart_port
as needed. (If you want to use the AT log port as the AT command port as well, you need to modify this line, and ensure that theuart_tx_pin
anduart_rx_pin
below have the same pins as the AT log port)Set
uart_tx_pin
anduart_rx_pin
as needed. (Make sure that the pins you are going to modify are not being used by other functions, including the AT log port)Set
uart_cts_pin
anduart_rts_pin
to be -1 if you do not use the hardware flow control function.Save the table.