FSC-BW256 Programming user guide

Introduction

[中文版]

Description

This design guide is intended for engineers developing BW256 Wi-Fi SoC modules

Hardware description

Pin diagram

_images/BW256_pin_map.png

Pin Description

Pin

Pin Name

Type

Pin Descriptions

1

UART_TX

O

Serial port TX

2

UART_RX

I

Serial port RX

3

UART_CTS

I

Serial port flow control pin(High effective)

4

UART_RTS

O

Serial port flow control pin(High effective)

9

UART_LOG_OUT

O

Module debugging serial port TX

10

UART_LOG_IN

I

Module debugging serial port RX

11

Pwrkey

I/O

power key

12

VDD_3V3

VDD

3.3V power supply

13

GND

VSS

Ground connection

21

GND

VSS

Ground connection

22

GND

VSS

Ground connection

32

LED0

I/O

Bluetooth is connected to output high

33

LED1

I/O

Wi-Fi is connected to output high level

35

GND

VSS

Ground connection

36

EXT_ANT

ANT

antenna

Hardware Design Notes

  • Simple module testing only needs to connect VDD/GND/UART_RX/UART_TX

  • The programming manual provides only a simple description of the IO port. For more detailed instructions and precautions, please refer to the design document

  • After drawing the schematic, please send it to Feiyitong for review to avoid the Bluetooth or Wi-Fi distance is not optimal

Hardware interface

  • GPIO

  • PWM

  • UART

  • SPI SLAVE

  • I2S Master/Slave

  • Analog Input/Output

Support Bluetooth protocol

  • SPP Client (Serial Port Profile)

  • SPP Server (Serial Port Profile)

  • GATT Server (Generic Attribute Profile)

Supports the Wi-Fi protocol

  • TCP (Transmisson Control Protocol)

  • UDP (USER Datagram Protocol)

  • HTTP (Hypertext Transfer Protocol)

  • MQTT (Message Queuing Telemetry Transport)

  • WEBSOCKET

Module default parameter

Wi-Fi default Settings

Wi-Fi Mode

STA Mode

Local AP SSID

FSC-BW256-AP

Local AP Password

12345678

Local AP IP Address

192.168.1.1

Bluetooth default Settings

BLE Name

FSC-BW256-LE

BLE Mode

LE-Peripheral

SPP Name

FSC-BW256

SPP PAIRCODE

0000

Serial port default Settings

Baudrate

921600bps

Data Bits

8

Parity

None

Stop Bits

1

Commands Table

Specification

Applies to the entire document

  • {} : Content between {} is optional

  • << : Content behind << represents a COMMAND from Host

  • >> : Content behind >> represents a RESPONSE/EVENT to Host

Instruction format

AT+Command{=Param1{,Param2{,Param3…}}}<CR><LF>
  • All commands start with “AT”, end with <CR><LF>

  • <CR> means “carriage return”, corresponds to hex value 0x0D

  • <LF> means “line feed”, corresponds to hex value 0x0A

  • If Command has Parameter, Parameter follows behind ‘=’

  • If Command has multiple Parameters, Parameter must be separated by ‘,’

  • If Command has Response, Response starts with <CR><LF>, ends with <CR><LF>

  • Module will always report command’s execution result by using OK for success or ERR<code> for failure

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

Event format

<CR><LF>+Indication{=Param1{,Param2{,Param3…}}}<CR><LF>
  • All events start with <CR><LF> and end with <CR><LF>

  • If the event contains parameters, the parameters should come after “=”

  • If the event contains multiple parameters, the parameters should be split with “,”

Example:
Mobile phone sends “1234567890” through GATT
>> +GATTDATA=10,1234567890

General Commands

AT - Serial port test instruction

Command

AT

Response

OK

Description

Use the AT command to test whether the serial communication is normal

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-BW256,V3.1.5
>> OK

AT+BAUD - Read/Write UART Baudrate

Command

AT+BAUD{=Param}

Param

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

Response

+BAUD=Param

Param

Returns the currently set baud rate

Example:
Read baud rate
<< AT+BAUD
>> +BAUD=921600
>> OK

Set the baud rate
<< AT+BAUD=115200
>> OK

AT+TPMODE - Read/Write Throughput Mode

Command

AT+TPMODE{=Param}

Param

1:Enable transparent transmission mode
0:Disable transparent transmission mode

Response

+TPMODE=Param

Param

Return to the current transparent transmission mode settings

Description

When the transparent transmission mode is enabled and a TCP, GATT or other connections are established, the serial port of the module will output the original data received from the remote end, and the data received by the serial port of the module will also be directly sent to the remote end.
When the transparent transmission mode is turned off, the serial port of the module will only process the received data in any state, and the data received by the module from the remote end will be output in command format from the serial port.
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

The module releases all connections to the remote device and then restarts

Example:
<< AT+REBOOT
>> OK

