2C ESP8266 SDK Programming Guide EN V1.2.0

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 157 [warning: Documents this large are best viewed by clicking the View PDF Link!]

ESP8266 SDK API Guide
Version 1.2.0
Espressif Systems IOT Team
Copyright (c) 2015
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Disclaimer and Copyright Notice
Information in this document, including URL references, is subject to change without notice.
THIS DOCUMENT IS PROVIDED AS IS WITH NO WARRANTIES WHATSOEVER, INCLUDING ANY
WARRANTY OF MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR ANY PARTICULAR
PURPOSE, OR ANY WARRANTY OTHERWISE ARISING OUT OF ANY PROPOSAL, SPECIFICATION OR
SAMPLE. All liability, including liability for infringement of any proprietary rights, relating to use of
information in this document is disclaimed. No licenses express or implied, by estoppel or otherwise,
to any intellectual property rights are granted herein.
The Wi-Fi Alliance Member Logo is a trademark of the Wi-Fi Alliance.
All trade names, trademarks and registered trademarks mentioned in this document are property of
their respective owners, and are hereby acknowledged.
Copyright © 2015 Espressif Systems Inc. All rights reserved.
Espressif Systems Confidential / Friday, July 3, 2015 2 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
1. Preambles 13 .................................................................................................
2. Overview 14 ....................................................................................................
3. Application Programming Interface (APIs) 15 ..............................................
3.1. Software Timer!15"........................................................................................
1. os_timer_arm!15 ..........................................................................................
2. os_timer_disarm!16 .....................................................................................
3. os_timer_setfn!16 ........................................................................................
4. system_timer_reinit!16 .................................................................................
5. os_timer_arm_us!17 ....................................................................................
3.2. Hardware Timer!17".......................................................................................
1. hw_timer_init!18 ..........................................................................................
2. hw_timer_arm !18 ........................................................................................
3. hw_timer_set_func!18 ..................................................................................
4. hardware timer example !19 ........................................................................
3.3. System APIs!20"..........................................................................................
1. system_get_sdk_version!20 .........................................................................
2. system_restore!20 .......................................................................................
3. system_restart!20 ........................................................................................
4. system_init_done_cb!21 ..............................................................................
5. system_get_chip_id!21 ................................................................................
6. system_get_vdd33!21 .................................................................................
7. system_adc_read!22 ...................................................................................
8. system_deep_sleep!22 ................................................................................
9. system_deep_sleep_set_option!23 ..............................................................
10. system_phy_set_rfoption!23 ........................................................................
11. system_phy_set_max_tpw!24 ......................................................................
12. system_phy_set_tpw_via_vdd33!25 .............................................................
13. system_set_os_print!25 ...............................................................................
14. system_print_meminfo!25 ............................................................................
15. system_get_free_heap_size!26 ....................................................................
Espressif Systems Confidential / Friday, July 3, 2015 3 157
Table of Content
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
16. system_os_task!26 ......................................................................................
17. system_os_post!27 .....................................................................................
18. system_get_time!28 .....................................................................................
19. system_get_rtc_time!28 ...............................................................................
20. system_rtc_clock_cali_proc!28 ....................................................................
21. system_rtc_mem_write!29 ...........................................................................
22. system_rtc_mem_read!30 ...........................................................................
23. system_uart_swap!30 ..................................................................................
24. system_uart_de_swap!31 ............................................................................
25. system_get_boot_version!31 .......................................................................
26. system_get_userbin_addr!31 .......................................................................
27. system_get_boot_mode!32 .........................................................................
28. system_restart_enhance!32 .........................................................................
29. system_update_cpu_freq!33 ........................................................................
30. system_get_cpu_freq!33 ..............................................................................
31. system_get_flash_size_map!33 ....................................................................
32. system_get_rst_info !34 ...............................................................................
33. system_soft_wdt_stop!35 ............................................................................
34. system_soft_wdt_restart!35 .........................................................................
35. os_memset!36 .............................................................................................
36. os_memcpy!36 ............................................................................................
37. os_strlen!36 .................................................................................................
38. os_printf!37 .................................................................................................
39. os_bzero!37 .................................................................................................
40. os_delay_us!38 ............................................................................................
41. os_install_putc1!38 ......................................................................................
3.4. SPI Flash Related APIs!38"..........................................................................
1. spi_flash_get_id!38 ......................................................................................
2. spi_flash_erase_sector!39 ............................................................................
3. spi_flash_write!39 ........................................................................................
4. spi_flash_read!40 .........................................................................................
5. system_param_save_with_protect !40 .........................................................
6. system_param_load !41 ...............................................................................
Espressif Systems Confidential / Friday, July 3, 2015 4 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
7. spi_flash_set_read_func!42 ..........................................................................
3.5. Wi-Fi Related APIs!44".................................................................................
1. wifi_get_opmode!44 ....................................................................................
2. wifi_get_opmode_default!44 ........................................................................
3. wifi_set_opmode!45 .....................................................................................
4. wifi_set_opmode_current!45 ........................................................................
5. wifi_station_get_config!45 ............................................................................
6. wifi_station_get_config_default!46 ................................................................
7. wifi_station_set_config!46 ............................................................................
8. wifi_station_set_config_current!47 ...............................................................
9. wifi_station_connect!48 ...............................................................................
10. wifi_station_disconnect!48 ...........................................................................
11. wifi_station_get_connect_status!49 .............................................................
12. wifi_station_scan!49 ....................................................................................
13. scan_done_cb_t!50 .....................................................................................
14. wifi_station_ap_number_set!50 ....................................................................
15. wifi_station_get_ap_info!51 ..........................................................................
16. wifi_station_ap_change!51 ...........................................................................
17. wifi_station_get_current_ap_id!51 ................................................................
18. wifi_station_get_auto_connect!52 ................................................................
19. wifi_station_set_auto_connect!52 ................................................................
20. wifi_station_dhcpc_start!52 .........................................................................
21. wifi_station_dhcpc_stop!53 .........................................................................
22. wifi_station_dhcpc_status!53 .......................................................................
23. wifi_station_set_reconnect_policy!54 ...........................................................
24. wifi_station_get_rssi!54 ................................................................................
25. wifi_station_set_hostname!54 ......................................................................
26. wifi_station_get_hostname!55 ......................................................................
27. wifi_softap_get_config!55 ............................................................................
28. wifi_softap_get_config_default!55 ................................................................
29. wifi_softap_set_config!56 .............................................................................
30. wifi_softap_set_config_current!56 ................................................................
31. wifi_softap_get_station_num!57 ...................................................................
Espressif Systems Confidential / Friday, July 3, 2015 5 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
32. wifi_softap_get_station_info!57 ....................................................................
33. wifi_softap_free_station_info!57 ...................................................................
34. wifi_softap_dhcps_start!58 ..........................................................................
35. wifi_softap_dhcps_stop!59 ..........................................................................
36. wifi_softap_set_dhcps_lease!59 ...................................................................
37. wifi_softap_dhcps_status!60 ........................................................................
38. wifi_softap_set_dhcps_offer_option!61 ........................................................
39. wifi_set_phy_mode!62 .................................................................................
40. wifi_get_phy_mode!62 .................................................................................
41. wifi_get_ip_info!62 .......................................................................................
42. wifi_set_ip_info!63 .......................................................................................
43. wifi_set_macaddr!64 ....................................................................................
44. wifi_get_macaddr!65 ...................................................................................
45. wifi_set_sleep_type!65 .................................................................................
46. wifi_get_sleep_type!65 .................................................................................
47. wifi_status_led_install!66 ..............................................................................
48. wifi_status_led_uninstall!66 ..........................................................................
49. wifi_set_broadcast_if!67 ...............................................................................
50. wifi_get_broadcast _if!67 .............................................................................
51. wifi_set_event_handler_cb!67 ......................................................................
52. wifi_get_channel!69 .....................................................................................
53. wifi_set_channel!69 .....................................................................................
54. wifi_wps_enable!70 .....................................................................................
55. wifi_wps_disable!70 .....................................................................................
56. wifi_wps_start!71 .........................................................................................
57. wifi_set_wps_cb!71 .....................................................................................
3.6. ESP-NOW APIs!73"......................................................................................
1. esp_now_init!73 ...........................................................................................
2. esp_now_deinit!73 .......................................................................................
3. esp_now_register_recv_cb!73 .....................................................................
4. esp_now_unregister_recv_cb!74 ..................................................................
5. esp_now_send!74 .......................................................................................
6. esp_now_add_peer!75 ................................................................................
Espressif Systems Confidential / Friday, July 3, 2015 6 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
7. esp_now_del_peer!75 ..................................................................................
8. esp_now_set_self_role!76 ............................................................................
9. esp_now_get_self_role!76 ............................................................................
10. esp_now_set_peer_role!77 ..........................................................................
11. esp_now_get_peer_role!77 ..........................................................................
12. esp_now_set_peer_key!78 ..........................................................................
13. esp_now_get_peer_key!78 ..........................................................................
14. esp_now_set_peer_channel!78 ....................................................................
15. esp_now_get_peer_channel!79 ...................................................................
16. esp_now_is_peer_exist!79 ...........................................................................
17. esp_now_fetch_peer!80 ..............................................................................
18. esp_now_get_cnt_info!80 ............................................................................
3.7. Upgrade (FOTA) APIs!81".............................................................................
1. system_upgrade_userbin_check!81 .............................................................
2. system_upgrade_flag_set!81 .......................................................................
3. system_upgrade_flag_check!81 ...................................................................
4. system_upgrade_start!82 ............................................................................
5. system_upgrade_reboot!82 .........................................................................
3.8. Snier Related APIs!83"...............................................................................
1. wifi_promiscuous_enable!83 ........................................................................
2. wifi_promiscuous_set_mac!83 .....................................................................
3. wifi_set_promiscuous_rx_cb!84 ...................................................................
3.9. smart config APIs!85"..................................................................................
1. smartconfig_start!85 ....................................................................................
2. smartconfig_stop!87 ....................................................................................
3.10. SNTP APIs!88"............................................................................................
1. sntp_setserver!88 ........................................................................................
2. sntp_getserver!88 ........................................................................................
3. sntp_setservername!88 ...............................................................................
4. sntp_getservername!89 ...............................................................................
5. sntp_init!89 ..................................................................................................
6. sntp_stop!89 ...............................................................................................
7. sntp_get_current_timestamp!89 ..................................................................
Espressif Systems Confidential / Friday, July 3, 2015 7 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
8. sntp_get_real_time!90 ..................................................................................
9. SNTP Example!91 ......................................................................................
4. TCP/UDP APIs 92 ...........................................................................................
4.1. Generic TCP/UDP APIs!92".........................................................................
1. espconn_delete!92 ......................................................................................
2. espconn_gethostbyname!92 .......................................................................
3. espconn_port!93 .........................................................................................
4. espconn_regist_sentcb!94 ...........................................................................
5. espconn_regist_recvcb!94 ...........................................................................
6. espconn_sent_callback!95 ..........................................................................
7. espconn_recv_callback!95 ...........................................................................
8. espconn_sent!95 .........................................................................................
4.2. TCP APIs!96"...............................................................................................
1. espconn_accept!96 .....................................................................................
2. espconn_secure_accept!97 .........................................................................
3. espconn_regist_time!97 ...............................................................................
4. espconn_get_connection_info!98 ................................................................
5. espconn_connect!98 ...................................................................................
6. espconn_connect_callback!99 .....................................................................
7. espconn_regist_connectcb!99 .....................................................................
8. espconn_set_opt!100 ..................................................................................
9. espconn_clear_opt!101 ...............................................................................
10. espconn_set_keepalive!101 .........................................................................
11. espconn_get_keepalive!103 ........................................................................
12. espconn_reconnect_callback!103 ................................................................
13. espconn_regist_reconcb!104 .......................................................................
14. espconn_disconnect!105 .............................................................................
15. espconn_regist_disconcb!105 .....................................................................
16. espconn_regist_write_finish!105 ..................................................................
17. espconn_secure_set_size!106 .....................................................................
18. espconn_secure_get_size!107 .....................................................................
19. espconn_secure_connect!107 .....................................................................
20. espconn_secure_sent!108 ...........................................................................
Espressif Systems Confidential / Friday, July 3, 2015 8 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
21. espconn_secure_disconnect!108 ................................................................
22. espconn_secure_ca_disable!109 .................................................................
23. espconn_secure_ca_enable!109 ..................................................................
24. espconn_tcp_get_max_con!110 ..................................................................
25. espconn_tcp_set_max_con!110 ..................................................................
26. espconn_tcp_get_max_con_allow!110 ........................................................
27. espconn_tcp_set_max_con_allow!111 ........................................................
28. espconn_recv_hold!111 ...............................................................................
29. espconn_recv_unhold!112 ...........................................................................
4.3. UDP APIs!112".............................................................................................
1. espconn_create!112 ....................................................................................
2. espconn_igmp_join!113 ...............................................................................
3. espconn_igmp_leave!113 ............................................................................
4. espconn_dns_setserver!113 ........................................................................
4.4. mDNS APIs!114".........................................................................................
1. espconn_mdns_init!114 ...............................................................................
2. espconn_mdns_close!115 ...........................................................................
3. espconn_mdns_server_register!115 ............................................................
4. espconn_mdns_server_unregister!115 .........................................................
5. espconn_mdns_get_servername!116 ..........................................................
6. espconn_mdns_set_servername!116 ..........................................................
7. espconn_mdns_set_hostname!116 .............................................................
8. espconn_mdns_get_hostname!117 .............................................................
9. espconn_mdns_disable!117 ........................................................................
10. espconn_mdns_enable!117 .........................................................................
5. Application Related 118 ................................................................................
5.1. AT APIs!118"................................................................................................
1. at_response_ok!118 ....................................................................................
2. at_response_error!118 .................................................................................
3. at_cmd_array_regist!118 .............................................................................
4. at_get_next_int_dec!119 ..............................................................................
5. at_data_str_copy!119 ..................................................................................
6. at_init!120 ....................................................................................................
Espressif Systems Confidential / Friday, July 3, 2015 9 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
7. at_port_print!120 .........................................................................................
8. at_set_custom_info!120 ...............................................................................
9. at_enter_special_state!121 ..........................................................................
10. at_leave_special_state!121 ..........................................................................
11. at_get_version!121 ......................................................................................
12. at_register_uart_rx_intr!122 ..........................................................................
13. at_response!122 ..........................................................................................
14. at_register_response_func!123 ....................................................................
5.2. Related JSON APIs!124"..............................................................................
1. jsonparse_setup!124 ...................................................................................
2. jsonparse_next!124 .....................................................................................
3. jsonparse_copy_value!124 ...........................................................................
4. jsonparse_get_value_as_int!125 ..................................................................
5. jsonparse_get_value_as_long!125 ...............................................................
6. jsonparse_get_len!125 .................................................................................
7. jsonparse_get_value_as_type!126 ...............................................................
8. jsonparse_strcmp_value!126 .......................................................................
9. jsontree_set_up!126 ....................................................................................
10. jsontree_reset!127 .......................................................................................
11. jsontree_path_name!127 .............................................................................
12. jsontree_write_int!128 ..................................................................................
13. jsontree_write_int_array!128 ........................................................................
14. jsontree_write_string!128 .............................................................................
15. jsontree_print_next!129 ...............................................................................
16. jsontree_find_next!129 .................................................................................
6. Definitions & Structures 130 .........................................................................
6.1. Timer!130"....................................................................................................
6.2. WiFi Related Structures!130".......................................................................
1. Station Related!130 .....................................................................................
2. soft-AP related!130 ....................................................................................
3. scan related!131 ..........................................................................................
4. WiFi event related structure!131 ...................................................................
5. smart config structure!134 ...........................................................................
Espressif Systems Confidential / Friday, July 3, 2015 10 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
6.3. JSON Related Structure!134"......................................................................
1. json structure!134 ........................................................................................
2. json macro definition!135 .............................................................................
6.4. espconn parameters!136"............................................................................
1. callback function!136 ...................................................................................
2. espconn!136 ...............................................................................................
6.5. interrupt related definition!138"....................................................................
7. Peripheral Related Drivers 140 .....................................................................
7.1. GPIO Related APIs!140"..............................................................................
1. PIN Related Macros!140 ..............................................................................
2. gpio_output_set!140 ....................................................................................
3. GPIO input and output macro!141 ...............................................................
4. GPIO interrupt !141 .....................................................................................
5. gpio_pin_intr_state_set!141 .........................................................................
6. GPIO Interrupt Handler!142 .........................................................................
7.2. UART Related APIs!142"..............................................................................
1. uart_init!142 .................................................................................................
2. uart0_tx_buffer!143 ......................................................................................
3. uart0_rx_intr_handler!143 ............................................................................
7.3. I2C Master Related APIs!144".....................................................................
1. i2c_master_gpio_init!144 .............................................................................
2. i2c_master_init!144 ......................................................................................
3. i2c_master_start!144 ...................................................................................
4. i2c_master_stop!145 ...................................................................................
5. i2c_master_send_ack!145 ...........................................................................
6. i2c_master_send_nack!145 .........................................................................
7. i2c_master_checkAck!145 ...........................................................................
8. i2c_master_readByte!146 ............................................................................
9. i2c_master_writeByte!146 ............................................................................
7.4. PWM Related!147".......................................................................................
1. pwm_init!147 ...............................................................................................
2. pwm_start!148 ............................................................................................
3. pwm_set_duty!148 ......................................................................................
Espressif Systems Confidential / Friday, July 3, 2015 11 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
4. pwm_get_duty!148 ......................................................................................
5. pwm_set_period !149 ..................................................................................
6. pwm_get_period !149 ..................................................................................
7. get_pwm_version !149 ................................................................................
8. Appendix 150 ..................................................................................................
8.1. ESPCONN Programming!150".....................................................................
1. TCP Client Mode!150 ..................................................................................
2. TCP Server Mode!150 .................................................................................
3. espconn callback !151 .................................................................................
8.2. RTC APIs Example!151"..............................................................................
8.3. Snier Structure Introduction!153"..............................................................
8.4. ESP8266 soft-AP and station channel configuration!157..........................
Espressif Systems Confidential / Friday, July 3, 2015 12 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
1. Preambles
ESP8266 WiFi SoC offers a complete and self-contained Wi-Fi networking solution; it can be used to
host the application or to offload Wi-Fi networking functions from another application processor.
When ESP8266 hosts the application, it boots up directly from an external flash. In has integrated
cache to improve the performance of the system in such applications. Alternately, serving as a Wi-Fi
adapter, wireless internet access can be added to any microcontroller-based design with simple
connectivity through UART interface or the CPU AHB bridge interface.
ESP8266EX is amongst the most integrated WiFi chip in the industry; it integrates the antenna
switches, RF balun, power amplifier, low noise receive amplifier, filters, power management modules,
it requires minimal external circuitry, and the entire solution, including front-end module, is designed
to occupy minimal PCB area.
ESP8266EX also integrates an enhanced version of Tensilica’s L106 Diamond series 32-bit processor,
with on-chip SRAM, besides the Wi-Fi functionalities. ESP8266EX is often integrated with external
sensors and other application specific devices through its GPIOs; codes for such applications are
provided in examples in the SDK.
Sophisticated system-level features include fast sleep/wake context switching for energy-efficient
VoIP, adaptive radio biasing for low-power operation, advance signal processing, and spur
cancellation and radio co-existence features for common cellular, Bluetooth, DDR, LVDS, LCD
interference mitigation.
The SDK based on ESP8266 IoT platform offers users an easy, fast and efficient way to develop IoT
devices. This programming guide provides overview of the SDK as well as details on the API. It is
written for embedded software developers to help them program on ESP8266 IoT platform.
Espressif Systems Confidential / Friday, July 3, 2015 13 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
2. Overview
The SDK provides a set of interfaces for data receive and transmit functions over the Wi-Fi and TCP/
IP layer so programmers can focus on application development on the high level. Users can easily
make use of the corresponding interfaces to realize data receive and transmit.
All networking functions on the ESP8266 IoT platform are realized in the library, and are not
transparent to users. Instead, users can initialize the interface in user_main.c.
void user_init(void) is the default method provided. Users can add functions like firmware
initialization, network parameters setting, and timer initialization in the interface.
void user_rf_pre_init(void) need to be added in user_main.c since SDK_v1.1.0, refer to
IOT_Demo. It is provided for RF initialization. User can call system_phy_set_rfoption to set RF
option in user_rf_pre_init, or call system_deep_sleep_set_option before deep-sleep. If RF is
disable, ESP8266 station and soft-AP are both disabled, please don’t call related APIs.
The SDK provides APIs to handle JSON, and users can also use self-defined data types to handle the
them.
Notice
Using non-OS SDK which is single-threaded, any task should not occupy CPU too long
If a task occupied CPU for a long time, ESP8266 can't feed the dog, will cause a watchdog
reset
Task should not occupy CPU more than 10 ms, otherwise may cause Wi-Fi connection
break.
We suggest to use a timer to check periodically.
Using non-OS SDK, please don’t call any function defined with ICACHE_FLASH_ATTR in
interrupt handler.
We suggest to use RTOS SDK, RTOS can schedule different tasks.
Espressif Systems Confidential / Friday, July 3, 2015 14 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 15 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 16 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Parameters:!
null
Return:!
null
5. os_timer_arm_us
Function: !
Enable a microsecond timer.
Notes: !
1. Define USE_US_TIMER;!
2. Put system_timer_reinit at the beginning of user_init , in the first
sentence.
Prototype:!
void os_timer_arm_us (!
ETSTimer *ptimer, !
uint32_t microseconds, !
bool repeat_flag!
)
Parameters:!
ETSTimer *ptimer : Timer structure!
uint32_t microseconds : Timing, Unit: microsecond, the minimum value is
0x64, the maximum value allowed to input is 0xFFFFFFF!
bool repeat_flag : Whether the timer will be invoked repeatedly or not
Return:!
null
3.2. Hardware Timer
Hardware timer APIs can be found in /esp_iot_sdk/examples/driver_lib/hw_timer.c. User can
use it according to “readme.txt” which in folder driver_lib.
NOTE:
• if"use"NMI"source,"for"autoload"timer","parameter"val"of hw_timer_arm can't"be"less"than"100."
• if"use"NMI"source,"this"timer"has"highest"priority,"can"interrupt"other"ISR.
• if"use"FRC1"source,"this"timer"can't"interrupt"other"ISR.
APIs in hw_timer.c can not be called when PWM APIs are using, because they are using the
same hardware timer.
Espressif Systems Confidential / Friday, July 3, 2015 17 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 18 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 19 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
3.3. System APIs
1. system_get_sdk_version
Function: !
Get SDK version
Prototype: !
const char* system_get_sdk_version(void)
Parameter: !
none
Return: !
SDK version
Example
os_printf(SDK version: %s \n, system_get_sdk_version());
2. system_restore
Function: !
Reset to default settings of following APIs wifi_station_set_auto_connect,
wifi_set_phy_mode, wifi_softap_set_config related, wifi_station_set_config
related, wifi_set_opmode, and APs information recorded by #define AP_CACHE
Prototype:!
void system_restore(void)
Parameters:!
null
Return:!
null
3. system_restart
Function: !
Restart
Prototype:!
void system_restart(void)
Parameters:!
null
Espressif Systems Confidential / Friday, July 3, 2015 20 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 21 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
system_get_vdd33 can only be called when TOUT pin is suspended
The 107th byte in esp_init_data_default.bin0󺗑127byteis named as
“vdd33_const“ , when TOUT pin is suspended vdd33_const must be set as
0xFF that is 255
Prototype: !
uint16 system_get_vdd33(void)
Parameter: !
none
Return: !
power voltage of VDD33, unit1/1024 V
7. system_adc_read
Function: !
Measure the input voltage of TOUT pin 6, unit1/1024 V
Note:
system_adc_read is only available when wire TOUT"pin to external
circuitryInput Voltage Range"restricted to 0 ~ 1.0V.
The 107th byte in esp_init_data_default.bin(0󺗑127byte) is named as
“vdd33_const”, and when wire TOUT"pin to external circuitry, the
vdd33_const must be set as real power voltage of VDD3P3"pin 3 and 4.
The range of operating voltage of ESP8266 is 1.8V~3.6Vthe unit of
vdd33_const is 0.1Vso effective value range of vdd33_const is [18,
36].
Prototype: !
uint16 system_adc_read(void)
Parameter: !
none
Return: !
input voltage of TOUT pin 6, unit1/1024 V
8. system_deep_sleep
Function: !
Configures chip for deep-sleep mode. When the device is in deep-sleep, it
automatically wakes up periodically; the period is configurable. Upon waking
up, the device boots up from user_init.
Espressif Systems Confidential / Friday, July 3, 2015 22 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 23 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 24 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 25 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 26 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 27 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 28 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 29 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 30 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 31 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 32 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 33 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 34 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 35 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 36 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 37 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 38 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 39 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 40 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 41 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 42 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 43 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 44 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 45 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 46 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 47 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 48 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 49 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 50 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 51 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 52 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 53 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 54 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 55 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 56 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 57 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 58 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 59 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 60 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 61 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 62 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 63 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 64 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 65 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 66 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 67 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 68 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 69 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 70 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 71 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 72 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 73 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 74 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 75 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 76 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 77 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 78 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 79 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 80 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 81 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 82 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 83 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 84 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 85 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 86 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 87 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 88 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 89 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 90 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 91 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 92 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 93 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 94 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 95 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 96 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 97 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 98 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 99 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 100 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 101 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 102 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 103 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 104 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 105 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 106 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 107 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 108 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 109 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 110 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 111 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 112 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 113 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 114 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 115 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 116 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 117 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 118 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 119 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 120 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 121 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 122 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 123 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 124 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 125 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 126 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 127 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 128 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 129 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 130 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 131 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 132 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 133 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 134 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 135 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 136 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 137 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 138 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 139 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 140 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 141 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 142 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 143 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 144 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 145 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 146 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 147 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 148 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 149 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
8. Appendix
8.1. ESPCONN Programming
1. TCP Client Mode
Notes
ESP8266, working in Station mode, will start client connection when given an IP address.
ESP8266, working in soft-AP mode, will start client connection when the devices which are
connected to ESP8266 are given an IP address.
Steps
Initialize espconn parameters according to protocols.
Register connect callback function, and register reconnect callback function.
(Call espconn_regist_connectcb and espconn_regist_reconcb )
Call espconn_connect function and set up the connection with TCP Server.
Registered connected callback function will be called after successful connection, which will
register the corresponding callback function. Recommend to register disconnect callback
function.
(Call espconn_regist_recvcb , espconn_regist_sentcb and espconn_regist_disconcb
in connected callback)
When using receive callback function or sent callback function to run disconnect, it is
recommended to set a time delay to make sure that the all the firmware functions are
completed.
2. TCP Server Mode
Notes
If ESP8266 is in Station mode, it will start server listening when given an IP address.
If ESP8266 is in soft-AP mode, it will start server listening.
Steps
Initialize espconn parameters according to protocols.
Register connect callback and reconnect callback function.
(Call espconn_regist_connectcb and espconn_regist_reconcb )
Call espconn_accept function to listen to the connection with host.
Espressif Systems Confidential / Friday, July 3, 2015 150 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Register Function
Callback
Description
espconn_regist_connectcb
espconn_connect_callback
TCP connected successfully
espconn_regist_reconcb
espconn_reconnect_callback
Error occurTCP disconnected
espconn_regist_sentcb
espconn_sent_callback
Sent TCP or UDP data
espconn_regist_recvcb
espconn_recv_callback
Received TCP or UDP data
espconn_regist_write_finish
espconn_write_finish_callback
Write data into TCP-send-buffer
espconn_regist_disconcb
espconn_disconnect_callback
TCP disconnected successfully
Espressif Systems Confidential / Friday, July 3, 2015 151 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 152 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 153 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 154 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Espressif Systems Confidential / Friday, July 3, 2015 155 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
Case of LEN == X * 10
buf contains structure sniffer_buf: this structure is reliable, data packets represented by it
has been verified by CRC.
sniffer_buf.cnt means the count of packets in buf. The value of len depends on
sniffer_buf.cnt.
sniffer_buf.cnt==0, invalid buf; otherwise, len = 50 + cnt * 10
sniffer_buf.buf contains the first 36 bytes of ieee80211 packet. Starting from
sniffer_buf.lenseq[0], each structure lenseq represent a length information of packet.
lenseq[0] represents the length of first packet. If there are two packets where
(sniffer_buf.cnt == 2), lenseq[1] represents the length of second packet.
If sniffer_buf.cnt > 1, it is a AMPDU packet, head of each MPDU packets are similar, so
we only provide the length of each packet (from head of MAC packet to FCS)
This structure contains: length of packet, MAC address of both sides of communication,
length of the head of packet.
Case of LEN == 12
buf contains structure RxControl; but this structure is not reliable, we can not get neither
MAC address of both sides of communication nor length of the head of packet.
For AMPDU packet, we can not get the count of packets or the length of packet.
This structure contains: length of packet, rssi and FEC_CODING.
RSSI and FEC_CODING are used to guess if the packets are sent from same device.
Summary
We should not take too long to process the packets. Otherwise, other packets may be lost.
The diagram below shows the format of a ieee80211 packet:
The first 24 bytes of MAC Header of data packet are needed:
Address 4 field depends on FromDS and ToDS which is in Frame Control;
Espressif Systems Confidential / Friday, July 3, 2015 156 157
! ! " !
Espressif Systems
ESP8266 SDK Programming Guide
QoS Control field depends on Subtype which is in Frame Control;
HT Control field depends on Order Field which is in Frame Control;
More details are found in IEEE Std 80211-2012.
For WEP packets, MAC Header is followed by 4 bytes IV and before FCS there are 4 bytes
ICV.
For TKIP packet, MAC Header is followed by 4 bytes IV and 4 bytes EIV, and before FCS there
are 8 bytes MIC and 4 bytes ICV.
For CCMP packet, MAC Header is followed by 8 bytes CCMP header, and before FCS there
are 8 bytes MIC.
8.4. ESP8266 soft-AP and station channel configuration
Even though ESP8266 can be in soft-AP + station modeit actually has only one hardware channel.
So in soft-AP + station mode, ESP8266 soft-AP will adjust its channel configuration to be as same as
ESP8266 station.
This limitation may cause some inconvenience in softAP + station mode users need to pay
attentionfor example:
Case 1.
1 If user connect ESP8266 station to a router(e.g. router is in channel 6)
2 Then set ESP8266 softAP by wifi_softap_set_config
3 The API may return true, but channel will always be channel 6. Because we have only one
hardware channel.
Case 2.
1If user set ESP8266 softAP a channel number(e.g. channel 5) by wifi_softap_set_config
2Some stations connected to ESP8266 softAP.
3Then connect ESP8266 station to a router of which channel number is different (e.g. channel
6) .
4ESP8266 softAP has to adjust its channel to be as same as ESP8266 station , in this case, is
channel 6.
5So the stations that connected to ESP8266 softAP in step 2 will be disconnected because of the
channel change.
Espressif Systems Confidential / Friday, July 3, 2015 157 157

Navigation menu