background image

RAK411 PROGRAMMING MANUAL

V1.7

COPYRIGHT ©

SHENZHEN RAKWIRELESS TECHNOLOGY CO., LTD

ETDX1603021415

47

4.4.3 Modifying Web Parameters

Command:

rak_web_store

Syntax:

typedef struct {

uint32_t cmd;

config_t params;

char user_name[17];

char user_psk[17];

}web_t

Parameter:

Parameter

Bytes

Value

Description

Cmd

4

0xC5,0x00,0x00,0x00

Command Code

params

132

Network parameters

User_name

17

ASCII

Web

authentication

user name

User_psk

17

ASCII

Web

authentication

password

Description:

It is used to save the network parameters used to initiate network.

Return Value:

Parameter

Bytes

Value

Description

<CODE>

2

0xC5,0x00

Response Code

<STATUS>

1

0

Command successful

-2

Command failed

Related parameters:

Param

Parameter

Bytes

Value

Description

feature_bitmap

4

0x00,0x00,0x00,0x00

Characteristic switch

Summary of Contents for RAK411

Page 1: ...odule Programming Manual V1 7 Shenzhen Rakwireless Technology Co Ltd www rakwireless com info rakwireless com 2015 Rakwireless all rights reserved Mentioned in this document the actual company and pro...

Page 2: ...4 SPI Frame Format 5 3 4 1 Command frame header 5 3 4 2 Read Status 6 3 4 3 Read Data 7 3 4 4 Write Data 8 3 4 5 Command example 9 3 4 6 Status Register 12 3 4 7 Error code 12 3 5 Boot 13 3 6 Power Mo...

Page 3: ...Advanced Settings 33 4 2 16 Setting Network Listening Intervals 34 4 2 17 Disconnecting Current Wireless Network 34 4 3 Socket Operation Commands 35 4 3 1 TCP Server 35 4 3 2 TCP Client 36 4 3 3 UDP...

Page 4: ...er supporting wireless network parameters configuration supporting wireless firmware upgrade It also supports WPS and EasyConfig one key networking significantly reducing software development effort R...

Page 5: ...wer consumption as 1 2uA Small package size 28 75mmX23 14mmX3 40mm FCC RoHS and CE compliant 1 3 Key Applications Portable products Home appliances and electrical appliances Industrial sensors Sales t...

Page 6: ...p Support WPS and EasyConfig one key to network connection Support wireless configuration and firmware upgrade 2 3 TCP IP DHCP Client and Server features DNS Client and Server functions TCP Client TCP...

Page 7: ...ports maximum 16MHZ and optional SPI INT pin The SPI interface configuration diagram is as follows 3 1 Hardware Connection 3 2 SPI Timing Diagram SPI_CS SPI_CL SPI_MO SPI_MIS CPOL 0 SCK is idle in low...

Page 8: ...the module can read the data by sending read frames directly After reading a package INT pin goes low If there is data in the module needs to be sent to the host the module will once again pull up INT...

Page 9: ...he sending process requires a query if there is received ACK 0x85 2 If received CMD then stop the current Head ACK send 3 Send 1 Dummy bytes for the subsequent status status 4 Status is the status byt...

Page 10: ...uires a query if there is received ACK 0x85 2 If received CMD then stop the current Head ACK send 3 Send 2 bytes Dummy for receiving len the high byte in the front 4 After the value of the len the Dum...

Page 11: ...d command code and the parameters of the data detailed reference 4 command Daquan CMD Head 1 CMD fill in the command code to send such as scanning the wireless network command to fill in 0xA3 obtain t...

Page 12: ...el command to include the CMD field 4Byte and the channel field 4Byte where 0x08 should be filled Detailed reference to the 4 2 4 set up network channel command A complete command flow is divided into...

Page 13: ...RAK411 PROGRAMMING MANUAL V1 7 COPYRIGHT SHENZHEN RAKWIRELESS TECHNOLOGY CO LTD ETDX1603021415 10...

Page 14: ...quires a query if there is received ACK 0x85 6 If received CMD then stop the current Head ACK send 7 Send 1 Dummy bytes for the subsequent status status 8 Determine the status byte Data_flag 1 then re...

Page 15: ...ta Bit 2 Upgrade_err Upgrade error need to reset the module Bit1 Buffer_full 1 The internal data cache area of module is full valid when SPI_STATUS is 1 Bit0 Data_flag 1 Module has data to inform host...

Page 16: ...er_Save SPI wake up 5mA 3 Deep_Sleep Shut_down SPI wake up Reset 2uA pwrmode 0 Mode 0 Module works under the maximum performance control part and wireless part are fully opened pwrmode 1 Mode 1 The co...

Page 17: ...eps of WIFI communication including network scanning joining network and obtaining an IP address and eventually establishing Socket communication RAK411 provides a variety of convenient operation to i...