AT+RESTORE - Restore Factory Setting

Command

AT+RESTORE

Response

OK

Description

Module restore all factory settings then reboot

Example:
<< AT+RESTORE
>> OK

AT+STAT - Read Connection Status

Command

AT+STAT

Response

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

Param1

Connection Status in BLE Peripheral Mode

Param2

Connection Status in BLE Central Mode

Param3

Connection Status to Access Point

Param4

Connection Status as Tcp Server

Param5

Connection Status as Tcp Client

Param6

Connection Status as SSL client

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

AT+NAME - Read/Write Bluetooth BR/EDR name

Command

AT+NAME{=Param1{,Param2}}

Param1

BR/EDR Bluetooth 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

Set the Bluetooth name if there is a parameter, otherwise just read

Example:
Example Query the BR/EDR Bluetooth name
<< AT+NAME
>> +NAME=FSC-BW256-XXXX
>> OK

Set the BR/EDR Bluetooth name and turn off the suffix
<< AT+NAME=ABC,0
>> OK

Write Bluetooth BLE Name as “ABC” and add MAC address suffix
<< AT+NAME/LENAME=ABC,1
>> OK

AT+LENAME - Read/Write Bluetooth BLE Name

Command

AT+NAME{=Param1{,Param2}}

Param1

BR/EDR Bluetooth 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

Set the Bluetooth name if there is a parameter, otherwise just read

Example:
Example Query the BLE Bluetooth name
<< AT+LENAME
>> +LENAME=FSC-BW256-XXXX
>> OK

Set the BLE Bluetooth name and turn off the suffix
<< AT+LENAME=ABC,0
>> OK

Set the BLE Bluetooth name to ABC and automatically add an address suffix
<< AT+LENAME=ABC,1
>> OK

AT+DSCA - Disconnect WIFi or Bluetooth connection

Command

AT+DSCA

Response

OK

Description

The module is disconnected from Wifi or Bluetooth

Example:
Disconnect from the AP
<< AT+DSCA=1
>> OK
Disconnect from BLE
<< AT+DSCA=2
>> OK

SPP Command

AT+ADDR-Read Bluetooth BR/EDR MAC

Command

AT+ADDR

Response

+ADDR=Param

Param

MAC address of the module Bluetooth BR/EDR(12 Bytes ASCII)

Description

Only Read Supported

Example:
<< AT+ADDR
>> +ADDR=DC0D300016F4
>> OK

AT+SPPSTAT-Read the SPP status

Command

AT+SPPSTAT

Response

+SPPSTAT=Param

Param

0:Uninitialized
1:Read
2:Connecting
3:Connected

Description

Example Query the SPP connection status

AT+SPPDISC-Disconnects the SPP

Command

AT+SPPDISC

Response

OK

Description

Disconnects the current SPP connection to the remote device

AT+SPPSEND-Sends SPP data

Command

AT+SPPSEND=Param1,Param2

Param1

Length of data to be sent

Param2

The content of the data to be sent

Response

OK:Send complete
ERR002:The parameter or format is incorrect
ERR003:Bluetooth connection failed

Description

The data length should be less than 1000

Example:
Module sends “123”
<< AT+SPPSEND=3,123
>> OK

AT+SSP-Query/modify the BT pairing mode

Command

AT+SSP{=Param}

Param

0: Easy pairing mode (default)
1:Pairing code mode

Response

OK

Description

Example:
Displays the pairing mode
<< AT+SSP
>> +SSP=0
>> OK
Is set to pairing code mode
<< AT+SSP=1
>> OK

AT+PIN - Read/Write Bluetooth BLE PIN Code

Command

AT+PIN{=Param}

Param

pairing code

Response

OK

Description

The default pairing code is 0000. The value contains a maximum of 15 characters and is valid only in pairing code mode, that is, SSP=1
Example:
Displays the BT pairing code
<< AT+PIN
>> +PIN=0000
>> OK
Set the pairing code to 12345678
<< AT+PIN=12345678
>> OK

AT+COD - Read/Write the BT device type

Command

AT+COD{=Param}

Param

Device type (hexadecimal)

Response

OK

Description

Default printer (0x680)

Example:
Read the Bluetooth device type
<< AT+COD
>> +COD=680
>> OK
Change the Bluetooth device type to HeadPhone(0x418)
<< AT+COD=418
>> OK

BLE Command

AT+LEADDR - Read the Bluetooth BLE MAC

Command

AT+LEADDR

Response

+LEADDR=Param

Param

Module’s LE MAC address (12 Bytes ASCII)

Description

Only Read Supported

Example:
<< AT+LEADDR
>> +LEADDR=DD0D300016F4
>> 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:Send complete
ERR002:The parameter or format is incorrect
ERR003:The Bluetooth connection is down

Description

The data length should be less than 1000

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

AT+GATTSTAT - Read the BLE connection status

