乐鑫技术交流
直播中

康桃花

7年用户 925经验值
私信 关注
[问答]

请问如何通过云端控制ESP8266?

  1. 已经参考 http://my.oschina.net/u/2327133/blog/388092  注册云端服务

2. 使用 SDK1.5.0 的example  IoT_Demo例程编译发现一个问题

2.1 如果将 IoT_Demo 目录下的全部内容拷贝到 app 下,make 是 可以编译完成
2.2 如果 执行 ./gen_misc.sh,编译时会一直死循环编译如下图
Code: Select all
esp8266@esp8266-VirtualBox:/mnt/Share/ESP8266_NONOS_SDK_V1.5.1_16_01_08/esp_iot_sdk_v1.5.1/app$ ./gen_misc.sh
gen_misc.sh version 20150511

Please follow below steps(1-5) to generate specific bin(s):
STEP 1: choose boot version(0=boot_v1.1, 1=boot_v1.2+, 2=none)
enter(0/1/2, default 2):
2
boot mode: none

STEP 2: choose bin generate(0=eagle.flash.bin+eagle.irom0text.bin, 1=user1.bin, 2=user2.bin)
enter (0/1/2, default 0):
0
generate bin: eagle.flash.bin+eagle.irom0text.bin

STEP 3: choose spi speed(0=20MHz, 1=26.7MHz, 2=40MHz, 3=80MHz)
enter (0/1/2/3, default 2):
2
spi speed: 40 MHz

STEP 4: choose spi mode(0=QIO, 1=QOUT, 2=DIO, 3=DOUT)
enter (0/1/2/3, default 0):
0
spi mode: QIO

STEP 5: choose spi size and map
    0= 512KB( 256KB+ 256KB)
    2=1024KB( 512KB+ 512KB)
    3=2048KB( 512KB+ 512KB)
    4=4096KB( 512KB+ 512KB)
    5=2048KB(1024KB+1024KB)
    6=4096KB(1024KB+1024KB)
enter (0/2/3/4/5/6, default 0):
2
spi size: 1024KB
spi ota map:  512KB + 512KB


start...