Page 18: ...RAK411 PROGRAMMING MANUAL V1 7 COPYRIGHT SHENZHEN RAKWIRELESS TECHNOLOGY CO LTD ETDX1603021415 15...

Page 19: ...works rak_getscan Reads a specified number of scan results rak_set_psk Set network password rak_set_channel Set network channel rak_connect Connect wireless network rak_set_ipstatic Configure Static I...

Page 20: ...arameters rak_web_store Store web server built in parameters rak_auto_connect Enable automatically connecting rak_start_web Start web server and configure module rak_get_storeconfig Get saved network...

Page 21: ...s used to check module versions including versions of host and WLAN Return Value Parameter Bytes Value Description CODE 2 0xBE 0x00 Response Code HOST_FW 8 ASCII Host version 1 Version delimiter WLAN_...

Page 22: ...Syntax uint32_t cmd Parameter Parameter Bytes Value Description Cmd 4 0xA1 0x00 0x00 0x00 Command Code Parameter It is used to read the data of module status register Return Value Parameter Bytes Val...

Page 23: ...dule via command Return Value N A 4 1 6 Module firmware upgrade Command rak_reset_upgrade Syntax typedef struct uint32_t cmd uint32_t File_len uint16_t Frame_len char buffer 1400 rak_upgrad_t Paramete...

Page 24: ...odule will be firmware upgrade after the upgrade will restart The host side need to query whether the INT pin is high to determine whether the module has been restarted the entire process is about 50...

Page 25: ..._t scan_num rak_getscan_t Parameter Parameter Bytes Value Description Cmd 4 0xA4 0x00 0x00 0x00 Command Code Scan_num 4 1 10 The amount of network information is obtained if the scan_num is greater th...

Page 26: ...ord Command rak_set_psk Syntax typedef struct uint32_t cmd char psk 64 rak_psk_t Parameter Parameter Bytes Value Description Cmd 4 0xA5 0x00 0x00 0x00 Command Code Psk 64 Network password Description...

Page 27: ...hannel Description It is used to set network channel Return Value Parameter Bytes Value Description CODE 2 0xAB 0x00 Response Code STATUS 1 0 Command successful 2 Command failed 4 2 5 Connecting Wirel...

Page 28: ...nnot find the SSID 3 Command failed 4 2 6 Configuring Static IP Address Command rak_set_ipstatic Syntax typedef struct uint32_t cmd uint32_t addr uint32_t mask uint32_t gw uint32_t dnssvr1 uint32_t dn...

Page 29: ...successful 2 Command failed 4 2 7 Setting DHCP Mode Command rak_ipconfig_dhcp Syntax typedef struct uint32_t cmd uint32_t mode rak_ipdhcp_t Parameter Parameter Bytes Value Description Cmd 4 0xAC 0x00...

Page 30: ...uccessful 2 Command failed 4 Get ip information failure 4 2 8 Connecting Network by Easyconfig Command rak_easy_config Syntax uint32_tcmd Parameter Parameter Bytes Value Description cmd 4 0xC2 0x00 0x...

Page 31: ...WPS function via this command After the success of WPS the module automatically saves the current network parameters with the rak_storeconfig command Parameter Bytes Value Description CODE 2 0xC2 0x00...

Page 32: ...status If the module is working in Station mode this command is used to get wireless network connection status If the module is working in AP mode this command is used to determine the device s connec...

Page 33: ...g_query Syntax uint32_t cmd Parameter Parameter Bytes Value Description cmd 4 0xAE 0x00 0x00 0x00 Command Code Description It is used to get module IP information including MAC address IP address subn...

Page 34: ...and Code Description It is used to get the current signal strength of the network Return Value Parameter Bytes Value Description CODE 2 0xA9 0x00 Response Code RSSI 2 99 0 current signal strength STAT...

Page 35: ...Response Code ADDR 4 Ip address STATUS 1 0 Command successful 2 DNS resolution failure 4 2 14 PING Command rak_ping Syntax Typedef struct uint32_t cmd uint32_thostaddr uint32_tcount uint32_tsize rak_...

Page 36: ...uint8_t countryCode 3 rak_apconfig_t Parameter Parameter Bytes Value Description cmd 4 0xAA 0x00 0x00 0x00 Command Code hidden 1 0 Network name is visible 1 Network name is hidden Country Code 3 Count...

Page 37: ...d Code time 4 20 1000 Need to refer to the wireless router settings for specific parameters Description It is used to set module beacon interval in Station mode Note In power saving mode reducing powe...

Page 38: ...he current wireless network Return Value Parameter Bytes Value Description CODE 2 0xB7 0x00 Response Code STATUS 1 0 Command successful 2 Current network is disconnected 4 3 Socket Operation Commands...