Command

AT+GATTSTAT

Response

+GATTSTAT=Param

Param

0: uninitialized
1: ready
2: connecting
3: connected

Description

Example:
Displays the BLE connection status
<< AT+GATTSTAT
>> +GATTSTAT=3
>> OK

Wi-Fi Command

AT+ROLE - Read/Write Wi-Fi Mode

Command

AT+ROLE{=Param}

Param

1: STA mode
2: AP mode

Response

+ROLE=Param

Description

Module will reboot after setting

Example:
Read Current Wi-Fi Mode
<< AT+ROLE
>> +MODE=1
>> OK
Example:
Write AP Mode
<< AT+MODE=2
>> OK

AT+SCAN - Scan Devices

Command

AT+SCAN=5(scan for surrounding hot spots)

Response

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

Param1

Scan serial number

Param2

has a fixed value of 5, indicating the scanning hotspot

Param3

Address code of the hotspot

Param4

Indicates the signal value between the module and the hotspot

Param5

Channels

Param6

Indicates the hotspot name

Description

Example:
Scan for surrounding hot spots
<< AT+SCAN=5
>> +SCAN=1,5,F0B4292428F0,-42,11,Feasycom_D710_2.4G
>> +SCAN=2,5,F0B4292428F1,-44,153,Feasycom_D710_5G
>> +SCAN=3,5,98BB991F6B45,-48,13,GOCLOUD_1F6B46

AT+RAP - Read Connected AP’s information/Connect to Remote AP

Command

AT+RAP=<Param1>,<Param2>

Param1

AP’s SSID

Param2

AP’s password,if way of encryption is OPEN, no need to set this parameter

Response

OK

Description

1. This command needs to be sent in STA mode or coexistence mode, that is, +ROLE=1 or 3
2. The module uses WPA2 encryption to connect to the hotspot by default
3. To connect to the hotspot whose encryption mode is OPEN, set the first parameter, for example
AT+RAP=Feasycom
4. Send AT+RAP to query the hotspot name
Example:
Indicates the hot spot whose name is test and password is 12345678
<< AT+RAP=test,12345678
>> OK
Queries the current hotspot
<< AT+RAP
>> +RAP=test,12345678
>> OK
Connect to the test hotspot without a password
<< AT+RAP=test
>> OK

AT+LIP - Read Current Local IP Address

Command

AT+LIP

Response

+LIP=Param

Param

IP address

Description

When the module successfully connects to the hotspot, it will get an IP address, otherwise “0.0.0.0” is returned

Example
Queries the IP address of the current module
<< AT+LIP
<< +LIP=192.168.1.100
>> OK

AT+MDNSEN - Enable/Disable MDNS Function

Command

AT+MDNSEN{=Param}

Param

0:Disable(default)
1:Enables

Response

+MDNSEN=Param

Example:
Read Whether mDNS Function is Enabled
<< AT+MDNSEN
>> +MDNSEN=0
>> OK
Enable mDNS Function
<< AT+MDNSEN=1
>> OK

AT+DHCP - Read/Write IP Distribution Mode

Command

AT+DHCP{=Param}

Param

0:Use static IP
1:Use dynamic IP(default)

Response

+DHCP=Param

Description

If a static IP address is used for connection, ensure that the static IP address, mask, gateway, and DNS Settings are correct.
Otherwise, network communication may be interrupted
Example:
Read IP Distribution Mode
<< AT+DHCP
>> +DHCP=1
>> OK
Use static IP
<< AT+DHCP=0
>> OK

AT+SIP - Read/Write Static IP

Command

AT+SIP{=Param}

Param

IPV4 Address

Response

+SIP=Param

Description

This command can be used when +DHCP=0

Example:
Read Static IP Address
<< AT+SIP
>> +SIP=0.0.0.0
>> OK
Write Static IP Address as “192.168.0.23”
<< AT+SIP=192.168.0.23
>> OK

AT+GW - Read/Write Gateway

Command

AT+GW{=Param}

Param

IPV4 Address

Response

+GW=Param

Description

This command can be used when +DHCP=0

Example:
Read Gateway Address
<< AT+GW
>> +GW=192.168.1.1
>> OK
Write Gateway Address as “192.168.10.1”
<< AT+GW=192.168.10.1
>> OK

AT+MASK - Read/Write Subnet Mask

Command

AT+MASK{=Param}

Param

IPV4 Address

Response

+MASK=Param

Description

This command can be used when +DHCP=0

Example:
Read Subnet Mask
<< AT+MASK
>> +MASK=255.255.0.0
>> OK
Write Subnet Mask as “255.255.255.0”
<< AT+MASK=255.255.255.0
>> OK

AT+DNS - Read/Write DNS Address

Command

AT+DNS{=Param}

Param

IPV4 Address

Response

+DNS=Param

Description

This command can be used when +DHCP=0

