FSC-BW246 programming user guide

Introduction

[Chinese]

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

AT+Command{=Param1{,Param2{,Param3…}}}<CR><LF>
  • 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

Example:
<< AT
>> OK

AT+VER - Read Firmware Version

Command

AT+VER

Response

+VER=Param1,Param2

Param1

Module Type

Param2

Firmware Version

Example:
<< AT+VER
>> +VER=FSC-BW236,V4.2.5
>> OK

AT+BAUD - Read/Set UART Baudrate

Command

AT+BAUD{=Param}

Param

2400/4800/9600/19200/38400/57600/115200/128000/
230400/256000/460800/512000/921600/1000000/1382400
2000000/3000000/4000000/5000000/6000000

Response

+BAUD=Param

Param

All baudrates supported by current module

Description

Baudrate will be changed after module reboot

Example:
Read baudrates
<< AT+BAUD
>> +BAUD=115200
>> OK

Set baudrates
<< AT+BAUD=9600
>> OK

AT+TPMODE-Read/Write Throughput Mode

Command

AT+TPMODE{=Param}

Param

1:Enable
0:Disable

Response

+TPMODE=Param

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
Example:
Read current Throughput Mode
<< AT+TPMODE
>> +TPMODE=0
>> OK
Enable Throughput Mode
<< AT+TPMODE=1
>> OK

AT+REBOOT-Software Reset

Command

AT+REBOOT

Response

OK

Description

Module restore all factory settings then reboot

Example:
Reset Software
<< AT+REBOOT
>> OK

AT+RESTORE-Restore Factory Setting

Command

AT+RESTORE

Response

OK

Description

Module restore all factory settings then reboot

Example:
Restore Module to Factory Setting
<< AT+RESTORE
>> OK

AT+STAT-Read Connection Status

Command

AT+STAT

Response

+STAT=Param1, Param2, Param3, Param4, Param5, Param6, Param7
OK

Param1

Param1:Connection Status under WIFI STA Module

Param2

Param2:Connection Status as Tcp Server

Param3

Param3:Connection Status as Tcp Client

Param4

Param4:Connection Status in BLE Peripheral Mode

Param5

Param5:Connection Status as SPP client

Param6

Param6:Connection Status as HID client

Param7

Param7:Connection Status as MQTT client

Description

0: uninitialized
1 :ready
2: connecting
3: connected
Example:Read Current Status
<< AT+STAT
>> +STAT=0,1,3,1,0,0,0
>> OK

Bluetooth Command

AT+ADDR-Read Bluetooth MAC

Command

AT+ADDR

Response

+ADDR=Param

Param

Bluetooth MAC address (12 Bytes ASCII)

Description

Only Read Supported

Example:
Read module’s le Mac address
<< AT+ADDR
>> +ADDR/LEADDR=DC0D30010203
>> OK

AT+NAME-Read/Set Bluetooth BLE Name

Command

AT+NAME{=Param1{,Param2}}

Param1

BLE local name(1~25 Bytes ASCII)

Param2

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

Example:Read Bluetooth BLE Name
<< AT+NAME
>> +NAME=FSC-BW246
>> OK

Example:
Set Bluetooth BLE Name as “FSC-BW246”
<< AT+NAME=FSC-BW246
>> OK
Set Bluetooth BLE Name as “ABC” and add MAC address suffix
<< AT+NAME/LENAME=ABC,1
>> OK

AT+GATTSEND-Send BLE Data in Peripheral Mode

Command

AT+GATTSEND=Param1,Param2

Param1

Payload length (1~999)

Param2

Payload (1~999 Bytes UTF8)

Response

**OK: **
**ERR002:Problems in parameters or format **
ERR003:Bluetooth is not connected

Description

Data’s length should be less than 1000

Example:
Send “123” to remote BLE Device
<< AT+GATTSEND=3,123
>> OK

AT+DSCA-Disable Connection with GATT

Command

AT+DSCA

Response

OK

Description

Disable Connection with GATT

Example:
<< AT+DSCA
>> OK

Wi-Fi Command

AT+ROLE-Read/Set Wi-Fi module

Command

AT+ROLE{=Param}

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