Page 39: ...four Close TCP server identifier to connect to the TCP sever the client connection will be closed Return Value Parameter Bytes Value Description CODE 2 0xB4 0x00 Response Code SOCKET_FLAG 2 8 11 Sock...

Page 40: ...and can create up to eight connections Port numbers are in sorted in ascending order Return Value Parameter Bytes Value Description CODE 2 0xB3 0x00 Response Code SOCKET_FLAG 2 0 7 Socket identifier S...

Page 41: ...e the connection This command can create up to eight connections Port numbers are in sorted in ascending order Return Value Parameter Bytes Value Description CODE 2 0xB1 0x00 Response Code SOCKET_FLAG...

Page 42: ...sage you need to specify each other s IP and port number information when sending data only reply UDP server applications more flexible capable of receiving unicast and broadcast messages and can send...

Page 43: ...onse code SOCKET_FLAG 2 0 7 Socket identifier STATUS 1 0 Execute successfully 2 Create failure 3 Failure of binding 4 The target port connection error 4 3 6 Query TCP server connections Command rak_ge...

Page 44: ...ODE 2 0xCD 0x00 Response Code TCP_NUM 1 The maximum number of connections TCP Client 7 0 7 TCP_FLAG 1 TCP client identifier DEST_TCP_PORT 2 TCP port number of the client DEST_TCP_IP 4 TIP address of t...

Page 45: ...de STATUS 1 0 Command successful 2 Specified port does not exist 3 Disable to close 4 3 8 Sending Data Command rak_send_data Syntax typedef struct uint32_t cmd uint32_t dest_addr uint16_t dest_port ui...

Page 46: ...to specified target as LUDP fill in the target IP and target port number Port numbers are in sorted in ascending order Return Value N A 4 3 9 Receiving Data Command rak_recv_data Syntax uint32_t cmd P...

Page 47: ...CODE 2 0xCA 0x00 Response Code SOCKET_FLAG 2 0 7 Port descriptor dummy 2 Invalid data IP_PORT 2 Port number IP_ADDR 4 IP address CODE 0xCB network connected Parameter Bytes Value Description CODE 2 0x...

Page 48: ..._t channel uint8_t sec_mode uint8_t dhcp_mode char ssid 32 char psk 64 ip_param_t ip_param ap_config_t ap_config config_t Parameter Parameter Bytes Value Description cmd 4 0xC0 0x00 0x00 0x00 Command...

Page 49: ...n CODE 2 0xC0 0x00 Response Code STATUS 1 0 Command successful 2 Command failed 4 4 2 Storing Current Network Parameters Command rak_storeconfig Syntax uint32_t cmd Parameter Parameter Bytes Value Des...

Page 50: ...Cmd 4 0xC5 0x00 0x00 0x00 Command Code params 132 Network parameters User_name 17 ASCII Web authentication user name User_psk 17 ASCII Web authentication password Description It is used to save the n...

Page 51: ...k identifier psk 65 ASCII Network key dummy 2 Null data ip_param 20 IP parameter ap_config 4 AP advanced parameters Ip_param Parameter Bytes Value Description addr 4 IP address mask 4 Subnet mask gw 4...

Page 52: ...and IP setting and then return IP allocation results Return Value Parameter Bytes Value Description CODE 2 0xC6 0x00 Response Code MAC 6 MAC address ADDR 4 IP address MASK 4 Subnet mask GW 4 Gateway...

Page 53: ...rade Return Value Parameter Bytes Value Description CODE 2 0xC7 0x00 Response Code STATUS 1 0 Configuration is successful or upgrade is successful 2 Configuration timeout 4 4 6 Getting Saved Network P...

Page 54: ...ameters ap_config 4 AP parameters STATUS 1 0 Command successful 2 Command failed or timeout Related parameters Ip_param parameter Bytes Value Description addr 4 IP address mask 4 Subnet mask gw 4 Gate...

Page 55: ...r_name 17 User name User_psk 17 Network encryption Password STATUS 1 0 Command successful 2 Command failed or timeout Related parameters Param Parameter Bytes Value Description feature_bitmap 4 0x00 0...

Page 56: ...parameter Bytes Value Description addr 4 IP address mask 4 Subnet mask gw 4 Gateway dnssvr1 4 DNS serve 1 dnssvr2 4 DNS serve 2 Ap_config parameter Bytes Value Description hidden 1 0 Network name is v...

Page 57: ...mailbox allan jin rakwireless com Tel 021 61553990 Fax 021 54721038 Address Room B205 Green light kechuang garden 2588 Lane Hongmei South road Minhang District Shanghai Shenzhen FAE mailbox steven tan...

Page 58: ...dd a new command rak_tcpsever_status check TCP server connections and description 2 Modify Easyconfig WPS Command Description 3 Modify ltcp command description 8 11 4 Modify ludp Command Description 5...

Reviews: