ESP-AT 用户指南 Choose target... Choose version... 入门 AT Binary 列表 AT 命令集 AT 命令示例 AT 版本简介 编译和开发 第三方开放云平台定制化 AT FAQ 缩写词索引 特别声明 关于 ESP-AT ESP-AT 用户指南 ESP-AT 用户指南 在 GitHub 上编辑 ESP-AT 用户指南 [English] 这里是乐鑫 ESP-AT 开发框架的文档中心。ESP-AT 作为由 Espressif Systems 发起和提供技术支持的官方项目,适用于 Windows、Linux、macOS 上的 ESP32、ESP32-C2、ESP32-C3、ESP32-C5、ESP32-C6、ESP32-C61、和 ESP32-S2 系列芯片。 本文档仅包含针对 ESP32 芯片的 ESP-AT 使用。如需了解其他芯片,请在页面左上方的下拉菜单中选择你的目标芯片。 入门 AT Binary 列表 AT 命令集 AT 命令示例 编译和开发 第三方定制化 AT 命令和固件 索引 提供有关此文档的反馈 下一页 © 版权所有 2016 - 2026 乐鑫信息科技(上海)股份有限公司。 利用 Sphinx 构建,使用的 主题 based on Read the Docs Sphinx Theme. Download PDF ESP-AT 用户指南 Choose target... Choose version... 入门 AT Binary 列表 AT 命令集 AT 命令示例 AT 版本简介 编译和开发 如何本地编译 AT 工程 如何在 GitHub 网页上编译 AT 工程 如何修改 AT 管脚 如何添加自定义 AT 命令 如何提高 ESP-AT 吞吐性能 如何更新 mfg_nvs 分区 如何更新出厂参数 如何更新 PKI 配置 如何自定义低功耗蓝牙服务 如何自定义分区 如何使能 ESP32-AT 以太网 如何增加一个新的模组支持 如何实现 SDIO AT 如何基于乐鑫服务器实现自己的 OTA 管理 如何更新 ESP-IDF 版本 ESP-AT 固件差异 如何从 GitHub 下载最新临时版本 AT 固件 at.py 工具 ESP-AT API 参考 Header File Functions Structures Macros Type Definitions Enumerations Header File Functions Macros Enumerations 如何配置 silence mode 如何启用更多 AT 调试日志 第三方开放云平台定制化 AT FAQ 缩写词索引 特别声明 关于 ESP-AT ESP-AT 用户指南 如何编译和开发自己的 AT 工程 AT API Reference 在 GitHub 上编辑 AT API Reference Header File components/at/include/esp_at_core.h Functions void esp_at_module_init(const uint8_t *custom_version) This function should be called only once. 参数: custom_version – version information by custom esp_at_para_parse_result_type esp_at_get_para_as_digit(int32_t para_index, int32_t *value) Parse digit parameter from command string. 参数: para_index – the index of parameter value – the value parsed 返回: ESP_AT_PARA_PARSE_RESULT_OK : succeed ESP_AT_PARA_PARSE_RESULT_FAIL : fail ESP_AT_PARA_PARSE_RESULT_OMITTED : this parameter is OMITTED esp_at_para_parse_result_type esp_at_get_para_as_float(int32_t para_index, float *value) Parse float parameter from command string. 参数: para_index – the index of parameter value – the value parsed 返回: ESP_AT_PARA_PARSE_RESULT_OK : succeed ESP_AT_PARA_PARSE_RESULT_FAIL : fail ESP_AT_PARA_PARSE_RESULT_OMITTED : this parameter is OMITTED esp_at_para_parse_result_type esp_at_get_para_as_str(int32_t para_index, uint8_t **result) Parse string parameter from command string. 参数: para_index – the index of parameter result – the pointer that point to the result. 返回: ESP_AT_PARA_PARSE_RESULT_OK : succeed ESP_AT_PARA_PARSE_RESULT_FAIL : fail ESP_AT_PARA_PARSE_RESULT_OMITTED : this parameter is OMITTED void esp_at_port_recv_data_notify_from_isr(int32_t len) Calling the esp_at_port_recv_data_notify_from_isr to notify at module that at port received data. When received this notice,at task will get data by calling get_data_length and read_data in esp_at_device_ops. This function MUST be used in isr. 参数: len – data length bool esp_at_port_recv_data_notify(int32_t len, uint32_t msec) Calling the esp_at_port_recv_data_notify to notify at module that at port received data. When received this notice,at task will get data by calling get_data_length and read_data in esp_at_device_ops. This function MUST NOT be used in isr. 参数: len – data length msec – timeout time,The unit is millisecond. It waits forever,if msec is portMAX_DELAY. 返回: true : succeed false : fail void esp_at_transmit_terminal_from_isr(void) terminal transparent transmit mode,This function MUST be used in isr. void esp_at_transmit_terminal(void) terminal transparent transmit mode,This function MUST NOT be used in isr. bool esp_at_custom_cmd_array_regist(const esp_at_cmd_struct *custom_at_cmd_array, uint32_t cmd_num) register at command set, which defined by custom, 参数: custom_at_cmd_array – at command set cmd_num – command number void esp_at_device_ops_regist(esp_at_device_ops_struct *ops) register device operate functions set, 参数: ops – device operate functions set bool esp_at_custom_net_ops_regist(int32_t link_id, esp_at_custom_net_ops_struct *ops) bool esp_at_custom_ble_ops_regist(int32_t conn_index, esp_at_custom_ble_ops_struct *ops) void esp_at_custom_ops_regist(esp_at_custom_ops_struct *ops) register custom operate functions set interacting with AT, 参数: ops – custom operate functions set uint32_t esp_at_get_version(void) get at module version number, 返回: at version bit31~bit24: at main version bit23~bit16: at sub version bit15~bit8 : at test version bit7~bit0 : at custom version void esp_at_response_result(uint8_t result_code) response AT process result, 参数: result_code – see esp_at_result_code_string_index int32_t esp_at_port_write_data(uint8_t *data, int32_t len) write data into device, 参数: data – data buffer to be written len – data length 返回: >= 0 : the real length of the data written others : fail. int32_t esp_at_port_active_write_data(uint8_t *data, int32_t len) call pre_active_write_data_callback() first and then write data into device, 参数: data – data buffer to be written len – data length 返回: >= 0 : the real length of the data written others : fail. int32_t esp_at_port_read_data(uint8_t *data, int32_t len) read data from device, 参数: data – data buffer len – data length 返回: >= 0 : the real length of the data read from device others : fail bool esp_at_port_wait_write_complete(int32_t timeout_msec) wait for transmitting data completely to peer device, 参数: timeout_msec – timeout time,The unit is millisecond. 返回: true : succeed,transmit data completely false : fail int32_t esp_at_port_get_data_length(void) get the length of the data received, 返回: >= 0 : the length of the data received others : fail bool esp_at_custom_cmd_line_terminator_set(uint8_t *terminator) Set AT command terminator, by default, the terminator is “\r\n” You can change it by calling this function, but it just supports one character now. 参数: terminator – the line terminator 返回: true : succeed,transmit data completely false : fail uint8_t *esp_at_custom_cmd_line_terminator_get(void) Get AT command line terminator,by default, the return string is “\r\n”. 返回: the command line terminator const esp_partition_t *esp_at_custom_partition_find(esp_partition_type_t type, esp_partition_subtype_t subtype, const char *label) Find the partition which is defined in at_customize.csv. 参数: type – the type of the partition subtype – the subtype of the partition label – Partition label 返回: pointer to esp_partition_t structure, or NULL if no partition is found. This pointer is valid for the lifetime of the application void esp_at_port_enter_specific(esp_at_port_specific_callback_t callback) Set AT core as specific status, it will call callback if receiving data. for example: static void wait_data_callback (void) { xSemaphoreGive(sync_sema); } void process_task(void* para) { vSemaphoreCreateBinary(sync_sema); xSemaphoreTake(sync_sema,portMAX_DELAY); esp_at_port_write_data((uint8_t *)">",strlen(">")); esp_at_port_enter_specific(wait_data_callback); while(xSemaphoreTake(sync_sema,portMAX_DELAY)) { len = esp_at_port_read_data(data, data_len); // TODO: } } 参数: callback – which will be called when received data from AT port void esp_at_port_exit_specific(void) Exit AT core as specific status. const uint8_t *esp_at_get_current_cmd_name(void) Get current AT command name. int32_t esp_at_get_core_version(char *buffer, uint32_t size) Get the version of the AT core library. 参数: buffer – buffer to store the version string size – size of the buffer 返回: > 0 : the real length of the version string others : fail bool at_str_is_null(uint8_t *str) Check if the string is NULL. 参数: str – the string to be checked 返回: true : the string is NULL false : the string is not NULL void at_handle_result_code(esp_at_result_code_string_index code, void *pbuf) Structures struct esp_at_cmd_struct esp_at_cmd_struct used for define at command Public Members char *at_cmdName at command name uint8_t (*at_testCmd)(uint8_t *cmd_name) Test Command function pointer uint8_t (*at_queryCmd)(uint8_t *cmd_name) Query Command function pointer uint8_t (*at_setupCmd)(uint8_t para_num) Setup Command function pointer uint8_t (*at_exeCmd)(uint8_t *cmd_name) Execute Command function pointer struct esp_at_device_ops_struct esp_at_device_ops_struct device operate functions struct for AT Public Members int32_t (*read_data)(uint8_t *data, int32_t len) read data from device int32_t (*write_data)(uint8_t *data, int32_t len) write data into device int32_t (*get_data_length)(void) get the length of data received bool (*wait_write_complete)(int32_t timeout_msec) wait write finish struct esp_at_custom_net_ops_struct esp_at_custom_net_ops_struct custom socket callback for AT Public Members int32_t (*recv_data)(uint8_t *data, int32_t len) callback when socket received data void (*connect_cb)(void) callback when socket connection is built void (*disconnect_cb)(void) callback when socket connection is disconnected struct esp_at_custom_ble_ops_struct esp_at_custom_ble_ops_struct custom ble callback for AT Public Members int32_t (*recv_data)(uint8_t *data, int32_t len) callback when ble received data void (*connect_cb)(void) callback when ble connection is built void (*disconnect_cb)(void) callback when ble connection is disconnected struct esp_at_custom_ops_struct esp_at_ops_struct some custom function interacting with AT Public Members void (*status_callback)(esp_at_status_type status) callback when AT status changes void (*pre_sleep_callback)(at_sleep_mode_t mode) callback before entering light sleep void (*pre_wakeup_callback)(void) callback before waking up from light sleep void (*pre_deepsleep_callback)(void) callback before enter deep sleep void (*pre_restart_callback)(void) callback before restart void (*pre_active_write_data_callback)(at_write_data_fn_t) callback before write data Macros at_min(x, y) at_max(x, y) ESP_AT_ERROR_NO(subcategory, extension) ESP_AT_CMD_ERROR_OK No Error ESP_AT_CMD_ERROR_NON_FINISH terminator character not found (“\r\n” expected) ESP_AT_CMD_ERROR_NOT_FOUND_AT Starting “AT” not found (or at, At or aT entered) ESP_AT_CMD_ERROR_PARA_LENGTH(which_para) parameter l