FSC-BW246 programming user guide¶
Introduction¶
Description¶
This design guide is suitable for engineers to develop FSC-BW246 Wi-Fi SoC module
Hardware Interface¶
GPIO
PWM
UART
SPI SLAVE
I2S Master/Slave
Analog Input/Output
Bluetooth¶
GATTS (Generic Attribute Profile LE-Peripheral role)
GATTC (Generic Attribute Profile LE-Central role)
Wi-Fi¶
TCP (Transmisson Control Protocol)
UDP (USER Datagram Protocol)
HTTP (Hypertext Transfer Protocol)
MQTT (Message Queuing Telemetry Transport)
Command Description¶
Command Format¶
All commands start with “AT” , end with <CR><LF>.
<CR> matches 0x0D in HEX format
<LF> matches 0x0A in HEX format
If commands have parameters, parameters should be put after = symbol.
If commands have multiple parameters, parameters should be separated by , symbol.
If there are response for the command ,the response start with <CR><LF> , end with <CR><LF>.
Error Code |
Meaning |
|---|---|
001 |
Failed |
002 |
Invalid parameter |
003 |
Invalid state |
004 |
Command mismatch |
005 |
Busy |
006 |
Command not supported |
007 |
Profile not turned on |
008 |
No memory |
Others |
Reserved for future use |
Module Default Settings¶
Wi-Fi Settings |
|
|---|---|
Wi-Fi Mode |
STA Mode |
Local AP SSID |
FSC-BW246-AP |
Local AP Password |
12345678 |
Local AP IP Address |
192.168.1.1 |
Port default Settings |
|
|---|---|
Baudrate |
921600bps |
Data Bits |
8 |
Parity |
None |
Stop Bits |
1 |
Commands Table¶
General Commands¶
AT - UART Test Command¶
Command |
AT |
Response |
OK |
Description |
Test whether the UART is working |
AT+VER - Read Firmware Version¶
Command |
AT+VER |
Response |
+VER=Param1,Param2 |
|
Module Type |
|
Firmware Version |
AT+BAUD - Read/Set UART Baudrate¶
Command |
AT+BAUD{=Param} |
|
2400/4800/9600/19200/38400/57600/115200/128000/
230400/256000/460800/512000/921600/1000000/1382400
2000000/3000000/4000000/5000000/6000000
|
Response |
+BAUD=Param |
|
All baudrates supported by current module |
Description |
Baudrate will be changed after module reboot |
AT+TPMODE-Read/Write Throughput Mode¶
Command |
AT+TPMODE{=Param} |
|
1:Enable
0:Disable
|
Response |
+TPMODE=Param |
|
Module’s current throughput mode |
Description |
When TCP/GATT profile connected and throughput mode is on,
the AT command will be de-active,
every byte received via physical UART will be sent to air, vice versa
|
AT+REBOOT-Software Reset¶
Command |
AT+REBOOT |
Response |
OK |
Description |
Module restore all factory settings then reboot |
AT+RESTORE-Restore Factory Setting¶
Command |
AT+RESTORE |
Response |
OK |
Description |
Module restore all factory settings then reboot |
AT+STAT-Read Connection Status¶
Command |
AT+STAT |
Response |
+STAT=Param1, Param2, Param3, Param4, Param5, Param6, Param7
OK
|
|
Param1:Connection Status under WIFI STA Module |
|
Param2:Connection Status as Tcp Server |
|
Param3:Connection Status as Tcp Client |
|
Param4:Connection Status in BLE Peripheral Mode |
|
Param5:Connection Status as SPP client |
|
Param6:Connection Status as HID client |
|
Param7:Connection Status as MQTT client |
Description |
0: uninitialized
1 :ready
2: connecting
3: connected
|
Bluetooth Command¶
AT+ADDR-Read Bluetooth MAC¶
Command |
AT+ADDR |
Response |
+ADDR=Param |
|
Bluetooth MAC address (12 Bytes ASCII) |
Description |
Only Read Supported |
AT+NAME-Read/Set Bluetooth BLE Name¶
Command |
AT+NAME{=Param1{,Param2}} |
|
BLE local name(1~25 Bytes ASCII) |
|
MAC address suffix(0/1,default:1)
0-Disable suffix
1-Enable suffix “-XXXX” (lower 4 bytes of MAC address) after local name
|
Response |
+NAME=Param |
Description |
Baudrate will be changed after module reboot |
AT+GATTSEND-Send BLE Data in Peripheral Mode¶
Command |
AT+GATTSEND=Param1,Param2 |
|
Payload length (1~999) |
|
Payload (1~999 Bytes UTF8) |
Response |
|
Description |
Data’s length should be less than 1000 |
AT+DSCA-Disable Connection with GATT¶
Command |
AT+DSCA |
Response |
OK |
Description |
Disable Connection with GATT |
Wi-Fi Command¶
AT+ROLE-Read/Set Wi-Fi module¶
Command |
AT+ROLE{=Param} |
|
Param: 1 STA module
Param: 2 AP module
Param: 3 STA+AP Concurrent Mode
|
Response |
+ROLE=Param
>> OK
|
Description |
Module will automatically reboot after setting |
AT+SCAN-Scan Surrounding APs¶
Command |
AT+SCAN=5(Scan Surrounding APs) |
Response |
+SCAN=Param1,Param2,Param3,Param4,Param5,Param6 |
|
**Param1:Scan the serial number ** |
|
Param2:constant number, represent scanning Wi-Fi mode |
|
Param3:AP’s address code |
|
Param4:Ssignal value between module and AP |
|
Param5:the length of the AP’s name |
|
Param6:APs’ name |
Description |
When scanning the surrounding APs,moduble should in STA module,means +ROLE=1 |
AT+RAP-Connect to the AP¶
Command |
AT+RAP=<Param1>,<Param2>
|
|
Param1:AP’s name |
|
Param2:AP’s password |
Response |
OK |
Description |
1. Need to send this command with the module in STA or Concurrent Mode, which means +ROLE=1 or 3.
2. The default Encryption method for the module connecting AP is WPA2.
3. If the AP does not need the password,only Param1 is needed, for example:
AT+RAP=Feasycom
4. Sending AT+RAP to the module can check the AP’s name and password.
|
AT+LIP-Read the IP Address¶
Command |
AT+LIP |
Response |
+LIP=Param
OK
|
|
IP address |
Description |
An IP address will be received when the module connecting to the AP,
or the command return “0.0.0.0”.
|
AT+DHCP-Read/Set IP Distribution Mode¶
Command |
AT+DHCP{==Param}
|
|
Param0:0:Use Static IP
Param1:1:Use Dynamic IP
|
Response |
+DHCP=Param
OK
|
Description |
Module will automatically reboot after setting
|
AT+SIP-Read/Set Static IP address¶
Command |
AT+SIP==Param
|
|
Param:IP address |
Response |
+SIP=Param
OK
|
Description |
Set before connecting to the AP and IP Distribution Mode should be Static.
(+DHCP = 0)
|
AT+GW-Read/Set GateWay¶
Command |
AT+GW==Param
|
|
Param:GateWay |
Response |
+GW=Param
OK
|
Description |
Set before connecting to the AP and IP Distribution Mode should be Static.
(+DHCP = 0)
|
AT+MASK-Read/Set Subnet Mask¶
Command |
AT+MASK==Param
|
|
Param:Subnet Mask |
Response |
+MASK=Param
OK
|
Description |
Set before connecting to the AP and IP Distribution Mode should be Static.
(+DHCP = 0)
|
AT+APAC-Read/Set Automatically Connect to AP¶
Command |
AT+APAC==Param
|
|
Param0:0: Disable
Param1: 1: Enable
|
Response |
+APAC=Param
OK
|
Description |
This command works at STA Mode.
|
AT+RSSI-Read Signal Strength Between Module And AP¶
Command |
AT+RSSI |
Response |
+RSSI=Param |
|
Param(-99~0)
OK
|
Description |
The result of RSSI is 0 when disconnect from AP. |
AT+MAC-Read Wi-Fi Mac address¶
Command |
AT+MAC |
|
Wi-Fi Mac address |
Response |
+MAC=Param
OK
|
Description |
Wi-Fi can only be read,not be written. |
AT+SCFG-Simple Config¶
Command |
AT+SCFG=Param |
|
Param:1 :Start Simple Config |
Response |
OK |
Description |
Should be used with FeasyWiFi. |
AT+LAP-Read/Write AP Mode¶
Command |
AT+LAP=<Param1>,<Param2>,<Param3> |
|
Param1:Name of the module as a AP |
|
Param2:Password of the module as a AP |
|
Param3: IP address of the module as a AP |
Response |
+LAP=<Param1>,<Param2>,<Param3>
OK
|
Description |
If the module is configured as a AP with OPEN encryption,
no need to set the Param2,
|
TCP Command¶
AT+SOCK-Read/Set SOCKET(TCP,UDP)¶
Command |
AT+SOCK=<Param1>,<Param2>,<Param3>,<Param4> |
|
Param1:Protocol Type(TCP,UDP,SSL) |
|
Param2:Protocol Type |
|
Param3:Remote Address |
|
Param4:Remote Port |
Response |
+SOCK=Param1,Param2,Param3,Param4
OK
|
Description |
1.The TCP SERVER is enabled after power on.
Param3 and Param4 can be omitted if module works as a TCP Server.
|
AT+WLANC-Start Socket¶
Command |
AT+WLANC=3 |
Response |
OK |
示例 |
<< AT+WLANC=3
>> OK
|
Description |
This command should be used after AT+SOCK command.
|
AT+WFSEND-Send SOCKET Data to Remote Device¶
Command |
AT+WFSEND=<Param1>,<Param2>,<Param3>
|
|
Param1:TCP/UDP Connection ID
|
|
Param2:Data length
|
|
Param3:Data context
|
Response |
OK
|
Description |
When the module is used as TCP server, it can be connected by 3 remote clients
and connection ID is 0,1,2;
When the module is used as TCP client, the ID is 3;
When the module is UDP, the ID is 4.
such as the MAXCON is 6, the ID as TCP Server is 0 ~ 5,
and the ID as the TCP Client is 6, the ID as UDP is 7.
|
AT+DISC-Close Connection with Socket¶
Command |
AT+DISC |
Response |
OK |
示例 |
<< AT+DISC
>> OK
|
Description |
Module disable the connection with remote device |
HTTP Command¶
AT+HTTP-Access the HTTP Server¶
Command |
AT+HTTP=Param1,Param2,Param3{,Param4} |
|
HTTP Request Method, only support GET and POST (GET do not nedd Param4) |
|
Host |
|
server’s URI |
|
Post data |
Response |
OK
Data
|
Description |
Using Http to access,sending AT+HTTP |
MQTT Command¶
AT+BROKER-Read/Set MQTT broker¶
Command |
AT+BROKER{=Param} |
|
MQTT server address |
Response |
+BROKER=Param |
AT+CLIENTID - Read/Set MQTT client ID¶
Command |
AT+CLIENTID{=Param} |
|
MQTT Client ID |
Response |
+CLIENTID=Param |
AT+USERNAME-Read/Write MQTT username¶
Command |
AT+USERNAME{=Param} |
|
MQTT USERNAME |
Response |
+USERNAME=Param |
AT+MQTTPWD-Read/Set MQTT password¶
Command |
AT+MQTTPWD{=Param} |
|
MQTT Password |
Response |
+MQTTPWD=Param |
AT+SUBTPC-Subscribe MQTT Topic¶
Command |
AT+SUBTPC=<Param1>,<Param2> |
|
Param1: topic |
|
Param2: QoS |
Response |
OK |
AT+UNSUBTPC-Unsubscribe Specify MQTT Topic¶
Command |
AT+UNSUBTPC=Param |
|
Unsubscribe Specify MQTT Topic |
Response |
OK |
AT+MQTTSEND-Send MQTT Data¶
Command |
AT+MQTTSEND=Param1,Param2,Param3 |
|
Publish Topic |
|
QOS(0,1,2) |
|
Data content |
Response |
OK |
AT+MQTTMODE-Read/Set MQTT mode¶
Command |
AT+MQTTMODE{=Param} |
|
0: Connect to general MQTT Server(default)
1: Connect to Ali Cloud Platform
2: Connect to QCloud Platform(Tencent)
|
Response |
OK |
Description |
Module connects to different cloud platforms by switching MQTT modes |
Cloud Platform Command¶
AT+DEVNAME-Read/Set device name¶
Command |
AT+DEVNAME{=Param} |
|
Device Name |
Response |
+DEVNAME=Param |
AT+PROKEY-Read/Set product key¶
Command |
AT+PROKEY{=Param} |
|
Product Key |
Response |
+PROKEY=Param |
AT+DEVSECRET-Read/Set device secret¶
Command |
AT+DEVSECRET{=Param} |
|
Device Secret |
Response |
+DEVSECRET=Param |
AT+WLANC-Connect to the Cloud Platform¶
指令 |
AT+WLANC=4 |
Respond |
OK |
说明 |
Only works when connecting with Cloud Platform |
AT Commands Application Scenarios¶
TCP server Application¶
Note
Throughput Mode should be set before setting Wi-Fi mode using AT+TPMODE=1.
TCP Client Application¶
Note
Throughput Mode should be set before setting Wi-Fi mode using AT+TPMODE=1.
UDP Application¶
Note
Throughput Mode should be set before setting Wi-Fi mode using AT+TPMODE=1.
Ali Cloud Platform Application¶
Switch Throughput Mode to Command Mode¶
Note
The above data format is different from the normal AT command which ends with <CR><LF>
The above data does not have any terminator attached
Network Configuration and OTA¶
OTA by AT Command¶
Note
The firmware is stored in the specific server and the upgrade mode can be changed as required by customers
Module needs to access the Internet,otherwise it will fail
OTA by FeasyWiFi APP¶
Note
Module needs to access the Internet,otherwise it will fail