Example:
Read DNS
<< AT+DNS
>> +DNS=0.0.0.0
>> OK
Write DNS Address as “8.8.8.8”
<< AT+DNS=8.8.8.8
>> OK

AT+LHNAME - Read/Write the STA name

Command

AT+LHNAME{=Param}

Param

Device name (up to 32 bytes)

Response

+LHNAME=Param

Description

FSC-BW256(Default)

Example:
Read the STA device name of the module
<< AT+LHNAME
>> +LHNAME=FSC-BW256
>> OK
Write STA device name is my_test
<< AT+LHNAME=my_test
>> OK

AT+APAC - Read/Write Automatically Connect to AP

Command

AT+APAC{=Param}

Param

0:Disable
1:Enable(default)

Response

+APAC=Param

Description

This command can be used when +ROLE=1 or 3

Example:
Read Whether Automatically Connect to AP Function is Enabled
<< AT+APAC
>> +APAC=1
>> OK
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

RSSI value (-99 ~ 0)

Description

The result of RSSI is 0 when disconnect from AP.

Example:
Read RSSI
<< AT+RSSI
>> +RSSI=-56
>> OK

AT+MAC - Read Wi-Fi MAC Address

Command

AT+MAC

Response

+MAC=Param

Param

Wi-Fi MAC Address(12 Bytes ASCII)

Description

MAC address can only be read , not be written

Example:
<< AT+MAC
>> +MAC=DC0D30800204
>> OK

AT+APINFO - Read information about connected AP

Command

AT+APINFO

Response

+APINFO=Param1,Param2,Param3,Param4

Param1

AP MAC address (12 Bytes ASCII)

Param2

1:5G
0:2.4G

Param3

The frequency band of AP

Param4

Indicates the SSID of AP

Description

Read can only be made if the hotspot is connected

Example:
<< AT+APINFO
>> +APINFO=B4F02429F128,1,5765,Feasycom_D710_5G
>> OK

AT+LAP - Read/Write AP Mode Configuration

Command

AT+LAP{=Param1,Param2,Param3}

Param1

The SSID of the module as a AP

Param2

The password of the module as a AP

Param3

The IP address of the module as a AP

Response

+LAP=Param1, Param2, Param3

Description

If the module is configured as a AP with OPEN encryption,
no need to set the Param2,
such as AT+LAP=FSC-BW236-AP,192.168.1.1
Example:
Read AP Mode Configuration
<< AT+LAP
>> +LAP=FSC-BW236-AP,12345678,192.168.1.1
>> OK
Write AP Mode Configuration
<< AT+LAP=test,12345678,192.168.10.1
>> OK

AT+CHANNEL - Read/Write the AP mode channel

Command

AT+CHANNEL{=Param}

Param

module as a channel in AP mode

Response

+CHANNEL=Param

Description

Module will decide whether to turn on 2.4G or 5G hotspot based on channel selection

Example:
Read the AP mode channel
<< AT+CHANNEL
>> +CHANNEL=1
>> OK
Write the AP mode channel
<< AT+CHANNEL=157
>> OK

AT+WLANC - Start SOCKET/MQTT/WEBSOCKET

Command

AT+WLANC=Param

Param

3:Enable TCP/UDP/SSL
4:Connect to MQTT or cloud platform
5:Starts the WEBSOCKET

Response

OK

Description

This command can only be used after the SOCKET or MQTT configuration is completed

TCP/UDP Command

AT+SOCK - Read/Write SOCKET

Command

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

Param1

Protocol Type(TCPS,TCPC,UDP,SSL)

Param2

Port of Module

Param3

Remote Address

Param4

Remote Port

Response

+SOCK=Param1, Param2, Param3, Param4

Description

The TCP SERVER is enabled after power on, default port is 9100
Param3 and Param4 can be omitted if module works as a TCP Server or a UDP
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+WFSEND - Sends SOCKET data to the remote device

Command

AT+WFSEND=Param1,Param2,Param3

Param1

Indicates the ID of the TCP/UDP connection

Param2

Send data length (not more than 1460 bytes)

Param3

Sends data content

Response

OK

Description

When the module functions as the TCP server, it can be connected by a maximum of three remote clients by default. The ids of the three remote clients are 0, 1, and 2 respectively;
When a module functions as a TCP client, the communication ID is 3 by default;
When UDP is enabled on the module, the communication ID is 4 by default.
Example:
Sends data to the TCP Client
<< AT+WFSEND=0,3,123
>> OK
Sends data to the TCP Server
<< AT+WFSEND=3,3,123
>> OK
Sends data to UDP
<< AT+WFSEND=4,3,123
>> OK

AT+CLOSE - Close Connection as TCP client

Command

AT+CLOSE

Response

OK

Description

This command can be used to disconnect from a remote TCP Server,if module works as a TCP Client

Example:
<< AT+CLOSE
>> OK

AT+IDLETO - Read/Write the automatic disconnection time of TCP Server short connections without data

Command

AT+IDLETO{=Param}

Param1

Short connection Duration of automatic disconnection without data (unit s, default is 0, that is, long connection)

Response

OK

Description

Example:
Read the automatic disconnection time without data for the short connection of the module
<< AT+IDLETO
>> +IDLETO=0
>> OK
Write the time for automatically disconnecting the module without data short connection to 5 seconds
<< AT+IDLETO=5
>> OK

AT+BRDDATA - Read/Write UDP broadcast data

Command

AT+BRDDATA{=Param1,Param2,Param3}

Param1

UDP broadcast port

Param2

UDP broadcast interval (unit s)

Param3

UDP Broadcast content (up to 128 bytes)

Response

OK

Description

Example:
Read UDP broadcast data
<< AT+BRDDATA
>> +BRDDATA=6000,5,
>> OK
Read the time for automatically disconnecting the module without data short connection to 5 seconds
<< AT+BRDDATA=6000,5,hello world
>> OK

AT+BRDEN - Read/Write the UDP broadcast switch

Command

AT+BRDEN{=Param}

Param

0: Disables UDP broadcast,
1: Enables UDP broadcast

Response

OK

Description

Example:
Read the UDP broadcast switch
<< AT+BRDEN
>> +BRDEN=0
>> OK
Enable UDP broadcast
<< AT+BRDEN=1
>> 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

Param2

HTTP server’s address

Param3

HTTP server’s URI

Param4

Resume breakpoint to support
This Parameter can be omitted.
Format is “Range:bytes=starting byte-ending byte”

Response

OK

Description

AT+HTTP Used to access the HTTP server. If you need to access the HTTPS server, use the AT+HTTPS command instead
The default port for accessing the HTTP server is 80, and the default port for accessing the HTTPS server is 443. If you want to change the port, specify the port following the server address. For example, if the specified port is 778, 192.168.0.179:778 can be used
Example:
Access Github,and read all the data
<< AT+HTTP=GET,www.github.com,/
>> OK
>> {Data Content}
Access Github,and read bytes from the 3rd to the 10th
<< AT+HTTP=GET,www.github.com,/,Range:bytes=3-10
>> OK
>> {Data Content}
Access HTTPS Server with port 778 to download file named “test.bin” in the “OTA” directory
<< AT+HTTPS=GET,192.168.0.179:778,/OTA/test.bin
>> OK
>> {Data Content}
POST 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 Content}

Note

MQTT Command

AT+BROKER - Read/Write MQTT broker

Command

AT+BROKER{=Param}

Param

MQTT server address

Response

+BROKER=Param

Description

“gpssensor.ddns.net” is available for testing MQTT

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

AT+CLIENTID - Read/Write MQTT Client ID

Command

AT+CLIENTID{=Param}

Param

MQTT Client ID

Response

+CLIENTID=Param

Example:
Read MQTT Client ID
<< AT+CLIENTID
>> +CLIENTID=user
>> OK
Write 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/Write MQTT password

Command

AT+MQTTPWD{=Param}

Param

MQTT MQTTPWD

Response

+MQTTPWD=Param

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

AT+SUBTPC - Read/Subscribe MQTT Topic

Command

AT+SUBTPC{=Param1,Param2}

Param1

Topic

Param2

QOS, only can be 0,1,2

Response

+SUBTPC=Param1,Param2

Example:
Read MQTT TOPIC
<< AT+SUBTPC
>> +SUBTPC=/fsc/bw236/get,0
>> OK
Write MQTT TOPIC
<< AT+SUBTPC=/fsc/bw236/test,2
>> OK

Note

  • This command returns an error if you repeatedly subscribe to the TOPIC with the same name

  • Currently, you can subscribe to a maximum of 5 different topics. If you do not meet the usage requirements, you are advised to use wildcard characters in actual use

AT+UNSUBTPC - Unsubscribe Specify MQTT Topic

Command

AT+UNSUBTPC=Param

Param

Specify the topic to be unsubscribed

Response

OK

Description

There is no need to specify a QoS value when unsubscribes

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

AT+UNSUBALL - Unsubscribe from all MQTT topics

Command

AT+UNSUBALL

Response

OK

Example:
<< AT+UNSUBALL
>> OK

AT+MQTTSEND - Send MQTT Data

Command

AT+MQTTSEND=Param1,Param2,Param3,Param4

Param1

Publish Topic

Param2

QOS(0,1,2)

Param3

Payload length

Param4

Payload

Response

OK

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

AT+MQTTMODE - Read/Write 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

AT+MQTTPORT - Read/Write MQTT Port

Command

AT+MQTTPORT{=Param}

Param

MQTT port, default is 1883

Response

+MQTTPORT=Param

Description

Based on the actual server port

