硬件连接:
(供电开关打在B5V,使用TTL供电) 接二极管有两个作用 1.防止同一个电脑上两个虚拟串口直通,这样可能导致设备管理器反复枚举(不是必然事件)。 2.可以一个TTL转串口同时监听L610和F411,两个L610和F411的TX因为有背靠背的二极管隔壁不会相连。
AT监听结果:
AT AT
OK AT+CPIN? AT+CPIN?
+CPIN: READY
OK AT+MIPCALL=1 AT+MIPCALL=1
OK
+MIPCALL: 10.207.83.188 AT+MIPCALL=1 AT+MIPCALL=1
ERROR AT+TCDEVINFOSET=1,“IGA6ZV5NNK”,“lamp_01”,“n41ziNuSI2jyY3jbYh1HvQ==” AT+TCDEVINFOSET=1,“IGA6ZV5NNK”,“lamp_01”,“n41ziNuSI2jyY3jbYh1HvQ==”
OK
+TCDEVINFOSET: OK AT+TCMQTTCONN=1,20000,240,1,1 AT+TCMQTTCONN=1,20000,240,1,1
OK
+TCMQTTCONN: OK AT+TCMQTTSUB=“
t
h
i
n
g
/
d
o
w
n
/
p
r
o
p
e
r
t
y
/
I
G
A
6
Z
V
5
N
N
K
/
l
a
m
p
0
1
"
,
1
A
T
+
T
C
M
Q
T
T
S
U
B
=
"
thing/down/property/IGA6ZV5NNK/lamp_01",1 AT+TCMQTTSUB="
thing/down/property/IGA6ZV5NNK/lamp0?1",1AT+TCMQTTSUB="thing/down/property/IGA6ZV5NNK/lamp_01”,1
OK
+TCMQTTSUB: OK AT+MIPCALL=1 AT+MIPCALL=1
ERROR AT+TCDEVINFOSET=1,“IGA6ZV5NNK”,“lamp_01”,“n41ziNuSI2jyY3jbYh1HvQ==” AT+TCDEVINFOSET=1,“IGA6ZV5NNK”,“lamp_01”,“n41ziNuSI2jyY3jbYh1HvQ==”
OK
+TCDEVINFOSET: OK AT+TCMQTTCONN=1,20000,240,1,1 AT+TCMQTTCONN=1,20000,240,1,1
+CME ERROR: 4 AT+TCMQTTSUB=“
t
h
i
n
g
/
d
o
w
n
/
p
r
o
p
e
r
t
y
/
I
G
A
6
Z
V
5
N
N
K
/
l
a
m
p
0
1
"
,
1
A
T
+
T
C
M
Q
T
T
S
U
B
=
"
thing/down/property/IGA6ZV5NNK/lamp_01",1 AT+TCMQTTSUB="
thing/down/property/IGA6ZV5NNK/lamp0?1",1AT+TCMQTTSUB="thing/down/property/IGA6ZV5NNK/lamp_01”,1
OK
+TCMQTTSUB: OK
腾讯云收到的效果:
附主函数代码:
HAL_Init();
SystemClock_Config();
MX_GPIO_Init();
MX_USART1_UART_Init();
MX_USART2_UART_Init();
l610_send_cmd("AT","OK",20);
HAL_Delay(1000);
l610_send_cmd("AT+CPIN?","+CPIN: READY",20);
HAL_Delay(1000);
l610_send("AT+MIPCALL=1");
HAL_Delay(1000);
l610_send("AT+MIPCALL=1");
HAL_Delay(1000);
printf("IP获取完成!!!\r\n");
l610_send("AT+TCDEVINFOSET=1,\"IGA6ZV5NNK\",\"lamp_01\",\"n41ziNuSI2jyY3jbYh1HvQ==\"");
HAL_Delay(1000);
l610_send("AT+TCMQTTCONN=1,20000,240,1,1");
HAL_Delay(1000);
l610_send("AT+TCMQTTSUB=\"$thing/down/property/IGA6ZV5NNK/lamp_01\",1");
HAL_Delay(1000);
l610_send("AT+MIPCALL=1");
HAL_Delay(1000);
printf("IP获取完成!!!\r\n");
l610_send("AT+TCDEVINFOSET=1,\"IGA6ZV5NNK\",\"lamp_01\",\"n41ziNuSI2jyY3jbYh1HvQ==\"");
HAL_Delay(1000);
l610_send("AT+TCMQTTCONN=1,20000,240,1,1");
HAL_Delay(1000);
l610_send("AT+TCMQTTSUB=\"$thing/down/property/IGA6ZV5NNK/lamp_01\",1");
HAL_Delay(1000);
printf("初始化成功!!!\r\n");
|