make[1]: Entering directory `/mnt/Share/ESP8266_NONOS_SDK_V1.5.1_16_01_08/esp_iot_sdk_v1.5.1/app/user'
DEPEND: xtensa-lx106-elf-gcc -M -Os -g -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -ffunction-sections -fdata-sections -DICACHE_FLASH -I include -I ./ -I ../../include/ets -I ../include -I ../../include -I ../../include/eagle user_webserver.c
DEPEND: xtensa-lx106-elf-gcc -M -Os -g -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -ffunction-sections -fdata-sections -DICACHE_FLASH -I include -I ./ -I ../../include/ets -I ../include -I ../../include -I ../../include/eagle user_sensor.c
DEPEND: xtensa-lx106-elf-gcc -M -Os -g -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -ffunction-sections -fdata-sections -DICACHE_FLASH -I include -I ./ -I ../../include/ets -I ../include -I ../../include -I ../../include/eagle user_plug.c
DEPEND: xtensa-lx106-elf-gcc -M -Os -g -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -ffunction-sections -fdata-sections -DICACHE_FLASH -I include -I ./ -I ../../include/ets -I ../include -I ../../include -I ../../include/eagle user_main.c
DEPEND: xtensa-lx106-elf-gcc -M -Os -g -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -ffunction-sections -fdata-sections -DICACHE_FLASH -I include -I ./ -I ../../include/ets -I ../include -I ../../include -I ../../include/eagle user_light.c
DEPEND: xtensa-lx106-elf-gcc -M -Os -g -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -ffunction-sections -fdata-sections -DICACHE_FLASH -I include -I ./ -I ../../include/ets -I ../include -I ../../include -I ../../include/eagle user_light_adj.c
DEPEND: xtensa-lx106-elf-gcc -M -Os -g -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -ffunction-sections -fdata-sections -DICACHE_FLASH -I include -I ./ -I ../../include/ets -I ../include -I ../../include -I ../../include/eagle user_json.c
DEPEND: xtensa-lx106-elf-gcc -M -Os -g -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -ffunction-sections -fdata-sections -DICACHE_FLASH -I include -I ./ -I ../../include/ets -I ../include -I ../../include -I ../../include/eagle user_esp_platform_timer.c
DEPEND: xtensa-lx106-elf-gcc -M -Os -g -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -ffunction-sections -fdata-sections -DICACHE_FLASH -I include -I ./ -I ../../include/ets -I ../include -I ../../include -I ../../include/eagle user_esp_platform.c
DEPEND: xtensa-lx106-elf-gcc -M -Os -g -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -ffunction-sections -fdata-sections -DICACHE_FLASH -I include -I ./ -I ../../include/ets -I ../include -I ../../include -I ../../include/eagle user_devicefind.c
make[1]: Leaving directory `/mnt/Share/ESP8266_NONOS_SDK_V1.5.1_16_01_08/esp_iot_sdk_v1.5.1/app/user'
make[1]: Entering directory `/mnt/Share/ESP8266_NONOS_SDK_V1.5.1_16_01_08/esp_iot_sdk_v1.5.1/app/user'
DEPEND: xtensa-lx106-elf-gcc -M -Os -g -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -ffunction-sections -fdata-sections -DICACHE_FLASH -I include -I ./ -I ../../include/ets -I ../include -I ../../include -I ../../include/eagle user_main.c
make[1]: Leaving directory `/mnt/Share/ESP8266_NONOS_SDK_V1.5.1_16_01_08/esp_iot_sdk_v1.5.1/app/user'
make[1]: Entering directory `/mnt/Share/ESP8266_NONOS_SDK_V1.5.1_16_01_08/esp_iot_sdk_v1.5.1/app/user'
DEPEND: xtensa-lx106-elf-gcc -M -Os -g -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -ffunction-sections -fdata-sections -DICACHE_FLASH -I include -I ./ -I ../../include/ets -I ../include -I ../../include -I ../../include/eagle user_main.c
make[1]: Leaving directory `/mnt/Share/ESP8266_NONOS_SDK_V1.5.1_16_01_08/esp_iot_sdk_v1.5.1/app/user'
make[1]: Entering directory `/mnt/Share/ESP8266_NONOS_SDK_V1.5.1_16_01_08/esp_iot_sdk_v1.5.1/app/user'
DEPEND: xtensa-lx106-elf-gcc -M -Os -g -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -ffunction-sections -fdata-sections -DICACHE_FLASH -I include -I ./ -I ../../include/ets -I ../include -I ../../include -I ../../include/eagle user_main.c
make[1]: Leaving directory `/mnt/Share/ESP8266_NONOS_SDK_V1.5.1_16_01_08/esp_iot_sdk_v1.5.1/app/user'
make[1]: Entering directory `/mnt/Share/ESP8266_NONOS_SDK_V1.5.1_16_01_08/esp_iot_sdk_v1.5.1/app/user'
DEPEND: xtensa-lx106-elf-gcc -M -Os -g -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -ffunction-sections -fdata-sections -DICACHE_FLASH -I include -I ./ -I ../../include/ets -I ../include -I ../../include -I ../../include/eagle user_main.c
make[1]: Leaving directory `/mnt/Share/ESP8266_NONOS_SDK_V1.5.1_16_01_08/esp_iot_sdk_v1.5.1/app/user'
make[1]: Entering directory `/mnt/Share/ESP8266_NONOS_SDK_V1.5.1_16_01_08/esp_iot_sdk_v1.5.1/app/user'
DEPEND: xtensa-lx106-elf-gcc -M -Os -g -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -ffunction-sections -fdata-sections -DICACHE_FLASH -I include -I ./ -I ../../include/ets -I ../include -I ../../include -I ../../include/eagle user_main.c
make[1]: Leaving directory `/mnt/Share/ESP8266_NONOS_SDK_V1.5.1_16_01_08/esp_iot_sdk_v1.5.1/app/user'
make[1]: Entering directory `/mnt/Share/ESP8266_NONOS_SDK_V1.5.1_16_01_08/esp_iot_sdk_v1.5.1/app/user'
DEPEND: xtensa-lx106-elf-gcc -M -Os -g -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -ffunction-sections -fdata-sections -DICACHE_FLASH -I include -I ./ -I ../../include/ets -I ../include -I ../../include -I ../../include/eagle user_main.c



3. 手机端安装对应的http://shouji.baidu.com/software/item?docid=7580135&from=as APK应用

4. 手机配置设备 推送 SSID 和 password,从设备的打印监控来看,设备已经连接到云端


ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x40100000, len 29468, room 16
tail 12
chksum 0x0c
ho 0 tail 12 room 4
load 0x3ffe8000, len 2936, room 12
tail 12
chksum 0x47
ho 0 tail 12 room 4
load 0x3ffe8b80, len 3780, room 12
tail 8
chksum 0x55
csum 0x55
犟+P禇h〥r
SDK ver: 1.5.1(e67da894) compiled @ Jan  7 2016 18:44:54
phy ver: 484, pp ver: 9.6

SDK version:1.5.1(e67da894)
IOT VERSION = v1.0.5t45772(a)
reset reason: 6
LIGHT PARAM: R: 1431183461
LIGHT PARAM: G: 168643660
LIGHT PARAM: B: 0
LIGHT PARAM: CW: 29477
LIGHT PARAM: WW: 29477
LIGHT PARAM: P: 1000
malloc:1
prd:1000  r : 22222  g: 22222  b: 0  cw: 22222  ww: 22222
free:0
PWM version : 00000003
mode : sta(5c:cf:7f:0c:1b:01) + softAP(5e:cf:7f:0c:1b:01)
add if0
add if1
dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
bcn 100
finish
add 1
aid 1
station: 58:44:98:fa:97:87 join, AID = 1
len:282
A_dat:139,tot:139,lenght:139
We have a POST request.
webserver's 192.168.4.2:37606 disconnect
f r0, scandone
state: 0 -> 2 (b0)
station: 58:44:98:fa:97:87 leave, AID = 1
rm 1
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 3
cnt

connected with MERCURY-JQY, channel 6
dhcp client start...
ip:192.168.1.110,mask:255.255.255.0,gw:192.168.1.1
host_name = espressif_light_demo
server_name = _espLight._tcp.local
user_esp_platform_dns_found 115.29.202.58
user_esp_platform_connect
user_esp_platform_connect_cb
bcn 0
del if1
pm open,type:2 0
mode : sta(5c:cf:7f:0c:1b:01)
{"nonce": 1731464645,"path": "/v1/device/activate/", "method": "POST", "body": {"encrypt_method": "PLAIN", "token": "vfzzuj2zh19uva31bk70mx5qeh2sjwad3iavfhb6", "bssid": "5c:cf:7f:0c:1b:01","rom_version":"v1.0.5t45772(a)"}, "meta": {"Authorization": "token 2f190a696181213928f24a38074c69bd6723410b"}}

user_esp_platform_sent_cb
user_esp_platform_recv_cb {"nonce": 1731464645, "status": 200, "mdev_mac": "5CCF7F0C1B01", "token": {"datastream_id": 0, "updated": "2016-03-03 22:13:40", "user_id": 5198, "name": "owner key", "created": "2016-03-03 22:13:40", "generated_at": "2016-03-03 22:13:40", "source_ip": "*", "visibly": 1, "delete_after_used": 0, "datastream_tmpl_id": 0, "token": "vfzzuj2zh19uva31bk70mx5qeh2sjwad3iavfhb6", "activate_status": 1, "is_owner_key": 1, "revoke_prekeys_if_ownerkey": 1, "access_methods": "*", "token_expired_at": "2016-03-03 22:23:40", "scope": 3, "expired_at": "2289-12-17 22:13:40", "product_id": 0, "id": 119091, "device_id": 123516}, "key": {"updated": "2016-03-03 20:18:28", "user_id": 5198, "name": "device key", "created": "2016-03-03 20:18:28", "source_ip": "*", "level": 0, "is_master_key": 1, "visibly": 1, "datastream_id": 0, "datastream_tmpl_id": 0, "token": "2f190a696181213928f24a38074c69bd6723410b", "activate_status": 1, "is_owner_key": 0, "access_methods": "*", "authorized_user_id": 0, "scope": 3, "expired_at": "2289-12-17 20:18:28", "product_id": 0, "id": 143257, "device_id": 123516}, "device": {"productbatch_id": 0, "bssid": "5c:cf:7f:0c:1b:01", "ptype": 45772, "activate_status": 1, "serial": "7bd951a9", "id": 123516, "description": "desc-7bd951a9", "last_active": "2016-03-03 20:18:28", "rom_version": "v1.0.5t45772(a)", "last_pull": "2016-03-03 20:18:28", "last_push": "2016-03-03 20:18:28", "location": "", "last_activated_at": "2016-
device activates successful.
{"nonce": 2134232791, "path": "/v1/device/identify", "method": "GET","meta": {"Authorization": "token 2f190a696181213928f24a38074c69bd6723410b"}}

state: 5 -> 0 (0)
rm 0
pm close 7
del if0
usl
user_esp_platform_recon_cb

SDK ver: 1.5.1(e67da894) compiled @ Jan  7 2016 18:44:54
phy ver: 484, pp ver: 9.6

SDK version:1.5.1(e67da894)
IOT VERSION = v1.0.5t45772(a)
reset reason: 4
LIGHT PARAM: R: 1431183461
LIGHT PARAM: G: 168643660
LIGHT PARAM: B: 0
LIGHT PARAM: CW: 29477
LIGHT PARAM: WW: 29477
LIGHT PARAM: P: 1000
malloc:1
prd:1000  r : 22222  g: 22222  b: 0  cw: 22222  ww: 22222
free:0
PWM version : 00000003
mode : sta(5c:cf:7f:0c:1b:01)
add if0
f r0, finish
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 3
cnt

connected with MERCURY-JQY, channel 6
dhcp client start...
ip:192.168.1.110,mask:255.255.255.0,gw:192.168.1.1
host_name = espressif_light_demo
server_name = _espLight._tcp.local
user_esp_platform_dns_found 115.29.202.58
user_esp_platform_connect
user_esp_platform_connect_cb
{"nonce": 1082095088, "path": "/v1/device/identify", "method": "GET","meta": {"Authorization": "token 2f190a696181213928f24a38074c69bd6723410b"}}

user_esp_platform_sent_cb
user_esp_platform_recv_cb {"nonce": 1082095088, "status": 200, "mdev_mac": "5CCF7F0C1B01", "datetime": "2016-03-03 22:13:44", "device": {"productbatch_id": 0, "bssid": "5c:cf:7f:0c:1b:01", "ptype": 45772, "activate_status": 1, "serial": "7bd951a9", "id": 123516, "latest_rom_version": "", "last_active": "2016-03-03 20:18:28", "rom_version": "v1.0.5t45772(a)", "last_pull": "2016-03-03 20:18:28", "last_push": "2016-03-03 20:18:28", "location": "", "last_activated_at": "2016-03-03 22:13:40", "metadata": "", "status": 1, "updated": "2016-03-03 22:13:40", "description": "desc-7bd951a9", "activated_at": "2016-03-03 22:13:40", "visibly": 1, "is_private": 0, "product_id": 2368, "name": "light-001", "created": "2016-03-03 20:18:28", "is_frozen": 0, "key_id": 143257}, "message": "device identified"}

{"body": {}, "get":{"is_humanize_format_simple":"true"},"meta": {"Authorization": "Token 2f190a696181213928f24a38074c69bd6723410b"},"path": "/v1/device/timers/","post":{},"method": "GET"}

user_esp_platform_sent_cb
user_esp_platform_recv_cb {"status": 200, "mdev_mac": "5CCF7F0C1B01", "weekday_timestamp_mod": 339224, "timestamp": 1457014424, "timers": "", "weekday": 4, "now": "2016-03-03 22:13:44"}

pm open,type:2 0
user_esp_platform_sent_beacon 54025607
user_esp_platform_sent_cb
user_esp_platform_recv_cb {"status": 200, "epoch": 1457014474, "mdev_mac": "5CCF7F0C1B01", "message": "ping success", "datetime": "2016-03-03 22:14:34"}

ping success
I'm Light.5c:cf:7f:0c:1b:01 192.168.1.110
I'm Light.5c:cf:7f:0c:1b:01 192.168.1.110
I'm Light.5c:cf:7f:0c:1b:01 192.168.1.110
user_esp_platform_sent_beacon 104081566
user_esp_platform_sent_cb
user_esp_platform_recv_cb {"status": 200, "epoch": 1457014524, "mdev_mac": "5CCF7F0C1B01", "message": "ping success", "datetime": "2016-03-03 22:15:24"}

ping success
user_esp_platform_sent_beacon 154136054
user_esp_platform_sent_cb
user_esp_platform_recv_cb {"status": 200, "epoch": 1457014574, "mdev_mac": "5CCF7F0C1B01", "message": "ping success", "datetime": "2016-03-03 22:16:14"}



5. 手机端会提示 “需要升级应用才能控制设备”,是什么意思?

回帖(1)

王辉

2024-7-15 16:56:22
要通过云端控制ESP8266,您可以按照以下步骤操作:

1. 注册云端服务:您已经参考了 http://my.oschina.net/u/2327133/blog/388092 来注册云端服务。这是一个很好的开始,因为您需要一个云端平台来与ESP8266进行通信。

2. 使用SDK 1.5.0的example IoT_Demo例程:您提到在使用IoT_Demo例程时遇到了一些问题。让我们逐步解决这些问题。

问题2.1:将IoT_Demo目录下的全部内容拷贝到app下,make可以编译完成。这说明您的代码没有问题,可能是gen_misc.sh脚本的问题。

问题2.2:执行./gen_misc.sh时,编译时会一直死循环。这可能是由于gen_misc.sh脚本中的某些问题导致的。让我们尝试解决这个问题:

步骤1:检查gen_misc.sh脚本的版本。您提供的版本是20150511。请确保您使用的是最新版本的gen_misc.sh脚本。

步骤2:检查gen_misc.sh脚本中的步骤1-5。确保您按照脚本中的说明正确执行了这些步骤。

步骤3:检查您的环境变量是否正确设置。确保您的环境变量(如PATH、MAKEFILE等)已经正确设置,以便脚本可以正常运行。

步骤4:尝试手动执行gen_misc.sh脚本中的命令。如果可能的话,尝试逐行执行脚本中的命令,以找出导致死循环的具体原因。


举报

更多回帖

发帖
×
20
完善资料,
赚取积分