Skip to content

Commit 3ba52eb

Browse files
committed
doc: add example_esp8266, minor fix for lwm2m
Signed-off-by: Yuguo Zou <[email protected]>
1 parent 94728de commit 3ba52eb

File tree

4 files changed

+197
-4
lines changed

4 files changed

+197
-4
lines changed

doc/documents/example/example.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ JTAG, or the .bin files through SD card by secondary bootloader.
3535
example/baremetal/graphic_u8glib :ref:`example_graphic_u8glib`
3636
example/baremetal/openthread/cli :ref:`example_openthread_cli`
3737
example/baremetal/openthread/ncp :ref:`example_openthread_ncp`
38+
example/freertos/esp8266_wifi :ref:`example_esp8266_wifi`
3839
example/freertos/iot/coap/coap_server :ref:`example_iot_coap_coap_server`
3940
example/freertos/iot/lwm2m/lwm2m_client :ref:`example_iot_lwm2m_lwm2m_client`
4041
example/freertos/iot/lwm2m/lwm2m_server :ref:`example_iot_lwm2m_lwm2m_server`
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
.. _example_esp8266_wifi:
2+
3+
ESP8266 WiFi Module
4+
####################
5+
6+
Overview
7+
********
8+
9+
This example is designed to show basic usage of ESP01/ESP01S esp8266 WiFi Module on embARC board.
10+
11+
Detailed Description
12+
====================
13+
14+
* Extra Required Peripherals
15+
ESP01/ESP01S WiFi Module
16+
17+
* Design Concept
18+
Without downloading users' image, ESP01/ESP01S can be controlled using AT commands.
19+
This example is designed to show how to use AT commands to control the Wi-Fi module and exchange data.
20+
Besides, we use AT command to establish a TCP server and provide simple HTTP service just like our another example :ref:`example_net_httpserver`
21+
22+
* Usage Manual
23+
- Connect ESP01/ESP01S module to your board, see :ref:`peripheral_preparation`.
24+
- Set up an AP, the default setting of this example is to connect a WIFI with SSID: `embARC`, pwd: `qazwsxedc`.
25+
- Build, download, run the example and get log from COM port console.
26+
- When you see a `while` is shown in log, meaning that the server is setup and waiting for input. Then open your web browser (Chrome, Firefox) and visit the ip address shown in the log. You will get a web page right away.
27+
28+
Building and Running
29+
********************
30+
31+
This example outputs to the console. It is supported by all platform. The commands to run this example are as follows:
32+
33+
.. code-block:: console
34+
35+
$ cd <embarc_root>/example/freertos/esp8266_wifi
36+
$ make BOARD=emsk BD_VER=22 CUR_CORE=arcem7d TOOLCHAIN=gnu run
37+
38+
39+
Sample Output
40+
=============
41+
42+
.. code-block:: console
43+
44+
-----------------------------------------------------------
45+
____ _ ____
46+
| _ \ _____ _____ _ __ ___ __| | __ ) _ _
47+
| |_) / _ \ \ /\ / / _ \ '__/ _ \/ _` | _ \| | | |
48+
| __/ (_) \ V V / __/ | | __/ (_| | |_) | |_| |
49+
|_| \___/ \_/\_/ \___|_| \___|\__,_|____/ \__, |
50+
|___/
51+
_ _ ____ ____
52+
___ _ __ ___ | |__ / \ | _ \ / ___|
53+
/ _ \ '_ ` _ \| '_ \ / _ \ | |_) | |
54+
| __/ | | | | | |_) / ___ \| _ <| |___
55+
\___|_| |_| |_|_.__/_/ \_\_| \_\\____|
56+
------------------------------------------------------------
57+
58+
embARC Build Time: Oct 17 2018, 15:25:42
59+
Compiler Version: Metaware, 4.2.1 Compatible Clang 4.0.1 (branches/release_40)
60+
=========================== Init ============================
61+
[at_parser_init]56: obj->psio 0x800062c0 -> 0x80000f28
62+
[at_send_cmd]83: command is NULL, send AT test command
63+
[at_send_cmd]117: at_out: "AT
64+
" (4)
65+
[at_get_reply]137: "AT
66+
67+
OK" (9)
68+
============================ Set Mode ============================
69+
[at_send_cmd]117: at_out: "AT+CWMODE_CUR?
70+
" (16)
71+
[at_get_reply]137: "
72+
AT+CWMODE_CUR?
73+
+CWMODE_CUR:1
74+
75+
OK" (38)
76+
CWMODE_CUR = 1
77+
[at_send_cmd]117: at_out: "AT+CWMODE_CUR=3
78+
" (17)
79+
[at_get_reply]137: "
80+
AT+CWMODE_CUR=3
81+
82+
OK" (24)
83+
============================ Connect WiFi ============================
84+
[at_send_cmd]117: at_out: "AT+CWLAP
85+
" (10)
86+
[at_get_reply]137: "
87+
AT+CWLAP
88+
+CWLAP:(3,"embARC",-61,"6a:ec:c5:cc:2f:3b",1,32767,0)
89+
+CWLAP:(5,"Synopsys",-91,"6c:f3:7f:a5:8a:e3",1,-49,0)
90+
+CWLAP:(0,"synopsys-guest",-81,"6c:f3:7f:a5:38:21",1,-47,0)
91+
+CWLAP:(5,"Synopsys",-81,"6c:f3:7f:a5:38:23",1,-47,0)
92+
+CWLAP:(3,"ClickShare-1871789077",-87,"28:24:ff:bf:2b:06",1,32767,0)
93+
+CWLAP:(0,"synopsys-guest",-91,"6c:f3:7f:a5:8a:e1",1,-47,0)
94+
+CWLAP:(5,"Synopsys",-86,"04:bd:88:5a:7c:42",6,-51,0)
95+
+CWLAP:(0,"synopsys-guest",-86,"04:bd:88:5a:7c:43",6,-51,0)
96+
+CWLAP:(0,"synopsys-guest",-73,"6c:f3:7f:a2:90:61",11,-54,0)
97+
+CWLAP:(5,"Synopsys",-71,"6c:f3:7f:a2:90:63",11,-56,0)
98+
+CWLAP:(3,"XKORAT - Mi",-71,"4c:49:e3:ba:95:80",11,-29,0)
99+
100+
OK" (731)
101+
Searching for WIFI "embARC" ......
102+
WIFI "embARC" found! Try to connect
103+
[at_send_cmd]117: at_out: "AT+CWMODE_CUR=1
104+
" (17)
105+
[at_get_reply]137: "
106+
AT+CWMODE_CUR=1
107+
108+
OK" (24)
109+
[at_send_cmd]117: at_out: "AT+CWJAP_CUR="embARC","qazwsxedc"
110+
" (35)
111+
[at_get_reply]137: "
112+
AT+CWJAP_CUR="embARC","qazwsxedc"
113+
WIFI DISCONNECT
114+
WIFI CONNECTED
115+
WIFI GOT IP
116+
117+
OK" (88)
118+
WIFI "embARC" connect succeed
119+
============================ Connect Server ============================
120+
[at_send_cmd]117: at_out: "AT+CIPMUX=1
121+
" (13)
122+
[at_get_reply]137: "
123+
AT+CIPMUX=1
124+
125+
OK" (20)
126+
[at_send_cmd]117: at_out: "AT+CIPSERVER=1,80
127+
" (19)
128+
[at_get_reply]137: "
129+
AT+CIPSERVER=1,80
130+
no change
131+
132+
OK" (37)
133+
============================ Show IP ============================
134+
[at_send_cmd]117: at_out: "AT+CIFSR
135+
" (10)
136+
[at_get_reply]137: "
137+
AT+CIFSR
138+
+CIFSR:STAIP,"192.168.137.96"
139+
+CIFSR:STAMAC,"5c:cf:7f:0c:27:d6"
140+
141+
OK" (83)
142+
============================ while ============================
143+
============================ send ============================
144+
145+
The message is:
146+
0,CONNECT
147+
1,CONNECT
148+
149+
+IPD,0,383:GET / HTTP/1.1
150+
Host: 192.168.137.96
151+
Connection: keep-alive
152+
Upgrade-Insecure-Requests: 1
153+
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36
154+
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
155+
Accept-Encoding: gzip, deflate
156+
Accept-Language: en-US,en;q=0.9
157+
158+
159+
Send Start
160+
[at_send_cmd]117: at_out: "AT+CIPSEND=0,44
161+
" (17)
162+
[at_get_reply]137: "AT+CIPSEND=0,44
163+
164+
OK" (22)
165+
[at_get_reply]137: "
166+
>
167+
Recv 44 bytes
168+
169+
SEND OK" (30)
170+
[at_send_cmd]117: at_out: "AT+CIPSEND=0,93
171+
" (17)
172+
[at_get_reply]137: "
173+
AT+CIPSEND=0,93
174+
175+
OK" (24)
176+
[at_get_reply]137: "
177+
>
178+
Recv 93 bytes
179+
" (21)
180+
[at_send_cmd]117: at_out: "AT+CIPSEND=0,93
181+
" (17)
182+
[at_get_reply]137: "AT+CIPSEND=0,93
183+
busy s...
184+
" (29)
185+
[at_send_cmd]117: at_out: "AT+CIPCLOSE=0
186+
" (15)
187+
[at_get_reply]137: "AT+CIPCLOSE=0
188+
busy s...
189+
190+
SEND OK" (36)
191+
Send Finish
192+