Example:
Read MQTT Port
<< AT+MQTTPORT
>> +MQTTPORT=1883
>> OK
Write MQTT Port as 8883
<< AT+MQTTPORT=8883
>> OK

AT+MQTTKAI - Read/Write MQTT Keepalive

Command

AT+MQTTKAI{=Param}

Param

MQTT Keepalive time:uint is second,default value is 60

Response

+MQTTKAI=Param

Example:
Read MQTT Keepalive
<< AT+MQTTKAI
>> +MQTTKAI=60
>> OK
Write MQTT Keepalive as 300 seconds
<< AT+MQTTKAI=300
>> OK

Note

  • Set the value based on the actual platform usage restrictions.

  • General platforms, such as Alicloud, require an MQTT keepalive period of 30 to 1200 seconds

  • If module is disconnected unexpectedly more than {keepalive period * 1.5}, the MQTT server will automatically disconnect module

Firmware Upgrade (Remote OTA)

AT+OTA - Remote OTA

Command

AT+OTA=Param

Param

Name of the firmware to be upgraded

Response

OK

Description

The firmware name is provided by feasycom engineering or technical support team members.
The module will return $OTA=1 after a successful upgrade
Example:
<< AT+OTA=Feasycom_V426
>> OK
>> $OTA=1

Note

  • Do not operate other commands or functions during the upgrade. Otherwise, the upgrade may fail or cause unexpected situations

Events Table

MQTT Indication

+MQTTSTAT - MQTT Status

Format

+MQTTSTAT=Param

Param

(0) uninitialized
(1) ready
(2) connecting
(3) connected

+MQTTDATA - MQTT Received Data

Format

+MQTTDATA=Param1,Param2,Param3

Param1

Topic

Param2

Payload length

Param3

Payload

Example: Receive data “1234567890” from MQTT Server
>> +MQTTDATA=/fsc/bw236/get,10,1234567890

SOCKET Indication

+WFDATA - Receive SOCKET Data

Format

+WFDATA=Param1,Param2,Param3

Param1

TCP/UDP Connection ID

Param2

Payload length

Param3

Payload

Example: Receive data “1234567890” from remote SOCKET device
>> +WFDATA=5,10,1234567890

Note

  • For details about the connection ID, see the AT+WFSEND command

GATT Indication

+GATTSTAT - GATT Status

Format

+GATTSTAT=Param

Param

(0) uninitialized
(1) ready
(2) connecting
(3) connected

+GATTDATA - Receive GATT Data

Format

+GATTDATA=Param1,Param2

Param1

Payload length

Param2

Payload

Example: Receive GATT data “ 1234567890” from remote device
>> +GATTDATA=10,1234567890

SPP indication

+SPPSTAT - SPP status

Format

+SPPSTAT=Param

Param

(0) Uninitialized
(1) No connection
(2) Connecting
(3) Connected

+SPPDATA - SPP receives data

Format

+SPPDATA=Param1,Param2

Param1

Payload length

Param2

Payload

Example: Data received from remote device via SPP “1234567890”
>> +SPPDATA=10,1234567890

Application Scenarios

TCP Server Application

@startuml
hide footbox
skinparam sequenceMessageAlign center

box  #LightBlue
actor “ ” as person
participant “USER MCU” as mcu
participant MODULE as module
participant " " as nu
participant "TCP Client" as client
end box

person ->> mcu: START
mcu -> module: AT+ROLE=1
note left
    Switch to STA mode
end note
module --> mcu: OK
mcu -> module: AT+RAP=SSID,PASSWORD
note left
    Connect to AP
end note
module --> mcu: OK
group LOOP:\n Query until the IP address\n is obtained
mcu -> module: AT+LIP
note left
    Query the module's IP
end note
module --> mcu: +LIP=0.0.0.0
note right
    Not connected to  AP
end note
end
module --> mcu: +LIP=192.168.2.86
note right
    Connected to AP
end note
mcu -> module: AT+SOCK=TCPS,9100
note left
    Set module
    as TCP Server
end note
module --> mcu: OK
mcu -> module: AT+WLANC=3
note left
    Start TCP Server
end note
module --> mcu: OK

client -> nu: The client \ninitiates a connection
nu -> module: The module is connected
client -> nu: The client send data\n:1234567890
module --> mcu: +WFDATA=0,10,1234567890
note right
    module outputs
    the received data
end note
mcu -> module: AT+WFSEND=0,3,abc
note left
    module sends data
    to the remote end
end note
module --> mcu: OK
nu -> client: abc
@enduml