Example:
Read Wi-Fi module
<< AT+ROLE
>> +MODE=1
>> OK
Example:
Set Wi-Fi module to AP
<< AT+MODE=2
>>OK

AT+SCAN-Scan Surrounding APs

Command

AT+SCAN=5(Scan Surrounding APs)

Response

+SCAN=Param1,Param2,Param3,Param4,Param5,Param6

Param1

**Param1:Scan the serial number **

Param2

Param2:constant number, represent scanning Wi-Fi mode

Param3

Param3:AP’s address code

Param4

Param4:Ssignal value between module and AP

Param5

Param5:the length of the AP’s name

Param6

Param6:APs’ name

Description

When scanning the surrounding APs,moduble should in STA module,means +ROLE=1

Example:
Scan Surrounding APs
<< AT+SCAN=5
>> +SCAN=1,5,F0B4292428F0,-42,18,Feasycom_D710_2.4G
>> +SCAN=2,5,F0B4292428F1,-44,16,Feasycom_D710_5G
>> +SCAN=3,5,98BB991F6B45,-48,14,GOCLOUD_1F6B46

AT+RAP-Connect to the AP

Command

AT+RAP=<Param1>,<Param2>

Param1

Param1:AP’s name

Param2

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.
Example
Connect to the AP
<< AT+RAP=Feasycom,12345678
>> OK

AT+LIP-Read the IP Address

Command

AT+LIP

Response

+LIP=Param
OK

Param

IP address

Description

An IP address will be received when the module connecting to the AP,
or the command return “0.0.0.0”.
Example
Read the IP Address
<< AT+LIP=192.168.1.100
OK

AT+DHCP-Read/Set IP Distribution Mode

Command

AT+DHCP{==Param}

Param

Param0:0:Use Static IP
Param1:1:Use Dynamic IP

Response

+DHCP=Param
OK

Description

Module will automatically reboot after setting
Example
Set IP Distribution Mode to static
<<AT+DHCP = 1
>>OK
Example
Read IP Distribution Mode
<< AT+DHCP
>> +DHCP=1
>>OK

AT+SIP-Read/Set Static IP address

Command

AT+SIP==Param

Param

Param:IP address

Response

+SIP=Param
OK

Description

Set before connecting to the AP and IP Distribution Mode should be Static.
(+DHCP = 0)
Example:
Read static IP address
<< AT+SIP
>> +SIP=192.168.1.200
>> OK
Example:
Set Static IP address to 192.168.1.200
<< AT+SIP=192.168.1.200
>> OK

AT+GW-Read/Set GateWay

Command

AT+GW==Param

Param

Param:GateWay

Response

+GW=Param
OK

Description

Set before connecting to the AP and IP Distribution Mode should be Static.
(+DHCP = 0)
Example:
Read Gateway
<< AT+GW
>> +GW=192.168.1.1
>> OK
Example:
Set Gateway to 192.168.1.1
<< AT+GW=192.168.1.1
>> OK

AT+MASK-Read/Set Subnet Mask

Command

AT+MASK==Param

Param

Param:Subnet Mask

Response

+MASK=Param
OK

Description

Set before connecting to the AP and IP Distribution Mode should be Static.
(+DHCP = 0)
Example:
Read Subnet Mask
<< AT+MASK
>> +MASK=255.255.255.0
>> OK
Example:
Set Subnet Mask to 255.255.255.0
<< AT+MASK=255.255.255.0
>> OK

AT+APAC-Read/Set Automatically Connect to AP

Command

AT+APAC==Param

Param

Param0:0: Disable
Param1: 1: Enable

Response

+APAC=Param
OK

Description

This command works at STA Mode.
Example:
Read Whether Automatically Connect to AP Function is Enabled
<< AT+APAC
>> +APAC=1
>> OK
Example:
Enable Automatically Connect to AP Function
<< AT+APAC=1
>> OK

AT+RSSI-Read Signal Strength Between Module And AP

Command

AT+RSSI

Response

+RSSI=Param

Param

Param(-99~0)
OK

Description

The result of RSSI is 0 when disconnect from AP.

Example
Read RSSI
<< AT+RSSI
>> +RSSI=-55
>> OK

AT+MAC-Read Wi-Fi Mac address

Command

AT+MAC

Param

Wi-Fi Mac address

Response

+MAC=Param
OK