example/freertos/iot/lwm2m/lwm2m_client/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Buidling and Running
5757
$ cd <embarc_root>/example/freertos/iot/lwm2m/lwm2m_client
5858
$ make BOARD=emsk BD_VER=22 CUR_CORE=arcem7d TOOLCHAIN=gnu run
5959
60-
And here is command to run leshan server demo:
60+
And here is command to run leshan server demo:
6161

6262
.. code-block:: console
6363

example/freertos/iot/lwm2m/lwm2m_server/README.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ Buidling and Running
4242
$ cd <embarc_root>/example/freertos/iot/lwm2m/lwm2m_server
4343
$ make BOARD=emsk BD_VER=22 CUR_CORE=arcem7d TOOLCHAIN=gnu run
4444
45-
Once download the program to the board, you can run command ``main`` and ``lwm2m_server`` to start up a LwM2M server at default port 5683. You should also take note of server's IP address which will be used in next step. Once the server is up, run leshan client demo on your PC.
45+
Once download the program to the board, you can run command ``main`` and ``lwm2m_server`` to start up a LwM2M server at default port 5683. You should also take note of server's IP address which will be used in next step. Once the server is up, run leshan client demo on your PC.
4646

47-
And here is command to run leshan client demo, you need to change the ip address in command according to your lwm2m_server:
47+
And here is command to run leshan client demo, you need to change the ip address in command according to your lwm2m_server:
4848

4949
.. code-block:: console
5050
5151
java -jar leshan-client-demo.jar -u 192.168.137.237
5252
53-
Then, you could try out ``lwm2m_op`` command from server side, and also try to use 'w, a, s, d' keys to change the data from leshan client side
53+
Then, you could try out ``lwm2m_op`` command from server side, and also try to use 'w, a, s, d' keys to change the data from leshan client side
5454

5555
Sample Output
5656
=============

0 commit comments

Comments
 (0)