1、Switch to STA mode
Send:<<AT+ROLE=1
Response:>> OK
2、Connect to AP
Send:<< AT+RAP=ssid,password
Response: > OK
3. Query module IP address:
Send:<< AT+LIP
Response:>> +LIP=192.168.2.86
>> OK
4、Set the module to TCP server and port number to 9100
Send:<< AT+SOCK=TCPS,9100
Response:>> OK
5、Module create TCP server
Send:<< AT+WLANC=3
Response:>> OK
6、The PC and the module are connected to the same hotspot. Use the network debugging tool on the PC to connect to the TCP client
Connector module
_images/TCP_Server连接.jpg
7、Receive data
<< +WFDATA=0,10,1234567890
<< +WFDATA=1,10,1234567890
<< +WFDATA=2,10,1234567890
8、Send data
Send:<< AT+WFSEND=0,3,abc
Response:<< OK

Note

  • Note: To use transparent data transmission, send AT+TPMODE=1 before setting the Wi-Fi mode

TCP Client Application

@startuml
hide footbox
skinparam sequenceMessageAlign center

box  #LightBlue
actor “ ” as person
participant “USER MCU” as mcu
participant MODULE as module
participant " " as nu
participant "TCP Server" as server
end box

person ->> mcu: START
mcu -> module: AT+ROLE=1
note left
    Switch to STA mode
end note
module --> mcu: OK
mcu -> module: AT+RAP=SSID,PASSWORD
note left
    Connect to AP
end note
module --> mcu: OK
group LOOP:\n Query until the IP address\n is obtained
mcu -> module: AT+LIP
note left
    Query the module's IP
end note
module --> mcu: +LIP=0.0.0.0
note right
    Not connected to AP
end note
end
module --> mcu: +LIP=192.168.2.86
note right
    Connected to AP
end note
mcu -> module: AT+SOCK=TCPC,\n9100,192,168.2.23,6000
note left
    Set module
    as TCP Client
end note
module --> mcu: OK
mcu -> module: AT+WLANC=3
note left
    Start TCP Client
end note
module --> mcu: OK

module-> nu: Module initiates \nconnection
server -> nu: Module is connected
server -> nu: The client send data\n:1234567890
module --> mcu: +WFDATA=3,10,1234567890
note right
    module outputs
    the received data
end note
mcu -> module: AT+WFSEND=3,3,abc
note left
    module sends data
    to the remote end
end note
module --> mcu: OK
nu -> server: abc
@enduml

1. Switch to STA mode
Send:<< AT+ROLE=1
Response:>> OK
2、Connect to AP
Send:<< AT+RAP=ssid,password
Response:>> OK
3、Query the module IP address
Send:<< AT+LIP
Response:>> +LIP=192.168.2.86
>> OK
4、PC and module connected to the same hotspot, using the network debugging tool on the PC, create a TCP
server, for example, the IP address is 192.168.2.23 and the port number is 6000
5、Set the module as TCP client and configure the remote IP address and port number
Send:<< AT+SOCK=TCPC,9100,192.168.2.23,6000
Response:>> OK
6、The module functions as a TCP client to initiate a connection to the remote end
Send:<< AT+WLANC=3
Response:>> OK
_images/TCP_Client连接.jpg
7、Received data
Send:<< +WFDATA=3,10,1234567890
Response:<< OK

Note

  • Note: To use transparent data transmission, send AT+TPMODE=1 before setting the Wi-Fi mode

UDP application

@startuml
hide footbox
skinparam sequenceMessageAlign center

box  #LightBlue
actor “ ” as person
participant “USER MCU” as mcu
participant MODULE as module
participant " " as nu
participant "UDP" as udp
end box
person ->> mcu: Start the operation
mcu -> module: AT+ROLE=1
note left
    Switch to STA mode
end note
module --> mcu: OK
mcu -> module: AT+RAP=SSID,PASSWORD
note left
    Connection WiFi
end note
module --> mcu: OK
group LOOP Query until the IP address is obtained
mcu -> module: AT+LIP
note left
    Example Query the module IP address
end note
module --> mcu: +LIP=0.0.0.0
note right
    Not connected to WiFi
end note
end
module --> mcu: +LIP=192.168.2.86
note right
    If you connect to WiFi
end note
mcu -> module: AT+SOCK=UDP,4000
note left
    Set the module
    to UDP
end note
module --> mcu: OK
mcu -> module: AT+WLANC=3
note left
    Module start UDP
end note
module --> mcu: OK

udp -> nu: The remote end initiates a connection
nu -> module: Module is connected
udp -> nu: The remote end sends data\n:1234567890
module --> mcu: +WFDATA=4,10,1234567890
note right
    module outputs
    the received data
end note
mcu -> module: AT+WFSEND=4,3,abc
note left
    module sends data
    to the remote end
end note
module --> mcu: OK
nu -> udp: abc
@enduml