Description

Wi-Fi can only be read,not be written.

Example
Read Wi-Fi Mac address
<< AT+MAC
>> +MAC=DC0D80600001
>> OK

AT+SCFG-Simple Config

Command

AT+SCFG=Param

Param

Param:1 :Start Simple Config

Response

OK

Description

Should be used with FeasyWiFi.

Example
<< AT+SCFG=1
>> OK

AT+LAP-Read/Write AP Mode

Command

AT+LAP=<Param1>,<Param2>,<Param3>

Param1

Param1:Name of the module as a AP

Param2

Param2:Password of the module as a AP

Param3

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,

Example
Read Ap Mode Configuration
<< AT+SCFG=1
>> OK
<< AT+LAP
>>+LAP=FSC-BW236-AP,12345678,192.168.1.1
Example
Set Ap Mode
<<AT+LAP=FSC-BW236-AP,12345678,192.168.1.1
>> OK

TCP Command

AT+SOCK-Read/Set SOCKET(TCP,UDP)

Command

AT+SOCK=<Param1>,<Param2>,<Param3>,<Param4>

Param1

Param1:Protocol Type(TCP,UDP,SSL)

Param2

Param2:Protocol Type

Param3

Param3:Remote Address

Param4

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.
Example:
Read SOCKET Configuration
<< AT+SOCK
>> +SOCK=TCPS,9100,0.0.0.0,0
>> OK
Module works as TCP Server, local port is 8080
<< AT+SOCK=TCPS,8080
>> OK
Module works as TCP client, local port is 8080,remote server address is “192.168.0.224”,remote server port is 6000
<< AT+SOCK=TCPC,8080,192.168.0.224,6000
>> OK
Module works as UDP,local port is 4000
<< AT+SOCK=UDP,4000
>> OK

AT+WLANC-Start Socket

Command

AT+WLANC=3

Response

OK

示例

<< AT+WLANC=3
>> OK

Description

This command should be used after AT+SOCK command.
Example
Start Socket
<< AT+WLANC=3
>> OK

AT+WFSEND-Send SOCKET Data to Remote Device

Command

AT+WFSEND=<Param1>,<Param2>,<Param3>

Param1

Param1:TCP/UDP Connection ID

Param2

Param2:Data length

Param3

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.
Example:
Send data to TCP Client
<< AT+WFSEND=0,3,123
>> OK
Send data to TCP Server
<< AT+WFSEND=3,3,123
>> OK
Send data to UDP
<< AT+WFSEND=4,3,123
>> OK

AT+DISC-Close Connection with Socket

Command

AT+DISC

Response

OK

示例

<< AT+DISC
>> OK

Description

Module disable the connection with remote device

Example
<< AT+DISC
>> OK

HTTP Command

AT+HTTP-Access the HTTP Server

Command

AT+HTTP=Param1,Param2,Param3{,Param4}

Param1

HTTP Request Method, only support GET and POST (GET do not nedd Param4)

Param2

Host

Param3

server’s URI

Param4

Post data

Response

OK
Data

Description

Using Http to access,sending AT+HTTP

Example:
Access Baidu and read all the data
<< AT+HTTP=GET,www.baidu.com,/
>> OK
>> {Data}

Example:
Send param1=test_data1&param2=test_data2 to http://httpbin.org/post
<< AT+HTTP=POST,httpbin.org,/post,param1=test_data1&param2=test_data2
>> OK
>> {Data}

MQTT Command

AT+BROKER-Read/Set MQTT broker

Command

AT+BROKER{=Param}

Param

MQTT server address

Response

+BROKER=Param

Example:
Read MQTT broker
<< AT+BROKER
>> +BROKER=gpssensor.ddns.net
>> OK
Set MQTT broker
<< AT+BROKER=gpssensor.ddns.net
>> OK

AT+CLIENTID - Read/Set MQTT client ID

Command

AT+CLIENTID{=Param}

Param

MQTT Client ID

Response

+CLIENTID=Param

Example:
Read MQTT Client ID
<< AT+CLIENTID
>> +CLIENTID=user
>> OK

Example:
Set MQTT Client ID
<< AT+CLIENTID=447a74ab3e60494e8c97dad36b00399b
>> OK

