13
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ESP-WROOM-02: ATコマンドによるWifi動作確認

Last updated at Posted at 2016-12-23

ESPRESSIF公式ドキュメント (ESP-WROOM-02 & ESP8266)
http://espressif.com/en/support/download/documents

動作確認

デフォルトFWのシリアル設定

  • 115200bps, 8N1
  • 改行コード: RX=CR, TX=CR+LF

※ 起動直後は76800bps でboot logが出力される.

 ets Jan  8 2013,rst cause:1, boot mode:(3,0)

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: 8Mbit(512KB+512KB)
jump to run user1 @ 1000


SDK

ATコマンド動作確認

ATコマンド詳細は ESP8266 AT Instruction Set を確認.

AT+GMR
AT version:0.40.0.0(Aug  8 2015 14:45:58)
SDK version:1.3.0
compile time:Aug 11 2015 17:02:18
OK

macの確認

AT+CIPSTAMAC?
+CIPSTAMAC:"xx:xx:xx:xx:xx:xx"

OK

station modeにしてAPのリスト取得

AT+CWMODE=1
OK
AT+CWMODE?
+CWMODE:1

AT+CWLAP
+CWLAP:(<ecn>, <ssid>, <rssi>, <mac>, <ch>, <freq offset>, <freq calibration>)
+CWLAP:(<ecn>, <ssid>, <rssi>, <mac>, <ch>, <freq offset>, <freq calibration>)

<ecn>
0 : OPEN
1 : WEP
2 : WPA_PSK
3 : WPA2_PSK
4 : WPA_WPA2_PSK
5 : WPA2_Enterprise)

AP に接続

AT+CWJAP="ssid","passwd"
WIFI CONNECTED
WIFI GOT IP

OK
AT+CWJAP?
+CWJAP:"ssid","xx:xx:xx:xx:xx:xx",<channel>,<rssi>

OK
AT+CIFSR
+CIFSR:STAIP,"192.168.11.xx"
+CIFSR:STAMAC,"xx:xx:xx:xx:xx:xx"

OK

適当なwebサーバにTCPコネクションを張ってみる

AT+CIPSTART="TCP","192.168.11.1",80
CONNECT
OK
AT+CIPMODE=1    # 1:UART-WiFi passthrough mode
OK
AT+CIPSEND
OK
>

この状態で例えば下記のようにGETを送信するとresponseが返ってくる.(うまく動作しないときは先に telnet で試すとよいかも)

GET / HTTP/1.0

AT+CIPSEND使い方については, 4b-esp8266_at_command_examples_en.pdf 参照

AT+CIPSENDからは,"+++"で抜けれるが,keyboardでタイプしてもダメ.コピーして貼り付けなどで,ターミナルに一気に送信すること.

TCPを切断.(放っておいても切れる)

AT+CIPCLOSE
CLOSED

AP切断

AT+CWQAP

OK
WIFI DISCONNECT
13
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?