1. Switch to STA mode
Send:<< AT+ROLE=1
Respond:>> OK
2、Connect to AP
Send:<< AT+RAP=ssid,password
Respond:>> OK
3、Query the IP address to check whether AP is connected
Send:<< AT+LIP
Respond:>> +LIP=192.168.2.86 >> OK
4、Configure the module as UDP
Send:<< AT+SOCK=UDP,4000
Respond:>> OK
5、The module enables the UDP Server
Send:<< AT+WLANC=3
Respond:>> OK
6.The PC and the module are connected to the same hotspot. On the PC, use the network debugging tool to open a UDP
Client, the target IP address is 192.168.0.97, and the target port number is 4000.
7、Received data
<< +WFDATA=4,10,1234567890
8. Send data
Send:<< AT+WFSEND=4,3,abc
Respond:<< OK

Note

  • Note: To use transparent data transmission, send AT+TPMODE=1 before setting the Wi-Fi mode

MQTT Application

@startuml
hide footbox
skinparam sequenceMessageAlign center

box  #LightBlue
actor “ ” as person
participant “USER MCU” as mcu
participant MODULE as module
participant " " as nu
participant "AliCloud" as cloud
end box

person ->> mcu: Start the operation
module --> mcu:
note right
    If the AP is connected
end note
mcu -> module: AT+BROKER=addr
note left
    Set BROKER address
end note
module --> mcu: OK
mcu -> module: AT+USERNAME=username
note left
    Set UserName
end note
module --> mcu: OK
mcu -> module: AT+MQTTPWD=password
note left
    Set PassWord
end note
module --> mcu: OK
mcu -> module: AT+CLIENTID=ID
note left
    Set theClientID
end note
module --> mcu: OK
mcu -> module: AT+SUBTPC=tpoic,qos
note left
    Subscribe to topics
end note
module --> mcu: OK
mcu -> module: AT+WLANC=4
note left
    Module initiated connection
end note
module --> mcu: OK
module -> nu: Start connection
nu -> cloud: Connect to MQTT
cloud -> nu: Data sent from the cloud :1234567890
note right
    module outputs
    the received data
end note
note left
    module sends data
    to the remote end
end note
module --> mcu: OK
nu -> cloud: abc
@enduml

1. Switch to STA mode
Send:<< AT+ROLE=1
Response:>> OK
2、Connect to AP
Send:<< AT+RAP=ssid,password
Response:>> OK
3、Example Query the module IP address
Send:<< AT+LIP
Response:>> +LIP=192.168.2.86
>> +LIP=192.168.2.86
4、Set BROKER address
Send:<< AT+BROKER=gpssensor.ddns.net
Response:>> OK
5、Set User Name
Send:<< AT+USERNAME=admin
Response:>> OK
6. Set Password
Send:<< AT+MQTTPWD=12345678
Response:>> OK
7. Subscribe to topics
Send:<< AT+SUBTPC=user/get
Response:>> OK
8、 Connect MQTT
Send:<< AT+WLANC=4
Response:>> OK
9. Receive data from the cloud platform
1234567890
10.Send data to the cloud platform
Send:<< AT+MQTTSEND=/user/post,0,3,abc
Response:>> OK

Switch Throughput Mode to Command Mode

Specific Instruction Process Description
When Throughput Mode is enabled, any command is transmitted as data
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

Specific Instruction Process Description
1、Switch to STA Mode.
<< AT+ROLE=1
>> OK
2、Connect to AP
<< AT+RAP=ssid,password
>> OK
3、Query the IP address to check whether AP is connected
<< AT+LIP
>> +LIP=192.168.0.87
4、The upgrade starts. The firmware name is provided by the engineer or related personnel
<< 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/FeasyWiFi搜索显示.jpg
3、After the correct connection, it will jump to the following interface, click the Bluetooth network first
_images/FeasyWiFi连接界面.jpg
4、On the Bluetooth distribution screen, enter the hotspot name and password, and click Start
_images/FeasyWiFi配网界面.jpg
5、After the network is configured successfully, return to the previous page and select OTA upgrade. You can query the IP address and enter the firmware to be upgraded
_images/FeasyWiFi_OTA.jpg

Note

  • The hotspot needs to support access to the Internet.

Wechat mini program distribution network and OTA usage instructions

Specific process description
1、Wechat search open the small program “Bluetooth serial port” small program, the interface is as follows, click the setting button below
_images/小程序搜索界面.jpg
2、The setting interface is as follows: Click WiFi module setting (the Bluetooth command tool is used to send air commands, that is, to send AT commands in Bluetooth mode to configure the module)
_images/小程序设置界面.jpg
3、Bluetooth networking first
_images/小程序蓝牙配网.jpg
4、Connect the device that needs to be upgraded by Bluetooth, enter the distribution network interface, enter the hotspot and password to be connected, and click OK
_images/小程序配网界面.jpg
5、After the network distribution is successful, return to the previous interface, select in-flight upgrade, enter the firmware to be upgraded, click OK, and wait until the upgrade is complete
_images/小程序_OTA.jpg

Note

  • The hotspot needs to support access to the Internet.

Appendix

Download PDF version

Download PDF Document