AT+USERNAME-Read/Write MQTT username

Command

AT+USERNAME{=Param}

Param

MQTT USERNAME

Response

+USERNAME=Param

Example:
Read MQTT USERNAME
<< AT+USERNAME
>> +USERNAME=admin
>> OK
Write MQTT USERNAME
<< AT+USERNAME=admin
>> OK

AT+MQTTPWD-Read/Set MQTT password

Command

AT+MQTTPWD{=Param}

Param

MQTT Password

Response

+MQTTPWD=Param

Example:
Read MQTT MQTTPWD
<< AT+MQTTPWD
>> +MQTTPWD=12345678
>> OK
Write MQTT Password
<< AT+MQTTPWD=12345678
>> OK

AT+SUBTPC-Subscribe MQTT Topic

Command

AT+SUBTPC=<Param1>,<Param2>

Param1

Param1: topic

Param2

Param2: QoS

Response

OK

Example:
Set MQTT TOPIC
<< AT+SUBTPC=/fsc/bw236/test,2
>> OK

AT+UNSUBTPC-Unsubscribe Specify MQTT Topic

Command

AT+UNSUBTPC=Param

Param

Unsubscribe Specify MQTT Topic

Response

OK

Example:
<< AT+UNSUBTPC=/fsc/bw236/down
>> OK

AT+MQTTSEND-Send MQTT Data

Command

AT+MQTTSEND=Param1,Param2,Param3

Param1

Publish Topic

Param2

QOS(0,1,2)

Param3

Data content

Response

OK

Example:
<< AT+MQTTSEND=fsc/bw236/get,0,3,abc
>> OK

AT+MQTTMODE-Read/Set MQTT mode

Command

AT+MQTTMODE{=Param}

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

Example:
<< AT+MQTTMODE
>> +MQTTMODE=0
>> OK

Cloud Platform Command

AT+DEVNAME-Read/Set device name

Command

AT+DEVNAME{=Param}

Param

Device Name

Response

+DEVNAME=Param

Example:
Read Device Name
<< AT+DEVNAME
>> +DEVNAME=printer
>> OK

Example:
Set Device Name
<< AT+DEVNAME=printer
>> OK

AT+PROKEY-Read/Set product key

Command

AT+PROKEY{=Param}

Param

Product Key

Response

+PROKEY=Param

Example:
Read Product Key
<< AT+PROKEY
>> +PROKEY=a1jdkjfuh
>> OK
Set Product Key
<< AT+PROKEY=a1jdkjfuh
>> OK

AT+DEVSECRET-Read/Set device secret

Command

AT+DEVSECRET{=Param}

Param

Device Secret

Response

+DEVSECRET=Param

Example:
Read Device Secret
<< AT+DEVSECRET
>> +DEVSECRET=15kjdfydfhnflh
>> OK
Set Device Secret
<< AT+DEVSECRET=15kjdfydfhnflh
>> OK

AT+WLANC-Connect to the Cloud Platform

指令

AT+WLANC=4

Respond

OK

说明

Only works when connecting with Cloud Platform

Example:
<< AT+WLANC=4
>> OK

AT Commands Application Scenarios

TCP server Application

1、Set Wi-Fi Mode to STA
Send:<<AT+ROLE=1
Respond:>> OK
2、Connect to AP
Send:<< AT+RAP=ssid,password
Respond: > OK
3. Query the module’s IP:
Send:<< AT+LIP
Respond:>> +LIP=192.168.0.97
>> OK
4、Set module to TCP server with port 9100
Send:<< AT+SOCK=TCPS,9100
Respond:>> OK
5、Start TCP Server
Send:<< AT+WLANC=3
Respond:>> OK
6、PC and module Connect to the same AP, using network debugging tools on PC as TCP client connect to the module
.. image:: /image/example1.png
7、Receive Data
<< +WFDATA=0,10,1234567890
<< +WFDATA=1,10,1234567890
<< +WFDATA=2,10,1234567890
8、Send Data
Send:<< AT+WFSEND=0,3,abc
Respond:<< OK

Note

  • Throughput Mode should be set before setting Wi-Fi mode using AT+TPMODE=1.

TCP Client Application

