[SOLVED]设置 ESP8266 连接指令中的路由出现错误
[SOLVED]设置 ESP8266 连接指令中的路由出现错误
Postby mrhw » Sun Nov 22, 2015 2:31 pm
测试环境:
ESP8266EX官方开发板
esp_iot_sdk_v1.4.0_15_09_18
使用IoT_Demo例程
User_config.h
第11行 #define LIGHT_DEVICE 1
User_light.h
第14行#define PRIV_PARAM_START_SEC 0xFC或0xFE
编译
esp8266@esp8266-VirtualBox:~/Share/esp_iot_sdk/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):
1
boot mode: new
STEP 2: choose bin generate(0=eagle.flash.bin+eagle.irom0text.bin, 1=user1.bin, 2=user2.bin)
enter (0/1/2, default 0):
1
generate bin: user1.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):
6
spi size: 4096KB
spi ota map: 1024KB + 1024KB
Start...
从http://iot.espressif.cn/获取到master_device_key.bin
关于master_device_key.bin烧写位置
摘自2A-ESP8266__IOT_SDK_User_Manual__CN_v1.4 的22页
图中的链接地址已经失效!
摘自2A-ESP8266__IOT_SDK_User_Manual__CN_v1.4 的19页
按22页说明应该将代码修改为:
User_light.h
第14行#define PRIV_PARAM_START_SEC 0xFE
master_device_key.bin烧写到0xFE000
按19页说明应该将代码修改为:
User_light.h
第14行#define PRIV_PARAM_START_SEC 0xFC
master_device_key.bin烧写到0xFE000(用户参数的第三个扇区)
为什么是0xFC 由2A-ESP8266__IOT_SDK_User_Manual__CN_v1.4 的18页算出
完成烧录后启动信息:
ets Jan 8 2013,rst cause:1, boot mode:(3,2)
load 0x40100000, len 1396, room 16
tail 4
chksum 0x89
load 0x3ffe8000, len 776, room 4
tail 4
chksum 0xe8
load 0x3ffe8308, len 540, room 4
tail 8
chksum 0xc0
csum 0xc0
2nd boot version : 1.4(b1)
SPI Speed : 40MHz
SPI Mode : QIO
SPI Flash Size & Map: 32Mbit(1024KB+1024KB)
jump to run user1 @ 1000
SDK ver: 1.4.0 compiled @ Sep 18 2015 20:55:49
phy ver: 484, pp ver: 9.5
SDK version:1.4.0
IOT VERSION = v1.0.5t45772(a)
reset reason: 0
LIGHT PARAM: R: 33883397
LIGHT PARAM: G: 84148229
LIGHT PARAM: B: 84214789
LIGHT PARAM: CW: -131580
LIGHT PARAM: WW: -521080592
LIGHT PARAM: P: 1000
malloc:1
prd:1000 r : 22222 g: 22222 b: 22222 cw: 22222 ww: 22222
free:0
PWM version : 00000003
mode : sta(18:fe:34:a4:8c:1e) + softAP(1a:fe:34:a4:8c:1e)
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
查询版本信息正常
设置 station 模式
PC 连入 ESP8266 softAP 发送下述 curl 指令,设置 ESP8266 station连接 AP
Windows curl:
curl -X POST -H "Content-Type:application/json" -d "{\"Request\":{\"Station\":
{\"Connect_Station\":{\"ssid\":\"tenda\",\"password\":\"1234567890\",\"token\":
\"1234567890123456789012345678901234567890\"}}}}" http://192.168.4.1/config?
command=wifi
设置完成后,ESP8266 连接指令中的路由。
将其中的”tenda”和”password” 替换为我当前的无线路由用户和口令
串口终端信息
chg_A3:-180
chg_A3:0
len:289
A_dat:142,tot:142,lenght:142
We have a POST request.
webserver's 192.168.4.2:62589 disconnect
f r0, scandone
state: 0 -> 2 (b0)
station: 0c:84:dc:cb:25:3b leave, AID = 1
rm 1
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 3
cnt
connected with MERCURY_B6DD46, channel 6
dhcp client start...
ip:192.168.1.104,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 phy_2,type:2 0 0
mode : sta(18:fe:34:a4:8c:1e)
{"nonce": 116330030,"path": "/v1/device/activate/", "method": "POST", "body": {"encrypt_method": "PLAIN", "token": "5fdb543480b13268e542426fecc59130b7b4e002", "bssid": "18:fe:34:a4:8c:1e","rom_version":"v1.0.5t45772(a)"}, "meta": {"Authorization": "token "}}
user_esp_platform_sent_cb
user_esp_platform_recv_cb {"status": 400, "message": "invalid json string"}
please check device is activated.
{"nonce": 980544564,"path": "/v1/device/activate/", "method": "POST", "body": {"encrypt_method": "PLAIN", "token": "5fdb543480b13268e542426fecc59130b7b4e002", "bssid": "18:fe:34:a4:8c:1e","rom_version":"v1.0.5t45772(a)"}, "meta": {"Authorization": "token "}}
user_esp_platform_sent_cb
ESP8266EX官方开发板
esp_iot_sdk_v1.4.0_15_09_18
使用IoT_Demo例程
User_config.h
第11行 #define LIGHT_DEVICE 1
User_light.h
第14行#define PRIV_PARAM_START_SEC 0xFC或0xFE
编译
esp8266@esp8266-VirtualBox:~/Share/esp_iot_sdk/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):
1
boot mode: new
STEP 2: choose bin generate(0=eagle.flash.bin+eagle.irom0text.bin, 1=user1.bin, 2=user2.bin)
enter (0/1/2, default 0):
1
generate bin: user1.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):
6
spi size: 4096KB
spi ota map: 1024KB + 1024KB
Start...
从http://iot.espressif.cn/获取到master_device_key.bin
关于master_device_key.bin烧写位置
摘自2A-ESP8266__IOT_SDK_User_Manual__CN_v1.4 的22页
图中的链接地址已经失效!
摘自2A-ESP8266__IOT_SDK_User_Manual__CN_v1.4 的19页
按22页说明应该将代码修改为:
User_light.h
第14行#define PRIV_PARAM_START_SEC 0xFE
master_device_key.bin烧写到0xFE000
按19页说明应该将代码修改为:
User_light.h
第14行#define PRIV_PARAM_START_SEC 0xFC
master_device_key.bin烧写到0xFE000(用户参数的第三个扇区)
为什么是0xFC 由2A-ESP8266__IOT_SDK_User_Manual__CN_v1.4 的18页算出
完成烧录后启动信息:
ets Jan 8 2013,rst cause:1, boot mode:(3,2)
load 0x40100000, len 1396, room 16
tail 4
chksum 0x89
load 0x3ffe8000, len 776, room 4
tail 4
chksum 0xe8
load 0x3ffe8308, len 540, room 4
tail 8
chksum 0xc0
csum 0xc0
2nd boot version : 1.4(b1)
SPI Speed : 40MHz
SPI Mode : QIO
SPI Flash Size & Map: 32Mbit(1024KB+1024KB)
jump to run user1 @ 1000
SDK ver: 1.4.0 compiled @ Sep 18 2015 20:55:49
phy ver: 484, pp ver: 9.5
SDK version:1.4.0
IOT VERSION = v1.0.5t45772(a)
reset reason: 0
LIGHT PARAM: R: 33883397
LIGHT PARAM: G: 84148229
LIGHT PARAM: B: 84214789
LIGHT PARAM: CW: -131580
LIGHT PARAM: WW: -521080592
LIGHT PARAM: P: 1000
malloc:1
prd:1000 r : 22222 g: 22222 b: 22222 cw: 22222 ww: 22222
free:0
PWM version : 00000003
mode : sta(18:fe:34:a4:8c:1e) + softAP(1a:fe:34:a4:8c:1e)
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
查询版本信息正常
设置 station 模式
PC 连入 ESP8266 softAP 发送下述 curl 指令,设置 ESP8266 station连接 AP
Windows curl:
curl -X POST -H "Content-Type:application/json" -d "{\"Request\":{\"Station\":
{\"Connect_Station\":{\"ssid\":\"tenda\",\"password\":\"1234567890\",\"token\":
\"1234567890123456789012345678901234567890\"}}}}" http://192.168.4.1/config?
command=wifi
设置完成后,ESP8266 连接指令中的路由。
将其中的”tenda”和”password” 替换为我当前的无线路由用户和口令
串口终端信息
chg_A3:-180
chg_A3:0
len:289
A_dat:142,tot:142,lenght:142
We have a POST request.
webserver's 192.168.4.2:62589 disconnect
f r0, scandone
state: 0 -> 2 (b0)
station: 0c:84:dc:cb:25:3b leave, AID = 1
rm 1
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 3
cnt
connected with MERCURY_B6DD46, channel 6
dhcp client start...
ip:192.168.1.104,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 phy_2,type:2 0 0
mode : sta(18:fe:34:a4:8c:1e)
{"nonce": 116330030,"path": "/v1/device/activate/", "method": "POST", "body": {"encrypt_method": "PLAIN", "token": "5fdb543480b13268e542426fecc59130b7b4e002", "bssid": "18:fe:34:a4:8c:1e","rom_version":"v1.0.5t45772(a)"}, "meta": {"Authorization": "token "}}
user_esp_platform_sent_cb
user_esp_platform_recv_cb {"status": 400, "message": "invalid json string"}
please check device is activated.
{"nonce": 980544564,"path": "/v1/device/activate/", "method": "POST", "body": {"encrypt_method": "PLAIN", "token": "5fdb543480b13268e542426fecc59130b7b4e002", "bssid": "18:fe:34:a4:8c:1e","rom_version":"v1.0.5t45772(a)"}, "meta": {"Authorization": "token "}}
user_esp_platform_sent_cb
Re: 设置 ESP8266 连接指令中的路由出现错误
Postby ESP_Faye » Mon Nov 23, 2015 5:54 pm
您好,
5fdb543480b13268e542426fecc59130b7b4e002 确实是您设备的 master device key 值吗?
可能是由于您的随机 token 值 “1234567890123456789012345678901234567890” 并不随机,写在文档里可能其他用户已经使用过了。
请更换一个随机 token 使用,看是否还有问题 ?
感谢您对 ESP8266 的关注!
5fdb543480b13268e542426fecc59130b7b4e002 确实是您设备的 master device key 值吗?
可能是由于您的随机 token 值 “1234567890123456789012345678901234567890” 并不随机,写在文档里可能其他用户已经使用过了。
请更换一个随机 token 使用,看是否还有问题 ?
感谢您对 ESP8266 的关注!
Re: 设置 ESP8266 连接指令中的路由出现错误
Postby mrhw » Tue Nov 24, 2015 2:31 pm
再次测试:
please check device is activated.
{"nonce": 43796077,"path": "/v1/device/activate/", "method": "POST", "body": {"encrypt_method": "PLAIN", "token": "a12c5b4447bf8abe6a82d37f904f0ec1a6128965", "bssid": "18:fe:34:a4:8c:1e","rom_version":"v1.0.5t45772(a)"}, "meta": {"Authorization": "token "}}
user_esp_platform_sent_cb
user_esp_platform_recv_cb {"status": 400, "message": "invalid json string"}
使用随机token "a12c5b4447bf8abe6a82d37f904f0ec1a6128965"
device key 5fdb543480b13268e542426fecc59130b7b4e006 edit key (master )
please check device is activated.
{"nonce": 43796077,"path": "/v1/device/activate/", "method": "POST", "body": {"encrypt_method": "PLAIN", "token": "a12c5b4447bf8abe6a82d37f904f0ec1a6128965", "bssid": "18:fe:34:a4:8c:1e","rom_version":"v1.0.5t45772(a)"}, "meta": {"Authorization": "token "}}
user_esp_platform_sent_cb
user_esp_platform_recv_cb {"status": 400, "message": "invalid json string"}
使用随机token "a12c5b4447bf8abe6a82d37f904f0ec1a6128965"
device key 5fdb543480b13268e542426fecc59130b7b4e006 edit key (master )
Re: 设置 ESP8266 连接指令中的路由出现错误
Postby ESP_Faye » Tue Nov 24, 2015 3:32 pm
您好,
user_esp_platform.h 中的 #define ESP_PARAM_START_SEC 0x3D 请改为 0xFD
user_light.h 中的 #define PRIV_PARAM_START_SEC 0x3C 请改为 0xFC
master_device_key.bin 烧录到 0xFE000
这个 Flash Map 的分布是太复杂了,很抱歉给您带来困扰。
user_esp_platform.h 中的 #define ESP_PARAM_START_SEC 0x3D 请改为 0xFD
user_light.h 中的 #define PRIV_PARAM_START_SEC 0x3C 请改为 0xFC
master_device_key.bin 烧录到 0xFE000
这个 Flash Map 的分布是太复杂了,很抱歉给您带来困扰。
Who is online
Users browsing this forum: No registered users and 3 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.