1.Set Wi-Fi Mode to STA
Send:<< AT+ROLE=1
Respond:>> OK
2、Connect to AP
Send:<< AT+RAP=ssid,password
Respond:>> OK
3、Query the IP address
Send:<< AT+LIP
Respond:>> +LIP=192.168.0.87
>> OK
4、PC and module Connect to the same AP, using network debugging tools on PC to create a TCP server
For example: IP is 192.168.0.79 and port is 8080
5、Set the module to TCP client with remote IP and Port number
Send:<< AT+SOCK=TCPC,9100,192.168.0.79,8080
Respond:>> OK
6、Start ths TCP client
Send:<< AT+WLANC=3
Respond:>> OK
_images/example2.png
7、Receiving Data
Send:<< +WFDATA=3,10,1234567890
Respond:<< OK

Note

  • Throughput Mode should be set before setting Wi-Fi mode using AT+TPMODE=1.

UDP Application

1. Set Wi-Fi Mode to STA
Send:<< AT+ROLE=1
Respond:>> OK
2、Connect to AP
Send:<< AT+RAP=ssid,password
Respond:>> OK
3、Query the IP address
Send:<< AT+LIP
Respond:>> +LIP=192.168.0.87
>> +LIP=192.168.0.87
4、Set module as UDP
Send:<< AT+SOCK=UDP,4000
Respond:>> OK
5、Start UDP Server
Send:<< AT+WLANC=3
Respond:>> OK
6、PC and module Connect to the same AP, using network debugging tools on PC to create an UDP client
Target IP is 192.168.0.97 and port is 4000
7、Receiving data
<< +WFDATA=4,10,1234567890
8.Sending data
Send:<< AT+WFSEND=6,3,abc
Respond:<< OK

Note

  • Throughput Mode should be set before setting Wi-Fi mode using AT+TPMODE=1.

Ali Cloud Platform Application

1. Set Wi-Fi Mode to STA
Send:<< AT+ROLE=1
Respond:>> OK
2、Connect to AP
Send:<< AT+RAP=ssid,password
Respond:>> OK
3、Query the IP address
Send:<< AT+LIP
Respond:>> +LIP=192.168.0.87
>> +LIP=192.168.0.87
4、Set MQTT mode to connect Ali Cloud
Send:<< AT+MQTTMODE=1
Respond:>> OK
5、Set Device Name
Send:<< AT+DEVNAME=printer
Respond:>> OK
6. Set Product Key
Send:<< AT+PROKEY=a1JK0xBtGYW
Respond:>> OK
7. Set Device Secret
Send:<< AT+DEVSECRET=15WwVf3CrcVClTYvL4kxl1E4fumUPwcE
Respond:>> OK
8、 Initiates a connection
Send:<< AT+WLANC=4
Respond:>> OK
9. Connect to Ali
Send:<< AT+SUBTPC=/a1JKOxBtGYW/printer/user/get
Respond:>> OK
10. Receive Data
1234567890
11.Send Data
Send:<< AT+MQTTSEND=/a1JKOxBtGYW/printer/user/get,0,abc
Respond:>> OK

Switch Throughput Mode to Command Mode

Specific Instruction Process Description
Specific Instruction Process Description
The module provides a way to exit the Throughput Mode to send command
<< +++
<< a
>> a
>> +ok

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

OTA by AT Command
1、Switch to STA Mode.
<< AT+ROLE=1
>> OK
2、Switch to STA Mode.
<< AT+RAP=ssid,password
>> OK
3、Query the IP address to check whether AP is connected
<< AT+LIP
>> +LIP=192.168.0.87
4、Query the IP address to check whether AP is connected
<< AT+OTA=Feasycom_V555
>> OK
>> $OTA=1

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

Specific Instruction Process Description
1、Download FeasyWiFi APP from APP STORE or GOOGLE PLAY
2、Enter the APP interface , search and connect to the target module
_images/example3.png
2、After correct connection, it will jump to the following interface:
_images/example4.png
3、Enter the AP’s SSID and password on the BLE Network page, then click the Start Network Config button
_images/example5.png
4、Return to the previous page after the network configuration is successful,
choose OTA upgrade, enter firmware name then click the Upgrade button
_images/example6.png

Note

  • Module needs to access the Internet,otherwise it will fail

Appendix

Download PDF Version