CC3100 Programmer's Guide
CC3100 Programmer's Guide
Processor Subsystem
Programmer's Guide
1 Overview ............................................................................................................................. 9
1.1 Document Scope ........................................................................................................... 10
1.2 Host Driver SW Concepts ................................................................................................. 10
1.3 Common Terminology and References ................................................................................. 11
2 Writing a Simple Networking Application .............................................................................. 12
2.1 Overview..................................................................................................................... 13
2.1.1 Basic Example Code .............................................................................................. 13
3 Device Initialization............................................................................................................. 18
4 Device Configurations......................................................................................................... 21
4.1 Overview..................................................................................................................... 22
4.2 Device Parameters ......................................................................................................... 22
4.3 WLAN Parameters ......................................................................................................... 22
4.3.1 Advanced ........................................................................................................... 23
4.4 Network Parameters ....................................................................................................... 23
4.5 Internet and Networking Services Parameters ......................................................................... 23
4.6 Power-Management Parameters ......................................................................................... 23
4.6.1 Power Policy ....................................................................................................... 23
4.6.2 Advanced ........................................................................................................... 24
4.7 Scan Parameters ........................................................................................................... 24
4.7.1 Scan Policy ......................................................................................................... 24
5 WLAN Connection .............................................................................................................. 25
5.1 Manual Connection ........................................................................................................ 26
5.1.1 STA.................................................................................................................. 26
5.1.2 P2P .................................................................................................................. 26
5.2 Connection Using Profiles ................................................................................................. 26
5.3 Connection Policies ........................................................................................................ 26
5.4 Connection Related Async Events ....................................................................................... 27
5.4.1 WLAN Events ...................................................................................................... 27
5.4.2 Network Events .................................................................................................... 27
6 Socket ............................................................................................................................... 28
6.1 Overview..................................................................................................................... 29
6.1.1 TCP ................................................................................................................. 29
6.1.2 UDP ................................................................................................................ 29
6.2 Socket Connection Flow .................................................................................................. 29
6.3 TCP Connection Flow ..................................................................................................... 30
6.3.1 Client Side ......................................................................................................... 30
6.3.2 Server Side ........................................................................................................ 31
6.4 UDP Connection Flow .................................................................................................... 32
6.4.1 Client Side ......................................................................................................... 32
6.4.2 Server Side ........................................................................................................ 33
6.5 Socket Options ............................................................................................................. 33
6.5.1 Blocking versus NonBlocking ................................................................................... 33
6.5.2 Secure Sockets .................................................................................................... 34
6.6 SimpleLink Supported Socket API ....................................................................................... 34
List of Figures
1-1. Host Driver Anatomy ....................................................................................................... 10
2-1. Basic Networking Application State Machine ........................................................................... 14
3-1. Basic Initialization Flow .................................................................................................... 19
6-1. Socket Connection Flow................................................................................................... 30
8-1. AP Mode Connect .......................................................................................................... 40
8-2. Profiles ....................................................................................................................... 41
8-3. Device Config Tab ......................................................................................................... 41
9-1. WLAN Connect Command ................................................................................................ 47
12-1. HTTP GET Request........................................................................................................ 72
13-1. mDNS Get Service Sequence ............................................................................................ 93
13-2. Find Full Service After Query ............................................................................................. 94
15-1. Trees Example 1 .......................................................................................................... 118
15-2. Trees Example 2 .......................................................................................................... 119
16-1. 802.11 Frame Structure .................................................................................................. 123
16-2. Sniffer ...................................................................................................................... 126
16-3. Sniffer ...................................................................................................................... 127
16-4. Tx Continues .............................................................................................................. 128
17-1. Use Cases ................................................................................................................. 132
18-1. Host Driver API Silos ..................................................................................................... 134
A-1. CC3100 Driver Configuration............................................................................................ 149
A-2. Blocked Link ............................................................................................................... 151
A-3. Data Flow Control......................................................................................................... 151
List of Tables
1-1. Common Terminology and Abbreviations ............................................................................... 11
6-1. SimpleLink Supported Socket API ....................................................................................... 34
9-1. Supported Cryptographic Algorithms .................................................................................... 50
10-1. WLAN Parameters ......................................................................................................... 52
10-2. Event Parameters .......................................................................................................... 55
10-3. Event Parameters .......................................................................................................... 56
10-4. Event Parameters .......................................................................................................... 56
12-1. Enable or Disable HTTP Server .......................................................................................... 79
12-2. Configure HTTP Port Number ............................................................................................ 79
12-3. Enable or Disable Authentication Check ................................................................................ 80
12-4. Set or Get Authentication Name ......................................................................................... 80
12-5. Set or Get Authentication Password ..................................................................................... 81
12-6. Set or Get Authentication Realm ......................................................................................... 81
12-7. Set or Get Domain Name ................................................................................................. 81
12-8. Set or Get URN Name ..................................................................................................... 82
12-9. Enable or Disable ROM Web Pages Access ........................................................................... 82
12-10. System Information ........................................................................................................ 83
12-11. Version Information ........................................................................................................ 84
12-12. Network Information........................................................................................................ 84
12-13. Tools ......................................................................................................................... 85
12-14. Connection Policy Status .................................................................................................. 85
12-15. Display Profiles Information ............................................................................................... 85
12-16. P2P Information ............................................................................................................ 86
12-17. System Configuration ...................................................................................................... 87
12-18. Network Configurations .................................................................................................... 88
12-19. Connection Policy Configuration ......................................................................................... 88
12-20. Profiles Configuration ...................................................................................................... 89
12-21. Tools ......................................................................................................................... 89
12-22. P2P Configuration .......................................................................................................... 89
12-23. POST Actions ............................................................................................................... 90
13-1. Parameters .................................................................................................................. 96
13-2. Defines for API.............................................................................................................. 97
13-3. Parameters .................................................................................................................. 99
13-4. User Defines ............................................................................................................... 100
13-5. Parameters ................................................................................................................ 103
13-6. Parameters ................................................................................................................ 104
13-7. Defines for API ............................................................................................................ 105
13-8. Defines for API ............................................................................................................ 107
13-9. Defines for API ............................................................................................................ 108
16-1. Network Layers ........................................................................................................... 123
G-1. Error Numbers............................................................................................................. 160
H-1. Available Sockets ......................................................................................................... 162
Overview
The SimpleLinkTM Wi-Fi CC3100 and CC3200 are the next generation in Embedded Wi-Fi. The CC3100
Internet-on-a-chipTM can add Wi-Fi and Internet to any microcontroller (MCU), such as TI's ultra-low power
MSP430TM. The CC3200 is a programmable Wi-Fi MCU that enables true, integrated IoT development.
The Wi-Fi Network Processor sub-system in both SimpleLink Wi-Fi devices integrates all protocols for Wi-
Fi and Internet, greatly minimizing MCU software requirements. With built-in security protocols, SimpleLink
Wi-Fi provides a robust and simple security experience.
The SimpleLink Host driver minimizes the host memory footprint requirements, requiring less than 7KB of
flash and 700B of RAM memory for a TCP client application. The driver follows strict ANSI C (C89) coding
standards, uses industry-standard BSD Sockets and simple APIs reducing integration and development
time for software and application developers. The driver is compatible and portable across different MCUs,
compilers, operating systems, communication interfaces and use cases.
The architecture of the SimpleLink Host Driver includes a set of six logical and simple API modules:
• Device API – Provided to manage hardware-related functionality such as start, stop, set and read
device configurations.
• WLAN API – Designed to manage WLAN, 802.11 protocol-related functionality such as device mode
(station, AP or P2P), setting provisioning method, adding connection profiles and setting connection
policy.
• Socket API – The most common API set for user applications, and complies with Berkeley socket
APIs.
• NetApp API – Designed to enable different networking services including HTTP server service, DHCP
server service and MDNS Client\Server service.
• NetCfg API – Provided for configuring different networking parameters, such as setting the MAC
address, acquiring the IP address by DHCP, and setting the static IP address.
• File System API – Designed to provide access to the serial flash component, for read and write
operations of networking or user proprietary data.
Figure 1-1 shows the host driver anatomy.
Applicable documents:
• CC3100 data sheet (SWAS031)
• CC3200 data sheet (SWAS031)
• CC31xx Host Driver APIs
• CC31xx Host Interface
Additional Resources:
• www.ti.com/simplelinkwifi.
• CC31xx SimpleLink wiki.
2.1 Overview
This chapter explains the software blocks needed to build a networking application. In addition, this
chapter describes the recommended flow for most applications. The information provided is for guidance
only. Programmers have complete flexibility on how to use the various software blocks.
Programs using the SimpleLink device consist of the following software blocks:
• Wi-Fi subsystem initialization – Wakes the Wi-Fi subsystem from the hibernate state.
• Configuration – Primarily one-time configurations such as cold boot configuration, or infrequently used
device configurations. For example, changing the Wi-Fi subsystem from a WLAN STA to WLAN soft
AP or WLAN P2P device, or changing the MAC address. After the configuration phase, reboot the Wi-
Fi subsystem for the new configurations to take effect.
• WLAN connection – The established physical interface is wireless LAN communication (for example,
manually connecting to an AP as a wireless station).
– DHCP – An IP address must be received before working with TCP/UDP sockets.
• Socket connection – Sets up the TCP/IP layer. This occurs in the following steps:
– Creating the socket – Select either TCP, UDP, or RAW sockets. Select whether the device will be
a client or a server socket. Define socket characteristics such as blocking/nonblocking and socket
time-outs.
– Querying for the server IP address – When implementing a client-side communication, usually
the remote server side IP address required for establishing the socket connection is not known.
Use DNS protocol to query the server IP address by using the server name.
– Creating socket connection – TCP socket requires the establishment of a proper socket
connection before continuing to perform data transactions.
• Data transactions – Once a socket connection is established, data can be transmitted between the
client and the server by implementing the application logic.
• Socket disconnection – After finishing the required data transactions, the socket communication
channel is closed.
• Wi-Fi subsystem hibernate – When the Wi-Fi subsystem is inactive for a long period of time, it goes
into hibernate state.
Figure 2-1 shows the different states described in this chapter, the host driver events which trigger the
code to move between different states, and basic error-handling events.
An example of the state machine is implemented in the following code:
• Init state – Example of initializing the Wi-Fi subsystem as a WLAN station:
case INIT:
status = sl_Start(0, 0, 0);
if (status == ROLE_STA)
{
g_State = CONFIG;
}
else
{
g_State = SIMPLELINK_ERR;
}
break;
• WLAN connection – Example of WLAN and network event handlers, demonstrating the WLAN
connection, waiting for a successful connection and acquiring an IP address:
/* SimpleLink WLAN event handler */
void SimpleLinkWlanEventHandler(void *pWlanEvents)
{
SlWlanEvent_t *pWlan = (SlWlanEvent_t *)pWlanEvents;
switch(pWlan->Event)
case SL_WLAN_DISCONNECT_EVENT:
g_DisconnectionCntr++;
g_Event |= EVENT_DISCONNECTED;
g_DisconnectionReason = pWlan->EventData.STAandP2PModeDisconnected.reason_code;
memcpy(g_AP_Name, pWlan->EventData.STAandP2PModeWlanConnected.ssid_name, pWlan-
>EventData.STAandP2PModeWlanConnected.ssid_len);
break;
default:
break;
}
}
/* SimpleLink Networking event handler */
void SimpleLinkNetAppEventHandler(void *pNetAppEvent)
{
SlNetAppEvent_t *pNetApp = (SlNetAppEvent_t *)pNetAppEvent;
switch( pNetApp->Event )
{
case SL_NETAPP_IPV4_ACQUIRED:
g_Event |= EVENT_IP_ACQUIRED;
g_Station_Ip = pNetApp->EventData.ipAcquiredV4.ip;
g_GW_Ip = pNetApp->EventData.ipAcquiredV4.gateway;
g_DNS_Ip = pNetApp->EventData.ipAcquiredV4.dns;
break;
default:
break;
}
}
.
.
.
/* initiating the WLAN connection */
case WLAN_CONNECTION:
status = sl_WlanConnect(User.SSID,strlen(User.SSID),0,
&secParams, 0);
if (status == 0)
{
g_State = WLAN_CONNECTING;
}
else
{
g_State = SIMPLELINK_ERR;
}
/* waiting for SL_WLAN_CONNECT_EVENT to notify on a successful connection */
case WLAN_CONNECTING:
if (g_Event
&EVENT_CONNECTED)
{
printf("Connected to %s\n", g_AP_Name);
g_State = WLAN_CONNECTED;
}
break;
{
printf("Received IP address:%d.%d.%d.%d\n",
(g_Station_Ip>>24)&0xFF,(g_Station_Ip>>16)&0xFF,(g_Station_Ip>>8)&0xFF,(g_Station_Ip&a
mp;0xFF));
g_State = GET_SERVER_ADDR;
}
break;
• Socket connection – Example of querying for the remote server IP address by using the server name,
creating a TCP socket, and connecting to the remote server socket:
case GET_SERVER_ADDR:
status = sl_NetAppDnsGetHostByName(appData.HostName,
strlen(appData.HostName),
&appData.DestinationIP, SL_AF_INET);
if (status == 0)
{
g_State = SOCKET_CONNECTION;
}
else
{
printf("Unable to reach Host\n");
g_State = SIMPLELINK_ERR;
}
break;
case SOCKET_CONNECTION:
Addr.sin_family = SL_AF_INET;
Addr.sin_port = sl_Htons(80);
AddrSize = sizeof(SlSockAddrIn_t);
SockId = sl_Socket(SL_AF_INET,SL_SOCK_STREAM, 0);
if( SockId < 0 )
{
printf("Error creating socket\n\r");
status = SockId;
g_State = SIMPLELINK_ERR;
}
if (SockId >= 0)
{
status = sl_Connect(SockId, ( SlSockAddr_t *)
&Addr, AddrSize);
if( status >= 0 )
{
g_State = SOCKET_CONNECTED;
}
else
{
printf("Error connecting to socket\n\r");
g_State = SIMPLELINK_ERR;
}
}
break;
• Data transactions – Example of sending and receiving TCP data over the open socket:
case SOCKET_CONNECTED:
/* Send data to the remote server */
sl_Send(appData.SockID, appData.SendBuff, strlen(appData.SendBuff), 0);
break;
• Device hibernate – Example of putting the Wi-Fi subsystem into hibernate state:
case SIMPLELINK_HIBERNATE:
sl_Stop();
g_State = …
break;
Device Initialization
The Wi-Fi subsystem is enabled by calling the sl_Start() API. During the initialization, the host driver
performs the following key steps:
• Enable the bus interface (in CC3200 – SPI; in CC3100 – SPI or UART).
• Register the asynchronous events handler.
• Enable the Wi-Fi subsystem (in CC3200 this is done by the internal applications microcontroller. In
CC3100 it is done by the external host processor).
• Send a synchronization message to the Wi-Fi subsystem and wait for an IRQ in return signaling on
completion of the initialization phase.
Figure 3-1 shows the basic initialization flow:
The Wi-Fi subsystem initialization can take tens of mS to complete. The host driver supports two main
options of using the sl_Start(const void* pIfHdl, char* pDevName, const P_INIT_CALLBACK
pInitCallBack) API:
• Blocking – pInitCallBack must be set to NULL. The calling application is blocked until the entire
initialization process completes (upon receiving the Init complete interrupt). See the following code
example:
if( sl_Start(NULL, NULL, NULL) == 0)
{
LOG("Error opening interface to device\n");
}
• Asynchronous – pInitCallBack is given a pointer to a function that is called when the initialization
process completes. In this case, the call to sl_Start() will return immediately. See the following code
example:
Void InitCallBack(UINT32 Status)
{
Network_IF_SetMCUMachineState(MCU_SLHost_INIT);
}
.
.
Void Network_IF_InitDriver(void)
{
..
sl_Start(NULL,NULL,InitCallBack);
while(!(g_usMCUstate & MCU_SLHost_INIT));
..
}
Device Configurations
4.1 Overview
The Wi-Fi subsystem has several configurable parameters that control its behavior. The host driver uses
different APIs to configure these parameters. The parameters are grouped based on their functionality.
Most of the parameters described in this chapter are stored in the serial flash (SFlash). If the parameter
values are not set by the user, the Wi-Fi subsystem will use the default values. A value stored in the
SFlash is always prioritized over the default value.
An application will usually need to configure its parameters when coming out of cold boot or when a
specific configuration change is required.
All the parameters configured in the SFlash take effect only in the next device boot.
This chapter explains all the parameters that the user can configure. This chapter also explains the read-
only parameters used for reading the device and networking status.
P2P – If set to Peer-to-Peer role, the Wi-Fi subsystem has many configurations that can be set:
• Device Name
• Device type
• Operational channels – Regulatory class determines the listen channel of the device during the P2P
find listen phase. Operational channel and regulatory class determines the operating channel preferred
by this device (if the device is the group owner, this is the operating channel). Channels should be one
of the social channels (1/6/11). If no listen or operational channel is selected, a random 1/6/11 channel
will be selected.
• Information elements – The application can be set to
MAX_PRIVATE_INFO_ELEMENTS_SUPPORTED information elements per role (AP / P2P GO). To
delete an information element, use the relevant index and length = 0. The application can be set to
MAX_PRIVATE_INFO_ELEMENTS_SUPPORTED to the same role. However, for AP no more than
INFO_ELEMENT_MAX_TOTAL_LENGTH_AP bytes can be stored for all information elements. For
P2P GO, no more than INFO_ELEMENT_MAX_TOTAL_LENGTH_P2P_GO bytes can be stored for all
information elements.
• Scan channels – Changes the scan channels and RSSI threshold.
For more details, see Chapter 11.
4.3.1 Advanced
Country code – Sets the Wi-Fi subsystem regulatory domain country code. Relevant for WLAN station
and P2P client modes only. For more details, see Section 18.2.
Tx power – Sets the maximal transmit power of the network processor subsystem. For more details, see
Section 18.2.
4.6.2 Advanced
See Section 4.6.
WLAN Connection
Connecting to a WLAN network is the first step required before initiating a socket communication. The Wi-
Fi subsystem supports two ways of establishing a WLAN connection:
1. Manual connection – The application calls an API that triggers the connection process.
2. Connection using profiles – The Wi-Fi subsystem automatically connects to pre-defined connection
profiles.
5.1.1 STA
For a manual connection, the user application must implement the following steps:
1. Call to the sl_WlanConnect API. This API call accepts the SSID of the Access Point, the security type,
and key, if applicable.
2. Implement a callback function to handle the asynchronous connection event
SL_WLAN_CONNECT_EVENT, signaling the completion of the connection process.
For additional information about these APIs, refer to Section 18.2 or the doxygen API manual.
5.1.2 P2P
For details, see Chapter 11.
profiles are supported. Upon a connection attempt, the device selects the highest priority profile. If
several profiles are within the same priority, the decision is made based on security type (WPA2 ->
WPA -> OPEN). If the security type is the same, the selection is based on the received signal strength.
To set this option, use
sl_WlanPolicySet(SL_POLICY_CONNECTION,SL_CONNECTION_POLICY(1,0,0,0,0),NULL,0)
• Fast – The device tries to connect to the last connected AP. In this mode "probe request" is not
transmitted before "authentication request," as both the SSID and channel are already known.
To set this option, use
sl_WlanPolicySet(SL_POLICY_CONNECTION,SL_CONNECTION_POLICY(0,1,0,0,0),NULL,0)
• anyP2P (relevant for P2P mode only) – The Wi-Fi subsystem tries to automatically connect to the first
P2P device available, supporting push-button only.
To set this option, use
sl_WlanPolicySet(SL_POLICY_CONNECTION,SL_CONNECTION_POLICY(0,0,0,1,0),NULL,0)
• autoSmartConfig – For auto SmartConfig upon restart (any command from the host ends this state).
To set this option, use
sl_WlanPolicySet(SL_POLICY_CONNECTION,SL_CONNECTION_POLICY(0,0,0,0,1),NULL,0)
Socket
6.1 Overview
The networking API standard used in SimpleLink is BSD (Berkeley) sockets, upon which the Linux™,
POSIX, and Windows™ sockets APIs are based. The main differences are in error codes (return directly
without errno) and additional setsockopt() options.
• See Simplelink documentation and examples.
• Berkeley sockets on Wikipedia
The content of this page assumes a basic understanding of Internet protocol suite and the differences
between TCP and UDP connections. Here are some basic concepts:
6.1.1 TCP
A definition of TCP from Wikipedia follows:
The Transmission Control Protocol (TCP) is one of the core protocols of the Internet protocol suite (IP),
and is so common that the entire suite is often called TCP/IP. TCP provides reliable, ordered and error-
checked delivery of a stream of octets between programs running on computers connected to a local area
network, intranet or the public Internet. It resides at the transport layer. Applications that do not require the
reliability of a TCP connection may instead use the connectionless User Datagram Protocol (UDP), which
emphasizes low-overhead operation and reduced latency rather than error checking and delivery
validation.
6.1.2 UDP
A definition of UDP from Wikipedia follows:
The User Datagram Protocol (UDP) is one of the core members of the Internet protocol suite (the set of
network protocols used for the Internet). With UDP, computer applications can send messages, in this
case referred to as datagrams, to other hosts on an Internet Protocol (IP) network without prior
communications to set up special transmission channels or data paths. UDP is suitable for purposes
where error checking and correction is either not necessary or performed in the application, avoiding the
overhead of such processing at the network interface level. Time-sensitive applications often use UDP
because dropping packets is preferable to waiting for delayed packets, which may not be an option in a
real-time system. If error correction facilities are needed at the network interface level, an application may
use the Transmission Control Protocol (TCP) or Stream Control Transmission Protocol (SCTP) which are
designed for this purpose.
SL_AF_INET indicates using IPv4 and SL_SOCK_STREAM indicates using TCP. Definitions for both
values are in the socket.h header file. The example sets 0 in the third parameter to select a default
protocol from the selected domain and type. More detail usage can be found in the online documentation.
Definition of some structures and constants is in the socket.h header file inside SDK.
As a TCP client, the application executes sl_Connect() to connect to a server. The server implementation
can be found below.
/* IP addressed of server side socket. Should be in long format,
* E.g: 0xc0a8010a == 192.168.1.10 */
#define IP_ADDR 0xc0a80168
int Status;
int Port = 5001;
SlSockAddrIn_t Addr;
Addr.sin_family = SL_AF_INET;
Addr.sin_port = sl_Htons((UINT16)Port);
Addr.sin_addr.s_addr = sl_Htonl((UINT32)IP_ADDR);
The struct Addr specifies destination address and relevant information. Because struct type SlSockAddr
is generic, use SlSockAddrIn_t to fill the details and cast it into SlSockAddr. Upon successful
connection, the SockID socket handler is ready to perform data exchange.
sl_Send() and sl_Recv() functions can be used for data exchange. Define the buffer size.
#define BUF_SIZE 1400
char SendBuf[BUF_SIZE];
Upon completion, close the socket with sl_Close() to allow the remaining applications to reuse the
resource if needed.
sl_Close(SockID);
SlSockAddrIn_t LocalAddr;
LocalAddr.sin_family = SL_AF_INET;
LocalAddr.sin_port = sl_Htons(PORT_NUM);
LocalAddr.sin_addr.s_addr = 0;
Status = sl_Bind(SockID, (SLSockAdd_t *) &LocalAddr, sizeof(SlSockAddrIn_t));
regardless of each failure. Details about blocking and nonblocking can be found in Section 6.5.1.
Upon a successful connection, a new socket handler newSockID returns, which is then used for future
communication.
long nonBlocking = 1;
int newSockID;
Status = sl_SetSockOpt (SockID, SL_SOL_SOCKET, SL_SO_NONBLOCKING, &nonBlocking,
sizeof(nonBlocking));
Data exchange is exactly the same as implemented in client. The user may need to reverse the order;
when one side is sending, the other side must be receiving.
#define BUF_SIZE 1400
char SendBuf[BUF_SIZE];
At the end, close both sockets with sl_Close() to allow the remaining applications run to reuse the
resource if needed.
sl_Close(newSockID);
sl_Close(SockID);
Because UDP is a connectionless protocol, the client can start sending data to a specified target address
without checking whether the target is alive or not.
#define IP_ADDR 0xc0a80164
#define PORT_NUM 5001
Similar to TCP, bind the socket to the local address. No listening is required as UDP is connectionless.
#define PORT_NUM 5001
SlSockAddrIn_t LocalAddr;
AddrSize = sizeof(SlSockAddrIn_t);
TestBufLen = BUF_SIZE;
LocalAddr.sin_family = SL_AF_INET;
LocalAddr.sin_port = sl_Htons((UINT16) PORT_NUM);
LocalAddr.sin_addr.s_addr = 0;
Status = sl_Bind(SockID, (SlSockAddr_t *) &LocalAddr, AddrSize);
The socket now tries to receive information on socket. If the user did not specify the socket option as
nonblocking, this command is blocked until an amount of BUF_SIZE of data is received. The fifth
parameter specifies the source address from which the data is being sent.
#define BUF_SIZE 1400
SlSockAddrIn_t Addr;
char RecvBuf[BUF_SIZE];
If the blocking mechanism is used, these functions will block until execution is finished.
If the nonblocking mechanism is used, these functions will return with an error code. The value of the error
codes depends the function being used. For details, see the online documentation.
sl_Connect(), sl_Accept(), sl_Aend(), sl_Aendto(), sl_Recv(), and sl_Recvfrom() are affected by this
flag. If not set, the default is blocking.
An example with sl_Connect() on a client application:
• Blocking: sl_Connect() blocks until connecting to a server, or an error occurs. Do not use blocking if
your application is single-threaded and must perform other tasks as well (such as handling multiple
sockets to read/write). However, using blocking is fine if the application is OS-based (like FreeRTOS).
Status = sl_Connect(SockID, ( SlSockAddr_t *) &Addr, AddrSize);
Device Hibernate
Hibernate is the lowest power state of the device. In this state the Wi-Fi subsystem's volatile memory is
not maintained. Only the RTC is maintained, for faster boot time and for keeping the system date and
time.
The Wi-Fi subsystem goes into hibernate on a call to the sl_Stop API. This API receives only one
parameter, a timeout parameter that configures the device to use the minimum amount of time to wait
before going to hibernate.
For more details, refer to Chapter 18 and the API Doxygen application note.
Provisioning
8.1 Provisioning
8.1.1 SmartConfig
The returned policy will be stored in the allocated buffer pointed by pVal.
Bits 0 and 4 should be set if Auto Start and Auto SmartConfig policies are set.
If this is not the case, set these policies manually by calling:
sl_WlanPolicySet(SL_POLICY_CONNECTION,SL_CONNECTION_POLICY(1,0,0,0,1),NULL,0)
After sending these commands, reset the device and SmartConfig should operate successfully.
Parameters description:
• groupIdBitmask – Use 1 as the default group ID bitmask (group ID 0).
To encrypt the password when the encryption key is not stored in the serial flash of the device, use:
• cipher = 1
• publicKeyLen = 16
• group1KeyLen = 0
• group2KeyLen = 0
• publicKey = put the key here (use a 16-character string)
• group1Key = NULL
• group2Key = NULL
To encrypt the password when the encryption key is stored in the serial flash of the device, use:
• cipher = 0
• publicKeyLen = 0
• group1KeyLen = 0
• group2KeyLen = 0
• publicKey = NULL
• group1Key = NULL
• group2Key = NULL
To avoid encrypting the password use:
• cipher = 1
• publicKeyLen = 0
• group1KeyLen = 0
• group2KeyLen = 0
• publicKey = NULL
• group1Key = NULL
• group2Key = NULL
After sending this command, SmartConfig will start.
When running SmartConfig manually, if a key to encrypt the password is stored in the external serial flash
or supplied at the command, it is necessary to supply this key in the SmartConfig Application.
After the device is connected to the requested network it should receive an IP address from the AP or
router.
If the SmartConfig operation does not end successfully, it could be because the Wi-Fi network to which
the smart phone is connected is using transmissions modes and rates that are not suitable for
SmartConfig. In this case, use the AP Provisioning method.
8.1.2 AP Mode
Scroll to the bottom of the web page and check that the device is added to the Profiles (the password will
not be displayed). See Figure 8-2.
Now start the device in STA Role. Go to the Device Config tab and set Device Mode to Station (or remove
the Force AP constraint) and reset the device. After resetting the device, the device connects
automatically to the requested network. See Figure 8-3.
8.1.3 WPS
Push-button: Push the WPS button in the AP or, if the button is not available, start the WPS process
using the GUI of the AP. The AP will enter the WPS provisioning process for 2 minutes. During this period,
the SimpleLink device should also enter the WPS provisioning process by calling the sl_WlanConnect
API with WPS parameters (see Section 8.1.3.3). For example, calling this API can be mapped to a push-
button in the MCU. At the end of this process, a wireless network with a network name and security is
configured automatically.
PIN-based: Enter the pin generated by the host using the GUI of the AP. The AP will enter WPS
provisioning process for 2 minutes. During this period, the SimpleLink device should also enter the WPS
provisioning process by calling the sl_WlanConnect API with WPS parameters (see Section 8.1.3.3). At
the end of this process, a wireless network with a network name and security is configured automatically.
Once the WPS process completes successfully, connection with the AP is established in the correct
security setting according to the configuration of the AP (Open, WEP, WPA, or WPA2). The connection
parameters are saved as a profile. Using the connection policy AUTO triggers a reconnection after a reset.
This API with the correct settings can trigger a WPS connection with both configurations: push-button and
PIN-based.
Parameter configuration:
• pName – NULL
• NameLen – 0
• unsigned char *pMacAddr – NULL
• SlSecParamsExt_t* pSecExtParams – not relevant for WPS, set as NULL
• Push-button:
– SlSecParams_t* pSecParams: Type – SL_SEC_TYPE_WPS_PBC (3)
Key – NULL
Key length – set to 0
• SlSecParams_t* pSecParams: Type – SL_SEC_TYPE_WPS_PIN (4)
Key – WPS pin code
Key length – WPS pin code length
int sl_WlanProfileGet(int Index,char* pName, int *pNameLen, unsigned char *pMacAddr,
SlSecParams_t* pSecParams, SlSecParamsExt_t* pEntParams, unsigned long *pPriority)
- This API retrieves the profile parameters which were saved during the WPS connection process.
sl_WlanProfileDel(int Index)
- This API is used to delete a profile. It can be used to delete the profile which was saved during the WPS
connection process. Calling this API with index set as 255 erases all stored profiles.
void main()
{
SlSecParams_t WPSsecParams;
Int status;
Int role;
if(role == ROLE_STA)
{
WPSsecParams.Type = SL_SEC_TYPE_WPS_PBC;
WPSsecParams.Key = NULL;
WPSsecParams.KeyLen = 0;
status = sl_WlanConnect(0,0,0,&WPSsecParams,0);
// PIN-based
void main()
{
SlSecParams_t WPSsecParams;
Int status;
Int role;
if(role == ROLE_STA) {
WPSsecParams.Type = SL_SEC_TYPE_WPS_PIN;
WPSsecParams.Key = "34374696"; //example pin code
WPSsecParams.KeyLen = 8;
status = sl_WlanConnect(0,0,0,&WPSsecParams,0);
Security
9.1.1 Personal
The Wi-Fi subsystem supports the Wi-Fi security types AES, TKIP & WEP. The personal security type and
personal security key are set in both the manual connection API or profiles connection API by the same
parameter type – SlSecParams_t. This structure consists of the following fields:
• Security Type – The type of security being used. Options include:
– SL_SEC_TYPE_OPEN – No security (default value).
– SL_SEC_TYPE_WEP – WEP security.
– SL_SEC_TYPE_WPA – Used for both WPA\PSK and WPA2\PSK security types, or a mixed mode
of WPA\WPA2 PSK security type (for example, TKIP, AES, mixed mode).
– SL_SEC_TYPE_WPA_ENT – WPS security. For more information refer to Section 8.1.3.
– SL_SEC_TYPE_WPS_PBC ENT – Push-button WPS security. For more information refer to
Section 8.1.3.
– SL_SEC_TYPE_WPS_PIN ENT – Pin-based WPS security. For more information refer to
Section 8.1.3.
• Key – A character area containing the pre-shared key (PSK) value.
• Key length – The number of characters of the pre-shared key.
Example code for adding a WPA2 secured AP profile:
secParams.Type = SL_SEC_TYPE_WPA;
secParams.Key = SEC_SSID_KEY;
secParams.KeyLen = strlen(SEC_SSID_KEY);
9.1.2 Enterprise
The sl_WlanConnect and the sl_WlanProfileAdd commands are used for different types of Wi-Fi
connection. The connect command is for a one-shot connection, and the add profile used when auto
connect is on (see the add profile white papers). Use those commands with extra security parameters for
the enterprise connection – SlSecParamsExt_t.
A short view of the first five parameters of those commands follows. (Learn more of the extra parameters
of the add profile command in its white paper.)
1. SSID name – The name of the Wi-Fi network
2. SSID length
3. Flags - Not applicable for enterprise connection
4. Pointer to SlSecParams_t -
typedef struct
{
unsigned char Type; - type should be SL_SEC_TYPE_WPA_ENT
char* Key; - a key password for the enterprise connection that
must have it. MSCHAP, FAST ETC.
unsigned char KeyLen;
}SlSecParams_t;
5. Pointer to SlSecParamsExt_t-
typedef struct
{
char* User; - the enterprise user name
unsigned char UserLen;
char* AnonUser; - the anonymous user name (optional) for two phase
enterprise connections.
unsigned char AnonUserLen;
unsigned char CertIndex; - not supported
unsigned long EapMethod; -
SL_ENT_EAP_METHOD_TLS
SL_ENT_EAP_METHOD_TTLS_TLS
SL_ENT_EAP_METHOD_TTLS_MSCHAPv2
SL_ENT_EAP_METHOD_TTLS_PSK
SL_ENT_EAP_METHOD_PEAP0_TLS
SL_ENT_EAP_METHOD_PEAP0_MSCHAPv2
SL_ENT_EAP_METHOD_PEAP0_PSK
SL_ENT_EAP_METHOD_PEAP1_TLS
SL_ENT_EAP_METHOD_PEAP1_MSCHAPv2
SL_ENT_EAP_METHOD_PEAP1_PSK
SL_ENT_EAP_METHOD_FAST_AUTH_PROVISIONING
SL_ENT_EAP_METHOD_FAST_UNAUTH_PROVISIONING
SL_ENT_EAP_METHOD_FAST_NO_PROVISIONING
}SlSecParamsExt_t;
9.1.2.3 Example
Figure 9-1 shows an example of a simple WLAN connect command to an enterprise network.
9.1.2.4 Limitations
There is no command to bind a certificate file to a WLAN enterprise connection. The certificates of the
network must be programmed with the names specified in Section 9.1.2.2.
Addr.sin_family = SL_AF_INET;
Addr.sin_port = sl_Htons(443); // secured connection
Addr.sin_addr.s_addr = sl_Htonl(DestinationIP);
AddrSize = sizeof(SlSockAddrIn_t);
SockID = sl_Socket(SL_AF_INET,
SL_SOCK_STREAM,
SL_SEC_SOCKET);
if( SockID < 0 )
{
// error
while (1);
}
Sl_SetSockOpt(sockID,
SL_SOL_SOCKET,
SL_SO_SECURE_FILES_CA_FILE_NAME,
”rootCA.der”,
strlen(“rootCA.der”));
Status = sl_Connect(SockID,
( SlSockAddr_t *) &Addr,
AddrSize);
return SockID;
}
AP Mode
This function sets the user parameter to configure. The input parameters are:
• ConfigId – Should be set to SL_WLAN_CFG_AP_ID (0) or SL_WLAN_CFG_GENERAL_PARAM_ID
(1), according to the parameter
• ConfigOpt – Identifies the parameter to configure
• ConfigLen – Should be the parameter size in bytes
• pValues – Pointer to memory containing the parameter
Note: This change will take affect after reset.
Table 10-1 describes how to configure each parameter.
ipV4.ipV4DnsServer = 0x09080706;
sl_NetCfgSet(SL_IPV4_AP_P2P_GO_STATIC_ENABLE,
1
,sizeof(_NetCfgIpV4Args_t),
(unsigned char *)
&ipV4);
Where SL_NET_APP_DHCP_SERVER_ID is 2.
To stop DHCP server call:
sl_NetAppStop(SL_NET_APP_DHCP_SERVER_ID);
dhcpParams.ipv4_addr_last = 0x09080705;
sl_NetAppSet(SL_NET_APP_DHCP_SERVER_ID,
NETAPP_SET_DHCP_SRV_BASIC_OPT,
outLen,
(unsigned char*)
&dhcpParams);
Default value:
lease_time = 24 * 3600; /* 24 hours */
ipv4_addr_start = 0xc0a80102; /* 192.168.1.2 */
ipv4_addr_last = 0xc0a801fe; /* 192.168.1.254 */
Note: The DHCP server addresses must be in the subnet of the AP IP address. The changes will take
affect after reset.
Where SL_NET_APP_DEVICE_CONFIG_ID = 16
NETAPP_SET_GET_DEV_CONF_OPT_DEVICE_URN = 0
// Set AP IP params
ipV4.ipV4 = SL_IPV4_VAL(192,168,1,1);
ipV4.ipV4Gateway = SL_IPV4_VAL(192,168,1,1);
ipV4.ipV4DnsServer = SL_IPV4_VAL(192,168,1,1);
sl_NetCfgSet( SL_IPV4_AP_P2P_GO_STATIC_ENABLE,
1
,sizeof(_NetCfgIpV4Args_t),
(unsigned char *)
&ipV4);
//Set AP mode
sl_WlanSetMode(ROLE_AP);
//Set AP SSID
sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_SSID, strlen("cc_ap_test1"),
(unsigned char *)"cc_ap_test1");
//Set AP country code
sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID,
WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE, 2,(unsigned char *)"US");
//Set AP Beacon interval
beacon_int = 100;
sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_BEACON_INT, 2, (unsigned char
*)
&beacon_int);
//Set AP channel
channel = 8;
sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_CHANNEL, 1, (unsigned char
*)
&channel);
//Set AP hidden/broadcast configuraion
hidden = 0;
sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_HIDDEN_SSID, 1, (unsigned char
*)
&hidden);
//Set AP DTIM period
dtim = 2;
sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_DTIM_PERIOD, 1, (unsigned char
*)
&dtim);
//Set AP security to WPA and password
sec_type = SL_SEC_TYPE_WPA;
sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_SECURITY_TYPE, 1, (unsigned
char *)
&sec_type);
sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_PASSWORD,
strlen("password123"), (unsigned char *)"password123");
sl_Stop(100);
sl_Start(NULL, NULL, NULL);
//Get AP SSID
sendLog("**********************AP parameters***********************\n");
config_opt = WLAN_AP_OPT_SSID;
config_len = MAXIMAL_SSID_LENGTH;
sl_WlanGet(SL_WLAN_CFG_AP_ID,
&config_opt , &config_len, (unsigned
char*) ssid);
sendLog("SSID: %s\n",ssid);
//Get AP country code
config_opt = WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE;
config_len = 3;
sl_WlanGet(SL_WLAN_CFG_GENERAL_PARAM_ID,
&config_opt, &config_len,
(unsigned char*) country);
sendLog("Country code: %s\n",country);
11.1.1 Scope
P2P mode in CC3100 lets the device connect to other devices without the need for an AP by inheriting the
entire station of AP attributes.
11.1.4 Limitations
• No service discovery supported.
• No GO-NoA supported.
• Smart configuration for P2P device entry is limited to 15 entries, and is dynamically allocated rather than
optimized as a station scan single entry.
• No autonomous group support for the user, although the mode is internally supported and can be
opened to the user.
• P2P group owner mode supports single peer (client) connected (similar to AP).
• P2P Find in profile search and connection is infinite, meaning if the remote device is not found the
search will continue indefinitely.
This API puts the device in P2P mode. All other P2P configurations will not be effected until entering P2P
mode.
This API sets the network configuration used when the P2P role is set.
sl_NetAppSet (SL_NET_APP_DEVICE_CONFIG_ID,
NETAPP_SET_GET_DEV_CONF_OPT_DEVICE_URN,
strlen(device_name),
(unsigned char *) device_name);
For example:
sl_WlanPolicySet(SL_POLICY_P2P,
SL_P2P_POLICY(SL_P2P_ROLE_NEGOTIATE,
SL_P2P_NEG_INITIATOR_RAND_BACKOFF
) //macro,
&policyVal,
0
);
For example:
sl_WlanPolicySet(SL_POLICY_P2P,
SL_CONNECTION_POLICY(true, true, false, false) //macro,
&policyVal,
0
);
The second parameter enables the P2P scan operation, and the interval indicates the waiting time
between P2P find cycles.
Index – Indicates to which index in the list tables the P2P devices will return.
Count - Shows how many peer devices should be returned (if existed).
pEntries – The results are entered in to it. It is allocated by the user.
As stated in Section 11.2.3, the negotiation starts according to the intent and negotiation initiator
parameters, but other parameters should be configured to finish this step successfully. These parameters
influence the negotiation method and are supplied during the manual connection API command that
comes from the host or when setting the profile for automatic connection. The negotiation method is done
by the device without user interference.
There are two P2P negotiation methods to indicate the WPS phase that follows the negotiation:
• P2P push-button connection – Both sides negotiate with PBC method. Define
SL_SEC_TYPE_P2P_PBC.
• P2P pin code connection – Divided to two options. PIN_DISPLAY looks for a pin to be written by its
remote P2P. PIN_KEYPAD sends a pin code to its remote P2P.
– Define SL_SEC_TYPE_P2P_PIN_KEYPAD.
– Define SL_SEC_TYPE_P2P_ PIN_DISPLAY.
Note: If no pin code is entered, the NWP auto-generates the pin code from the device MAC using the
following method:
1. Take the 7 ISB decimal digits in the device MAC address, and add checksum of those 7 digits to the
LSB (total 8 digits). For example, if MAC is 03:4A:22:3B:FA:42
2. Convert to decimal: ….:059:250:066
3. Seven ISB decimal digits are: 9250066
4. WPS Pin Checksum digit: 2
5. Default pin code for this MAC: 92500662
There are two options to configure the negotiation method:
• Setting the value in secParams struct and sending it as a parameter through the manual connection
command.
– For push-button: secParams.Type = SL_SEC_TYPE_P2P_PBC
– For pin code keypad: secParams.Type = SL_SEC_TYPE_ PIN_KEYPAD secParams.Key =
12345670
– For pin code diaplay: secParams.Type = SL_SEC_TYPE_ PIN_ DISPLAY secParams.Key =
12345670
• Sending the negotiation method defines and key as parameters through the P2P profile configuration.
pName – The name of the remote device which is known to the user after getting event
SL_WLAN_P2P_DEV_FOUND_EVENT or by calling to get_networkList API.
NameLen – The length of pName
pMacAddr – The option to connect to a remote P2P according to its BSSID. Use {0,0,0,0,0,0} to connect
according to MAC address.
pSecParams – See Section 11.2.5.
3. Configure P2P profile policy connection with auto-start and fast connection.
SL_CONNECTION_POLICY(true, false, false, false)
4. Configure P2P profile according to the willing parameters of the remote device such as name, MAC
address, and so forth
5. If the peer parameters are unknown, operate a discover P2P operation, find P2P peers, and then
configure profiles.
sl_WlanProfileAdd(
SL_SEC_TYPE_P2P_PBC,
remote_p2p_device,
strlen(remote_p2p_device),
bssidEmpty,
0, //unsigned long Priority,
0,//unsigned char *pKey,
0,//unsigned long KeyLen,
0//unsigned long Options)
);
sl_Stop(1);
sl_Start(NULL, NULL, NULL);
HTTP Server
12.1 Overview
The HTTP web server allows end-users to remotely communicate with the SimpleLink device using a
standard web browser.
The HTTP web server enables the following functions:
• Device configuration
• Device status and diagnostic
• Application-specific functionality
HTTP stands for Hypertext Transfer Protocol. HTTP is a client/server protocol used to deliver hypertext
resources (HTML web pages, images, query results, and so forth) to the client side. HTTP works on top of
a predefined TCP/IP socket, usually port 80.
The SimpleLink HTTP server handles the HTTP request. The server listens on the HTTP socket (default is
80). According to the request type, such as HTTP GET or HTTP POST, the server handles the request
URI resource and content. The server then composes a correct HTTP response and returns it to the client.
The SimpleLink server communicates with the serial flash file system, which hosts the web page files. The
files are saved in the serial flash under their own filename. Filenames can include the full path to achieve
a directory structure-like behavior. For security purposes, the ability of the web server to access the file
system is limited to the following root folders:
(a) www/
(b) www/safe/
Important: One of these two root folders should be prefixed to the filename when downloading files to the
file system.
The www/safe/ folder is also used in Force AP mode. For details, see Section 12.5.
The SimpleLink server holds an internal set of web pages statically, on ROM, which serves as an internal
default web page. The internal web page provides out-of-the-box device configuration, status, and basic
analysis tools.
The SimpleLink server also has an interface to the host (through the SimpleLink commands and events
dispatcher module) in order to implement the user API.
12.2.1 Overview
When the HTTP web server gets an HTTP GET request, it first checks the resource URN of the HTTP
request for the name of the requested resource. The server then checks if this resource exists in the serial
flash. If the resource exists, the server returns it as part of the HTTP response.
If the server does not find the requested resource on the flash, the server checks if this resource is one of
the files of the internal web page in the ROM. If the resource is a file of the web page, the server returns
the resource; if not, an HTTP error message is sent (HTTP/1.0 404 Not Found response).
Important: To prevent user tokens from colliding with the internal tokens, use tokens with the following
structure: __SL_G_UXX, where XX can be any character or number.
12.3.1 Overview
The client uses HTTP POST requests to update data in the server. The SimpleLink HTTP web server
supports HTML forms with content type of application/x-www-form-urlencoded. The POST information that
is sent by the browser includes the form action name and one or more pairs of variable name and variable
value.
In complex POST actions, the server should gather all the needed POST parameters and then trigger a
specific action (such as add profile). In this case, the action is identified by the action value in the HTTP
POST command.
12.3.7 HTML Sample Code with POST and Dynamic HTML Content
In the following POST example, once the user clicks on the submit button the POST request includes the
profiles_add.html as the action resource and the variables __SL_P_P.A and __SL_P_P.B with the values
that the user requested.
<form method="POST" name="SimpleLink Configuration" action="profiles_add.html">
<tr>
<td dir=LTR> SSID: </td>
<td dir=LTR><input type="text" maxlength="32" name="__SL_P_P.A" /> Enter any value of up to 32
characters</td>
</tr>
<tr>
<td dir=LTR> Security Type: </td>
<td dir=LTR> <input type="radio name="__SL_P_P.B" value="0" checked />Open
<input type="radio" name="__SL_P.P.B" value="1" />WEP
<input type="radio" name="__SL_P_P.B" value="2" />WPA1
<input type="radio" name="__SL_P_P.B" value="3" />WPA2 </td>
</tr>
<tr>
<td colspan=2 align=center><input type="submit" value="add"/></td>
</tr>
</form>
In the following example, when the page is displayed (HTTP GET), the __SL_G_N.A is replaced by the
HTTP web server with the current IP address value, displayed in the input box. When the user changes
and submits the IP address, the new value is sent with the __SL_P_N.A variable.
SlHttpServerEventData_u EventData;
}SlHttpServerEvent_t;
typedef struct
{
SlHttpServerResponsedata_u ResponseData;
}SlHttpServerResponse_t;
typedef union
{
slHttpServerString_t token_value; /*
< 64 bytes*/
} SlHttpServerResponsedata_u;
typedef struct _slHttpServerString_t
{
UINT8 len;
UINT8 *data;
} slHttpServerString_t;
typedef struct _slHttpServerPostData_t
{
slHttpServerString_t action;
slHttpServerString_t token_name;
slHttpServerString_t token_value;
}slHttpServerPostData_t;
/* Response using driver memory - Copy the token value to the Event response
Important - Token value len should be < MAX_TOKEN_VALUE_LEN (64 bytes) */
HandleTokenPost (pHttpServerEvent->EventData.httpPostData.action,
pHttpServerEvent->EventData.httpPostData.token_name,
pHttpServerEvent->EventData.httpPostData.token_value);
}
break;
default:
break;
}
}
Important: For the HTTP callback to work the following line should be uncommented in user.h:
#define sl_HttpServerCallback SimpleLinkHttpServerCallback
Important: After setting a new port number, restart the server for the configuration to occur.
GET tools:
POST tools:
mDNS
13.1 Overview
The mDNS and DNS-SD feature provides the ability to find and advertise services on its local network,
and resolve host names to IP addresses without using a local name server.
By supporting RFCs 6762 and 6763, the mDNS module advertises services, sends query responses to
peer queries, and listens to peer advertisements.
mDNS uses the same programming interfaces, packet formats, and operating semantics as the unicast
Domain Name System (DNS), except that mDNS uses IP multicast User Datagram Protocol (UDP)
packets.
By default, mDNS exclusively resolves host names ending with the .local top-level domain (TLD).
The mDNS Ethernet frame is a multicast UDP packet to:
• MAC address 01:00:5E:00:00:FB
• IPv4 address 224.0.0.251 or IPv6 address FF02::FB
• UDP port 5353
The mDNS is stopped and started only for the current role. Other mDNS configurations are common to all
roles.
The mDNS can be configured if the role has no interface (for example, if the station is not connected or
P2P is not upped). The configuration is the same for all roles and is not related to a specific role (other
than start and stop).
mDNS frames (advertise, response to queries) are sent only if there is a valid IP address.
mDNS works if one of the following conditions is met:
• Station is connected
• P2P is upped (GO or client)
• AP is upped
The user sets a service name Full or Part (see the following example) and should get:
• IP of service
• The port of service
• The text of service
Similar to the get host by name method, a single-shot query with PTR type on the service name can make
a connection to the specific service and use it.
Note: The user only gets resource records of one adapted service.
Because all services adapted to the query send their answers at different times, use the API
sl_NetAppGetServiceList to see the RR of all answers.
Return:
0 – Success.
<0 – A kind of error
API name:
long sl_NetAppDnsGetHostByService(char *pServiceName,
unsigned char ServiceLen,
unsigned char Family,
unsigned long pAddr[],
unsigned long *pPort,
unsigned short *pTextLen,
char *pText
);
Parameters:
Example:
long Status = 0;
char out_pText[NETAPP_MAX_SERVICE_TEXT_SIZE];
short inout_TextLen;
unsigned long IPv4Addr;
unsigned long out_pPort;
unsigned char ServiceNameIPP[50] = "_ipp._tcp.local";
while (Status != 0)
{
//Find IPP service
inout_TextLen = NETAPP_MAX_SERVICE_TEXT_SIZE;
Status = sl_NetAppDnsGetHostByService( ServiceNameIPP,
strlen(ServiceNameIPP),
SL_AF_INET,
&IPv4Addr,
&out_pPort,
&inout_TextLen,
&out_pText[0]
);
API name:
int sl_NetAppGetServiceList(unsigned char IndexOffest,
unsigned char MaxServiceCount,
unsigned char Flags,
char *pBuffer,
unsigned long RxBufferLength
);
Parameters:
} SlNetAppGetServiceListType_e;
typedef struct
{
unsigned long service_ipv4;
Type of short service
unsigned short service_port;
unsigned short Reserved;
}SlNetAppGetShortServiceIpv4List_t;
typedef struct
{
unsigned long service_ipv4;
unsigned short service_port;
unsigned short Reserved;
Type of full service
unsigned char
service_name[NETAPP_MAX_SERVICE_NAME_SIZE];
unsigned char
service_host[NETAPP_MAX_SERVICE_HOST_NAME_SIZE];
}SlNetAppGetFullServiceIpv4List_t;
typedef struct
{
unsigned long service_ipv4;
unsigned short service_port;
unsigned short Reserved;
unsigned char
Type of short service with text
service_name[NETAPP_MAX_SERVICE_NAME_SIZE];
unsigned char
service_host[NETAPP_MAX_SERVICE_HOST_NAME_SIZE];
unsigned char
service_text[NETAPP_MAX_SERVICE_TEXT_SIZE];
}SlNetAppGetFullServiceWithTextIpv4List_t;
Example:
char BufferList[1500];
int Status;
int index,serviceIndex,serviceCount;
unsigned int IPv4Addr;
SlNetAppGetShortServiceIpv4List_t *ShortService;
SlNetAppGetFullServiceIpv4List_t *FullService;
SlNetAppGetFullServiceWithTextIpv4List_t *FullServiceWithText;
/*************************************************************************************************
***************/
//Get all full services that are in the peer cache.
if(Status >0)
{
for(index = 0; index < Status; index ++)
{
FullService =
(SlNetAppGetFullServiceIpv4List_t*)(&BufferList[index*sizeof(SlNetAppGetFullServiceIpv4List_t)
]);
printf("index %d\n",index);
IPv4Addr = FullService->service_ipv4;
printf("IP
%d.%d.%d.%d\n",SL_IPV4_BYTE(IPv4Addr,3),SL_IPV4_BYTE(IPv4Addr,2),SL_IPV4_BYTE(IPv4Addr,1),SL_IPV4_
BYTE(IPv4Addr,0));
//printf("service_ipv4 %x\n",FullService->service_ipv4);
printf("service_port %d\n",FullService->service_port);
printf("service_name %s\n",FullService->service_name);
printf("service_host %s\n",FullService->service_host);
printf("\n\n");
}
}
/*************************************************************************************************
***************/
/*************************************************************************************************
***************/
//Get short services that are in the peer cache.
if(Status > 0)
{
for(index = 0; index < Status ; index ++)
{
shortService =
(SlNetAppGetShortServiceIpv4List_t*)(&BufferList[index*sizeof(SlNetAppGetShortServiceIpv4List_
t)]);
printf("index %d\n",index);
IPv4Addr = ShortService->service_ipv4;
printf("IP
\n",SL_IPV4_BYTE(IPv4Addr,3),SL_IPV4_BYTE(IPv4Addr,2),SL_IPV4_BYTE(IPv4Addr,1),SL_IPV4_BYTE(IPv4Ad
dr,0));
//printf("service_ipv4 %x\n",ShortService->service_ipv4);
printf("service_port %d\n",ShortService->service_port);
printf("\n\n");
}
}
/*************************************************************************************************
***************/
/*************************************************************************************************
***************/
//Get full services with text with loop that are in the peer cache.
do
{
serviceIndex = serviceIndex + Status;
Status =
sl_NetAppGetServiceList(serviceIndex,serviceCount,SL_NET_APP_FULL_SERVICE_WITH_TEXT_IPV4_TYPE,Buff
erList,1500);
printf("getServiceList StartServiceIndex %d\n num of requested services %d\n service struct
type %d\n num of returned %d\n",
serviceIndex,serviceCount,SL_NET_APP_FULL_SERVICE_WITH_TEXT_IPV4_TYPE,Status);
if(Status > 0 )
{
for(index = 0; index < Status ; index ++)
{
FullServiceWithText =
erviceWithTextIpv4List_t*)(&BufferList[index*sizeof(SlNetAppGetFullServiceWithTextIpv4List_t)]
);
printf("index %d\n",index);
IPv4Addr = FullServiceWithText->service_ipv4;
printf("IP
_IPV4_BYTE(IPv4Addr,3),SL_IPV4_BYTE(IPv4Addr,2),SL_IPV4_BYTE(IPv4Addr,1),SL_IPV4_BYTE(IPv4Addr,0))
;
//printf("service_ipv4 %x\n",FullServiceWithText->service_ipv4);
printf("service_port %d\n",FullServiceWithText->service_port);
}
}
API name
int sl_NetAppMDNSRegisterService( const char* pServiceName,
unsigned char ServiceNameLen,
const char* pText,
unsigned char TextLen,
unsigned short Port,
unsigned long TTL,
unsigned long Options);
Parameters:
Example:
unsigned char AddService1[40] = "SimpleLinkPrinter553321._ipp._tcp.local";
API name:
int sl_NetAppMDNSUnRegisterService( const char *pServiceName,
unsigned char ServiceNameLen);
Parameters:
Example:
unsigned char AddService1[40] = "SimpleLinkPrinter553321._ipp._tcp.local";
Return:
= 0 – Success
<0 – A kind of error
API name:
long sl_NetAppSet(unsigned char AppId ,
unsigned char Option,
unsigned char OptionLen,
Example:
//mask IPP service
unsigned int EventMask = SL_NET_APP_MASK_IPP_TYPE_OF_SERVICE;
Status = sl_NetAppSet(SL_NET_APP_MDNS_ID,
NETAPP_SET_GET_MDNS_QEVETN_MASK_OPT,
sizeof(EventMask), (unsigned char*)&EventMask );
printf("event Mask status %d\n",Status);
API name:
long sl_NetAppSet( unsigned char AppId ,
unsigned char Option,
unsigned char OptionLen,
unsigned char *pOptionValue);
Example:
unsigned char name[40] = "_ipp._tcp.local";
Return:
= 0 – Success
<0 – A kind of error
API name:
Example:
SlNetAppServiceAdvertiseTimingParameters_t TimingParams;
TimingParams.t = 200;
TimingParams.p = 2;
TimingParams.k = 2;
TimingParams.RetransInterval = 0;
TimingParams.Maxinterval = 0xffffffff;
TimingParams.max_time = 5;
API name:
long sl_NetAppGet( unsigned char AppId ,
unsigned char Option,
unsigned char OptionLen,
unsigned char *pOptionValue);
Example:
char BufferList[1500];
unsigned char GetLen = 100;
unsigned int *GetEventMask;
Return:
= 0 – Success
<0 – A kind of error
API name:
long sl_NetAppGet( unsigned char AppId ,
unsigned char Option,
unsigned char OptionLen,
unsigned char *pOptionValue);
Example:
char BufferList[1500];
unsigned char GetLen = 100;
Return:
= 0 – Success
<0 – A kind of error
API name:
long sl_NetAppGet( unsigned char AppId ,
unsigned char Option,
Example:
char BufferList[1500];
unsigned char GetLen = 100;
SlNetAppServiceAdvertiseTimingParameters_t *GetTimingParams;
14.1 Overview
In a secure file system:
• The file system tables are encrypted.
• The creation of secure files is enabled.
• The maximum number of files supported is 128.
• The file system is blocked after three security alerts.
Secure files characteristics:
• Kept encrypted on the storage
• Authenticated
• Read or write access only allowed to authorized users
14.8 Tokens
Tokens are relevant only for secure files. Secure files can only be created on a secured chip; otherwise
the secure file options are ignored.
When a secure file is created, the following tokens are created:
• Master
• Read/Write
• Read only
• Write only
The master token is returned upon file creation (the create function has an in/out parameter which is the
token). The other tokens can be received by invoking the GetInfo function with the token as the parameter.
If the GetInfo function is invoked with the master token, it returns the other three tokens. The function
always returns tokens which have a level lower than the input token.
Without an appropriate token the user cannot open the file for read or write or delete the file. Deleting a
file requires the master token.
Using the read token, the user can open the file for read and not for write. This could be used in the case
of a logo file, which may be displayed on the web pages but not changed.
Trying to open a secure file with an invalid token (or NULL token) creates a security alert.
When the file is opened for write, all the tokens other than the master token are recreated (the file creator
can define different behavior when creating the file = STATIC option).
More token creation options:
• Creating a secure file with public read permission (no token required for read) or public write (no token
required for write).
• When creating the file, the master token may be set by the creator (vendor option).
14.9 Signature
Secure files are created with a signature test, by using the no_signature_test_flag, or no file authentication
occurs.
The file signature is supplied as part of the file close function.
A file created with a signature test authenticates during the close function and every time the file is
opened for read/write.
The signature is RSA-SHA1 (key can be sized 1024 or 2048). Certificate chain is also supported.
To sign the files the following steps are required:
1. Create a private key: \\OpenSSL-Win32\\bin\\openssl genrsa -out [PrivateKey.PEM] [1024|2048]
2. Transform the private key to DER format: \\OpenSSL-Win32\\bin\\openssl rsa -in [PrivateKey.PEM] -
inform PEM -out [PrivateKey.DER] -outform DER
3. Create a certificate request using the private key DER format: \\OpenSSL-Win32\\bin\\openssl req
–new –key [PrivateKey.DER] –out [certific.pem]
4. Send the certificate request [Certfile.pem] file to TI, to receive a TI certificate.
5. Transform the certificate from .pem format to .der format: "C:\\OpenSSL-Win32\\bin\\openssl x509 -in
[Certfile.pem] -inform PEM -out [Certfile.der] -outform DER
6. Download the TI certificate [Certfile.der] as a nonsecure file to the device.
7. The private key can be used to create the signature for the secure files. \\OpenSSL-
Win32\\bin\\openssl dgst -binary -sha1 -sign [PrivateKey.PEM] -out [SecureFile1_Signature.bin]
[InputFile.txt]
//Open for write secure file with signature with size 63K
RetVal = sl_FsOpen((unsigned char *)DeviceFileName,
FS_MODE_OPEN_CREATE(63*1024 , _FS_FILE_OPEN_FLAG_SECURE),
&MasterToken,
&FileHandle);
//Write to file
RetVal = sl_FsWrite(FileHandle,
(unsigned int)Offset
(unsigned char *)Buffer, BufferSize);
//Close
RetVal = sl_FsClose( FileHandle, 0, 0, 0);
Rx Filter
15.1 Overview
The Rx-filters module lets the user define which of the received frames will be transferred by the CC3100
to the host and which frames will be dropped. The Rx-filters can be activated during AP-connection and
during promiscuous mode (disconnect mode).
15.3 Examples
Example 1 – Supposing a user has the following requirements:
• Receive WLAN data broadcast frames only from two specific MAC addresses
• Receive all WLAN unicast frames, except for frames with a certain SRC_IP address range
• If a unicast frame is received from MAC address AA.AA.AA, increase counter_1.
• If a unicast frame is received from MAC address BB.BB.BB, increase counter_2.
• If a unicast UDP frame is received from MAC address AA.AA.AA or BB.BB.BB, pass only packets from
port 5001.
The following trees should be created: Figure 15-1
memset(FilterPrePreparedFiltersMask, 0, sizeof(FilterPrePreparedFiltersMask));
FilterPrePreparedFiltersMask[ 0 ] = 0xF0;
RetVal = sl_WlanRxFilterPrePreparedFiltersOperation(
FilterPrePreparedFiltersOperation , FilterPrePreparedFiltersMask );
}
break;
case '7' : //update filter args
{
SlrxFilterRuleHeaderArgsAndMask_t FilterRuleHeaderArgsAndMask;
unsigned char BinaryRepresentation = 1;
FilterId = 9;
memcpy( FilterRuleHeaderArgsAndMask.RuleHeaderArgs.RxFilterDB4BytesRuleArgs,
MyLabCompIPAddress , 4 );
memcpy( FilterRuleHeaderArgsAndMask.RuleHeaderArgsMask, MyMAsk , 4 );
FilterRuleHeaderArgsAndMask.RuleHeaderArgs.RxFilterDB4BytesRuleArgs[0][0] = 0xBB;
FilterRuleHeaderArgsAndMask.RuleHeaderArgsMask[ 0 ] = 0xDD;
RetVal = sl_WlanRxFilterUpdateFilterArgs( FilterId ,
&FilterRuleHeaderArgsAndMask , BinaryRepresentation );
}
break;
}
//*****************************************************************************
// RX filters
//*****************************************************************************
Transceiver Mode
The user could use the entire frame's space starting from the 802.11 header (excluding the duration field)
to receive and transmit data.
In transceiver mode, there are no frame acknowledgments or retries. Therefore there are no guarantees
that the frame will reach its destination. When working in L1 mode, there may be collisions with other
frames or energy.
Figure 16-1 illustrates the 802.11 frame structure. The white sections are user-configurable, and the
grayed part cannot be overwritten.
SL_AF_RF – Indicates from what level of network the user can override the frame.
SL_SOCK_RAW – Indicates an L1 raw socket (no respect for 802.11 medium access policy (CCA))
SL_SOCK_DGRAM – Indicates an L2 raw socket (respecting 802.11 medium access policies)
channel – Configures the operational channel to start receiving or transmitting traffic. Use 0 to keep the
default channel.
This command returns a socket ID, a two byte integer that will be used to reference the socket. If there is
a problem with the socket, the command will return an error code.
To close the socket, use the command sl_Close:
sl_Close(soc);
soc – Socket ID
RawData – The char *array holds the data to send, beginning with the first byte of the 802.11 MAC
header.
len – The size of the data in bytes
flags – Usually the user sets this parameter to 0, but the user can change any of the default
channel/rate/tx-power/11b-preamble parameters using this parameter. Use the
SL_RAW_RF_TX_PARAMS macro to specify the mentioned parameters.
Returns – The number of bytes sent
For example, to transmit a frame on channel 1 using the 1MBPS data rate with Tx power setting of 1 and
short preamble (valid only for 11b), use:
sl_Send(soc,buf,len,SL_RAW_RF_TX_PARAMS(CHANNEL_1, RATE_1M,1, TI_SHORT_PREAMBLE));
sl_Recv(soc,buffer,500,0);
soc – Socket ID
buffer – The char *array used for containing the received packet
500 – The maximum size of the packet received. The max size is 1472: if the packet is longer, the rest will
be discarded.
The last argument should always be 0, which indicates no flags.
Return – The number of bytes sent
16.8.1 Receiving
The packet being received has a SimpleLink proprietary radio header attached to it. The header has some
information about the packet. This is the structure of the header.
The rate is an index from 0 to 20 in the following order:
RATE 1M = 0
RATE 2M = 1
RATE 5.5M = 2
RATE 11M = 3
RATE 6M = 4
RATE 9M = 6
RATE 12M = 7
RATE 18M = 8
RATE 24M = 9
RATE 36M = 10
RATE 48M = 11
RATE 54M = 12
RATE MCS_0 = 13
RATE MCS_1 = 14
RATE MCS_2 = 15
RATE MCS_3 = 16
RATE MCS_4 = 17
RATE MCS_5 = 18
RATE MCS_6 = 19
RATE MCS_7 = 20
The channel is 1 to 11.
If using the sl_Recv command resulted in a frame in a buffer, extract the header by casting the start of
the buffer to a pointer variable in type of TransceiverRxOverHead_t
frameRadioHeader = (TransceiverRxOverHead_t *)buffer;
16.9.1 Sniffer
The transceiver can be used as a sniffer. Open a socket and receive packets in a loop using the sl_Recv
command. The following code describes how to capture frames and present them in wireshark:
16.10 TX Continues
This application transmits the same packet in continues. This application tags and measures loss using
the Rx Statistics feature. The following code shows how to use this feature:
Rx Statistics
RATE_24M
RATE_36M
RATE_48M
RATE_54M
RATE_MCS_0
RATE_MCS_1
RATE_MCS_2
RATE_MCS_3
RATE_MCS_4
RATE_MCS_5
RATE_MCS_6
RATE_MCS_7
NUM_OF_RATE_INDEXES is 21.
RssiHistogram[SIZE_OF_RSSI_HISTOGRAM] – Histogram that holds the accumulated RSSI of all
received packets between -40 and -87 dbm every 8 dbm.
SIZE_OF_RSSI_HISTOGRAM is 6
Padding[1]
StartTimeStamp – Holds the start collecting time in microsec
GetTimeStamp – Holds the statistics get time in microsec
API Overview
This chapter discusses the different SimpleLink APIs. The chapter does not cover the number of
parameters, parameter types, or return values. For that information, refer to the API doxygen guide.
The APIs are separated into six main groups:
• Device
• NetConfig
• WLAN
• Socket
• NetApp
• File System
18.1 Device
The device APIs handle the device power and general configuration.
Sl_Start – This function initializes the communication interface, sets the enable pin of the device, and
calls to the init complete callback. If no callback function is provided, the function is blocking until the
device finishes the initialization process. The device returns to its functional role in case of success:
ROLE_STA, ROLE_AP, ROLE_P2P. Otherwise, in case of a failure it returns: ROLE_STA_ERR,
ROLE_AP_ERR, ROLE_P2P_ERR
Sl_Stop – This function clears the enable pin of the device, closes the communication interface, and
invokes the stop complete callback (if it exists). The timeout parameter enables the user to control the
hibernate timing:
• 0 – Enter to hibernate immediately
• 0xFFFF – The host waits for the device to respond before hibernating, without timeout protection.
• 0 < Timeout[msec] < 0xFFFF – The host waits for the device to respond before hibernating, with a
defined timeout protection. This timeout defines the maximum time to wait. The NWP response can be
sent earlier than this timeout.
sl_DevSet – This function configures different device parameters. The main parameters used are the
DeviceSetID and Option. The possible DeviceSetID and Option combinations are:
• SL_DEVICE_GENERAL_CONFIGURATION – The general configuration options are:
– SL_DEVICE_GENERAL_CONFIGURATION_DATE_TIME – Configures the device internal date
and time. Note that the time parameter is retained in hibernate mode but will reset in shutdown.
sl_DevGet – This function enables the user to read different device parameters. The main parameters
used are the DeviceSetID and Option parameter. The possible DeviceSetID and Option combinations are:
• SL_DEVICE_GENERAL_VERSION – Returns the device firmware versions
• SL_DEVICE_STATUS – The device status options are:
– SL_EVENT_CLASS_DEVICE – Possible values are:
• EVENT_DROPPED_DEVICE_ASYNC_GENERAL_ERROR – General system error, please
check your system configuration.
• STATUS_DEVICE_SMART_CONFIG_ACTIVE – Device in SmartConfig mode.
– SL_EVENT_CLASS_WLAN – Possible values are:
• EVENT_DROPPED_WLAN_WLANASYNCONNECTEDRESPONSE
• EVENT_DROPPED_WLAN_WLANASYNCDISCONNECTEDRESPONSE
• EVENT_DROPPED_WLAN_STA_CONNECTED
• EVENT_DROPPED_WLAN_STA_DISCONNECTED
• STATUS_WLAN_STA_CONNECTED
• SL_EVENT_CLASS_BSD – Possible values are:
– EVENT_DROPPED_SOCKET_TXFAILEDASYNCRESPONSE
• SL_EVENT_CLASS_NETAPP – Possible values are:
– EVENT_DROPPED_NETAPP_IPACQUIRED
– EVENT_DROPPED_NETAPP_IP_LEASED
– EVENT_DROPPED_NETAPP_IP_RELEASED
• SL_EVENT_CLASS_NETCFG
• SL_EVENT_CLASS_NVMEM
Example for getting version:
SlVersionFull ver;
pConfigOpt = SL_DEVICE_GENERAL_VERSION;
sl_DevGet(SL_DEVICE_GENERAL_CONFIGURATION, &pConfigOpt,&pConfigLen,(unsigned char
*)(&ver));
printf("CHIP %d\nMAC 31.%d.%d.%d.%d\nPHY %d.%d.%d.%d\nNWP %d.%d.%d.%d\nROM %d\nHOST
%d.%d.%d.%d\n",ver.ChipFwAndPhyVersion.ChipId,
ver.ChipFwAndPhyVersion.FwVersion[0],ver.ChipFwAndPhyVersion.FwVersion[1],
ver.ChipFwAndPhyVersion.FwVersion[2],ver.ChipFwAndPhyVersion.FwVersion[3],
ver.ChipFwAndPhyVersion.PhyVersion[0],ver.ChipFwAndPhyVersion.PhyVersion[1],
ver.ChipFwAndPhyVersion.PhyVersion[2],ver.ChipFwAndPhyVersion.PhyVersion[3],
ver.NwpVersion[0],ver.NwpVersion[1],ver.NwpVersion[2],ver.NwpVersion[3],
ver.RomVersion, SL_MAJOR_VERSION_NUM, SL_MINOR_VERSION_NUM, SL_VERSION_NUM, SL_SUB_VERSION_NUM);
sl_EventMaskSet – Masks asynchronous events from the device. Masked events do not generate
asynchronous messages from the device. This function receives an EventClass and a bit mask. The
events and mask options are:
• SL_EVENT_CLASS_WLAN user events:
– SL_WLAN_CONNECT_EVENT
– SL_WLAN_DISCONNECT_EVENT
– SL_WLAN_STA_CONNECTED_EVENT
– SL_WLAN_STA_DISCONNECTED_EVENT
• SmartConfig events:
– SL_WLAN_SMART_CONFIG_START_EVENT
– SL_WLAN_SMART_CONFIG_STOP_EVENT
• SL_EVENT_CLASS_DEVICE user events:
– SL_DEVICE_FATAL_ERROR_EVENT
• SL_EVENT_CLASS_BSD user events:
– SL_SOCKET_TX_FAILED_EVENT
– SL_SOCKET_SSL_ACCEPT_EVENT
• SL_EVENT_CLASS_NETAPP user events:
– SL_NETAPP_IPACQUIRED_EVENT
– SL_NETAPP_IPACQUIRED_V6_EVENT
An example of masking out connection and disconnection from WLAN class:
sl_EventMaskSet(SL_EVENT_CLASS_WLAN, (SL_WLAN_CONNECT_EVENT | SL_WLAN_DISCONNECT_EVENT) );
sl_EventMaskGet – Returns the events bit mask from the device. If that event is masked, the device does
not send this event. The function is similar to sl_EventMaskSet.
An example of getting an event mask for WLAN class:
unsigned long maskWlan;
sl_StatusGet(SL_EVENT_CLASS_WLAN,&maskWlan);
sl_Task – This function must be called from the main loop or from dedicated thread in the following cases:
• Non-Os Platform – Should be called from the main loop
• Multi Threaded Platform – When the user does not implement the external spawn functions, the
function should be called from a dedicated thread allocated to the SimpleLink driver. In this mode the
function never returns.
sl_UartSetMode – This function should be used if the user’s chosen host interface is UART. The function
is responsible for setting the user’s UART configuration:
• Baud rate
• Flow control
• COM port
18.2 WLAN
sl_WlanSetMode – The WLAN device has several WLAN modes of operation. By default the device acts
as a WLAN station, but it can also act in other WLAN roles. The different options are:
• ROLE_STA – For WLAN station mode
• ROLE_AP – For WLAN AP mode
• ROLE_P2P – For WLAN P2P mode
Note: The set mode functionality only takes effect in the next device boot.
An example of switching from any role to WLAN Access point roles:
sl_WlanSetMode(ROLE_AP);
/* Turning the device off and on in order for the roles change to take effect */
sl_Stop(0);
sl_Start(NULL,NULL,NULL);
sl_WlanSet – Enables the user to configure different WLAN related parameters. The main parameters
used are ConfigID and ConfigOpt. The possible ConfigID and ConfigOpt combinations are:
• SL_WLAN_CFG_GENERAL_PARAM_ID – The different general WLAN parameters are:
– WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE
– WLAN_GENERAL_PARAM_OPT_STA_TX_POWER – Sets STA mode Tx power level, a number
from 0 to 15, as the dB offset from max power (0 will set maximum power).
– WLAN_GENERAL_PARAM_OPT_AP_TX_POWER – Sets AP mode Tx power level, a number
from 0 to 15, as the dB offset from max power (0 will set maximum power).
• SL_WLAN_CFG_AP_ID – The different AP configuration options are:
– WLAN_AP_OPT_SSID
– WLAN_AP_OPT_COUNTRY_CODE
– WLAN_AP_OPT_BEACON_INT – Sets the beacon interval
– WLAN_AP_OPT_CHANNEL
– WLAN_AP_OPT_HIDDEN_SSID – Sets the AP to be hidden or not hidden
– WLAN_AP_OPT_DTIM_PERIOD
– WLAN_AP_OPT_SECURITY_TYPE – Possible options are:
• Open security: SL_SEC_TYPE_OPEN
• WEP security: SL_SEC_TYPE_WEP
• WPA security: SL_SEC_TYPE_WPA
– WLAN_AP_OPT_PASSWORD – Sets the security password for AP mode:
• For WPA: 8 to 63 characters
• For WEP: 5 to 13 characters (ASCII)
– WLAN_AP_OPT_WPS_STATE
• SL_WLAN_CFG_P2P_PARAM_ID
– WLAN_P2P_OPT_DEV_NAME
– WLAN_P2P_OPT_DEV_TYPE
– WLAN_P2P_OPT_CHANNEL_N_REGS – The listen channel and regulatory class determine the
device listen channel during the P2P find and listen phase. The operational channel and regulatory
class determines the operating channel preferred by the device (if the device is the group owner,
this is the operating channel). Channels should be one of the social channels (1/6/11). If no listen or
operational channel is selected, a random 1/6/11 will be selected.
– WLAN_GENERAL_PARAM_OPT_INFO_ELEMENT – The application sets up to
MAX_PRIVATE_INFO_ELEMENTS_SUPPORTED info elements per role (AP / P2P GO). To delete
an info element, use the relevant index and length = 0. The application sets up to
MAX_PRIVATE_INFO_ELEMENTS_SUPPORTED to the same role. However, for AP no more than
INFO_ELEMENT_MAX_TOTAL_LENGTH_AP bytes are stored for all info elements. For P2P GO
no more than INFO_ELEMENT_MAX_TOTAL_LENGTH_P2P_GO bytes are stored for all info
elements.
– WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS – Changes the scan channels and RSSI
threshold
An example of setting SSID for AP mode:
unsigned char str[33];
memset(str, 0, 33);
memcpy(str, ssid, len); // ssid string of 32 characters
sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_SSID, strlen(ssid), str);
sl_WlanGet – Enables the user to configure different WLAN-related parameters. The main parameters
used are ConfigID and ConfigOpt. The usage of sl_WlanGet is similar to sl_WlanSet.
sl_WlanConnect – Manually connects to a WLAN network
sl_WlanDisconnect – Disconnects WLAN connection
sl_WlanProfileAdd – When auto start connection policy is enabled, the device connects to an AP from
the profiles table. Up to seven profiles are supported. If several profiles are configured, the device selects
the highest priority profile. Within each priority group, the device choses the profile based on the following
parameters in descending priority: security policy, signal strength.
sl_WlanProfileGet – Reads a WLAN profile from the device
sl_WlanProfileDel – Deletes an existing profile
sl_WlanPolicySet – Manages the configuration of the following WLAN functionalities:
• SL_POLICY_CONNECTION – SL_POLICY_CONNECTION type defines three options available to
connect the CC31xx device to the AP:
– Auto Connect – The CC31xx device tries to automatically reconnect to one of its stored profiles
each time the connection fails or the device is rebooted. To set this option, use:
sl_WlanPolicySet(SL_POLICY_CONNECTION,SL_CONNECTION_POLICY(1,0,0,0,0),NULL,0)
– Fast Connect – The CC31xx device tries to establish a fast connection to AP. To set this option,
use:
sl_WlanPolicySet(SL_POLICY_CONNECTION,SL_CONNECTION_POLICY(0,1,0,0,0),NULL,0)
– P2P Connect – If Any P2P mode is set, CC31xx device tries to automatically connect to the first
P2P device available, supporting push button only. To set this option, use:
sl_WlanPolicySet(SL_POLICY_CONNECTION,SL_CONNECTION_POLICY(0,0,0,1,0),NULL,0)
– Auto smart config upon restart – The device wakes up in SmartConfig mode. Note: Any
command from the host ends this state. To set this option use:
sl_WlanPolicySet(SL_POLICY_CONNECTION,SL_CONNECTION_POLICY(0,0,0,0,1),NULL,0)
• SL_POLICY_SCAN – Defines the system scan time interval if there is no connection. The default
interval is 10 minutes. After the settings scan interval, an immediate scan is activated. The next scan is
based on the interval settings. For setting the scan interval to one minute interval use the following
example:
unsigned long intervalInSeconds = 60;
#define SL_SCAN_ENABLE 1
sl_WlanPolicySet(SL_POLICY_SCAN,SL_SCAN_ENABLE, (unsigned char *)
&intervalInSeconds,sizeof(intervalInSeconds));
To disable the scan, use:
#define SL_SCAN_DISABLE 0
sl_WlanPolicySet(SL_POLICY_SCAN,SL_SCAN_DISABLE,0,0);
• SL_POLICY_PM – Defines a power management policy for station mode only. There are four power
policies available:
– SL_NORMAL_POLICY (default) – For setting normal power management policy use:
sl_WlanPolicySet(SL_POLICY_PM , SL_NORMAL_POLICY, NULL,0)
– SL_LOW_LATENCY_POLICY – For setting low latency power management policy use:
sl_WlanPolicySet(SL_POLICY_PM , SL_LOW_LATENCY_POLICY, NULL,0)
– SL_LOW_POWER_POLICY – For setting low power management policy use:
sl_WlanPolicySet(SL_POLICY_PM , SL_LOW_POWER_POLICY, NULL,0)
– SL_ALWAYS_ON_POLICY – For setting always on power management policy use:
sl_WlanPolicySet(SL_POLICY_PM , SL_ALWAYS_ON_POLICY, NULL,0)
– SL_LONG_SLEEP_INTERVAL_POLICY – For setting long sleep interval policy use:
unsigned short PolicyBuff[4] = {0,0,800,0}; // 800 is max sleep time in mSec
sl_WlanPolicySet(SL_POLICY_PM , SL_LONG_SLEEP_INTERVAL_POLICY,
PolicyBuff,sizeof(PolicyBuff));
• SL_POLICY_P2P – Defines P2P negotiation policy parameters for a P2P role. To set the intent
sl_WlanPolicyGet – Reads the different WLAN policy settings. The possible options are:
• SL_POLICY_CONNECTION
• SL_POLICY_SCAN
• SL_POLICY_PM
sl_WlanGetNetworkList – Gets the latest WLAN scan results
sl_WlanSmartConfigStart – Puts the device into SmartConfig state. Once SmartConfig has ended
successfully, an asynchronous event will be received:
SL_OPCODE_WLAN_SMART_CONFIG_START_ASYNC_RESPONSE. The event holds the SSID and
an extra field that might also have been delivered (for example, device name).
sl_WlanSmartConfigStop – Stops the SmartConfig procedure. Once SmartConfig is stopped, an
asynchronous event is received: SL_OPCODE_WLAN_SMART_CONFIG_STOP_ASYNC_RESPONSE
sl_WlanRxStatStart – Starts collecting WLAN Rx statistics (unlimited time)
sl_WlanRxStatStop – Stops collecting WLAN Rx statistics
sl_WlanRxStatGet – Gets WLAN Rx statistics. Upon calling this command, the statistics counters are
cleared. The statistics returned are:
• Received valid packets – Sum of the packets received correctly (including filtered packets)
• Received FCS Error packets – Sum of the packets dropped due to FCS error
• Received PLCP error packets – Sum of the packets dropped due to PLCP error
• Average data RSSI – Average RSSI for all valid data packets received
• Average management RSSI – Average RSSI for all valid management packets received
• Rate histogram – Rate histogram for all valid packets received
• RSSI histogram – RSSI histogram from -40 until -87 (all values below and above RSSI appear in the
first and last cells)
• Start time stamp – The timestamp of starting to collect the statistics in uSec
• Get time stamp – The timestamp of reading the statistics in uSec
18.3 Socket
sl_Socket – Creates a new socket of a socket type identified by an integer number, and allocates system
resources to the socket. The supported socket types are:
• SOCK_STREAM (TCP – Reliable stream-oriented service or Stream Sockets)
• SOCK_DGRAM (UDP – Datagram service or Datagram Sockets)
• SOCK_RAW (Raw protocols atop the network layer)
sl_Close – Gracefully closes socket. This function causes the system to release resources allocated to a
socket. In case of TCP, the connection is terminated.
sl_Accept – This function is used with connection-based socket types (SOCK_STREAM) to extract the
first connection request on the queue of pending connections, creates a new connected socket, and
returns a new file descriptor referring to that socket. The newly created socket is not in the listening state.
The original socket sd is unaffected by this call.
sl_Bind – Gives the socket the local address addr. addr is addrlen bytes long. Traditionally, this function
is called when a socket is created, exists in a name space (address family) but has no name assigned. A
local address must be assigned before a SOCK_STREAM socket receives connections.
sl_Listen – Specifies the willingness to accept incoming connections and a queue limit for incoming
connections. The listen() call applies only to sockets of type SOCK_STREAM, and the backlog parameter
defines the maximum length for the queue of pending connections.
sl_Connect – Connects the socket referred to by the socket descriptor sd to the address specified by
addr. The addrlen argument specifies the size of addr. The format of the address in addr is determined by
the address space of the socket. If the socket is of type SOCK_DGRAM, this call specifies the peer with
which the socket is associated. Datagrams should be sent to this address, the only address from which
datagrams should be received. If the socket is of type SOCK_STREAM, this call tries to make a
connection to another socket. The other socket is specified by an address in the communications space of
the socket.
sl_Select – Allows a program to monitor multiple file descriptors, waiting until one or more of the file
descriptors become ready for a class of I/O operation. sl_Select has several sub functions to set the file
descriptor options:
• SL_FD_SET – Selects SlFdSet_t SET function. Sets the current socket descriptor on the SlFdSet_t
container
• SL_FD_CLR – Selects SlFdSet_t CLR function. Clears the current socket descriptor on the SlFdSet_t
container
• SL_FD_ISSET – Selects SlFdSet_t ISSET function. Checks if the current socket descriptor is set
(TRUE/FALSE)
• SL_FD_ZERO – Selects SlFdSet_t ZERO function. Clears all socket descriptors from SlFdSet_t
sl_SetSockOpt – Manipulates the options associated with a socket. Options exist at multiple protocol
levels and are always present at the uppermost socket level. The supported socket options are:
• SL_SO_KEEPALIVE – Keeps TCP connections active by enabling the periodic transmission of
messages; Enable/Disable, periodic keep alive. Default: Enabled, keep alive timeout 300 seconds.
• SL_SO_RCVTIMEO – Sets the timeout value that specifies the maximum amount of time an input
function waits until it completes. Default: No timeout
• SL_SO_RCVBUF – Sets TCP max receive window
• SL_SO_NONBLOCKING – Sets the socket to nonblocking operation. Impact on: connect, accept,
send, sendto, recv and recvfrom. Default: Blocking.
• SL_SO_SECMETHOD – Sets the method to the TCP-secured socket (SL_SEC_SOCKET). Default:
SL_SO_SEC_METHOD_SSLv3_TLSV1_2 .
• SL_SO_SECURE_MASK – Sets a specific cipher to the TCP-secured socket (SL_SEC_SOCKET).
Default: "Best" cipher suitable to method
• SL_SO_SECURE_FILES – Maps programmed files to the secured socket (SL_SEC_SOCKET)
• SL_SO_CHANGE_CHANNEL – Sets the channel in transceiver mode
• SL_IP_MULTICAST_TTL – Sets the time-to-live value of the outgoing multicast packets for the socket
• SL_IP_RAW_RX_NO_HEADER – Raw socket; removes the IP header from received data. Default:
data includes IP header.
• SL_IP_HDRINCL – RAW socket only; the IPv4 layer generates an IP header when sending a packet
unless the IP_HDRINCL socket option is enabled on the socket. When it is enabled, the packet must
contain an IP header. Default: disabled, IPv4 header generated by Network Stack.
• SL_IP_ADD_MEMBERSHIP – UDP socket; joins a multicast group.
• SL_IP_DROP_MEMBERSHIP – UDP socket; leaves a multicast group.
• SL_SO_PHY_RATE – RAW socket; sets WLAN PHY transmit rate.
18.4 NetApp
sl_NetAppStart – Enables or starts different networking services. Could be one or a combination of the
following:
• SL_NET_APP_HTTP_SERVER_ID – HTTP server service
• SL_NET_APP_DHCP_SERVER_ID – DHCP server service (DHCP client is always supported)
• SL_NET_APP_MDNS_ID – MDNS Client\Server service
sl_NetAppStop – Disables or stops a networking service. Similar options as in sl_NetAppStart.
sl_NetAppSet
sl_NetAppGet
sl_NetAppDnsGetHostByName – Obtains the IP address of a machine on the network, by machine
name. Example:
unsigned long DestinationIP;
sl_NetAppDnsGetHostByName("www.ti.com", strlen("www.ti.com"), &DestinationIP,SL_AF_INET);
Addr.sin_family = SL_AF_INET;
Addr.sin_port = sl_Htons(80);
Addr.sin_addr.s_addr = sl_Htonl(DestinationIP);
AddrSize = sizeof(SlSockAddrIn_t);
SockID = sl_Socket(SL_AF_INET,SL_SOCK_STREAM, 0);
• _ipp._tcp.local
• _ftp._tcp.local
sl_NetAppGetServiceList – Gets the list of peer services. The list is in a form of service structure. The
user chooses the type of the service structure. The supported structures are:
• Full service parameters with text
• Full service parameters
• Short service parameters (port and IP only), especially for tiny hosts
Note: The different types of structures exist to save memory in the host.
sl_NetAppMDNSRegisterService – Registers a new mDNS service to the mDNS package and the DB.
This registered service is offered by the application. The service name should be a full service name
according to DNS-SD RFC, meaning the value in the name field in the SRV answer.
Example for service name:
• PC1._ipp._tcp.local
• PC2_server._ftp._tcp.local
If the option is_unique is set, mDNS probes the service name to ensure it is unique before announcing the
service on the network.
sl_NetAppMDNSUnRegisterService – Deletes the mDNS service from the mDNS package and the
database.
sl_NetAppPingStart – Sends an ICMP ECHO_REQUEST (or ping) to the network hosts. An example of
sending 20 ping requests and reporting the results to a callback routine when all requests are sent:
// callback routine
void pingRes(SlPingReport_t* pReport)
{
// handle ping results
}
// ping activation
void PingTest()
{
SlPingReport_t report;
SlPingStartCommand_t pingCommand;
18.5 NetCfg
sl_NetCfgSet – Manages the configuration of the following networking functionalities:
• SL_MAC_ADDRESS_SET – The new MAC address overrides the default MAC address and is saved
in the SFlash file system.
• SL_IPV4_STA_P2P_CL_DHCP_ENABLE – Sets the device to acquire an IP address by DHCP when
in WLAN sta mode or P2P client. This is the default mode of the system for acquiring an IP address
after a WLAN connection.
• SL_IPV4_STA_P2P_CL_STATIC_ENABLE – Sets a static IP address to the device working in STA
mode or P2P client. The IP address is stored in the SFlash file system. To disable the static IP and get
the address assigned from DHCP, use SL_STA_P2P_CL_IPV4_DHCP_SET.
• SL_IPV4_AP_P2P_GO_STATIC_ENABLE – Sets a static IP address to the device working in AP
mode or P2P go. The IP address is stored in the SFlash file system.
Example:
_NetCfgIpV4Args_t ipV4;
ipV4.ipV4 = (unsigned long)SL_IPV4_VAL(10,1,1,201); // unsigned long IP
address
ipV4.ipV4Mask = (unsigned long)SL_IPV4_VAL(255,255,255,0); // unsigned long
Subnet mask for this AP/P2P
ipV4.ipV4Gateway = (unsigned long)SL_IPV4_VAL(10,1,1,1); // unsigned long
Default gateway address
ipV4.ipV4DnsServer = (unsigned long)SL_IPV4_VAL(8,16,32,64); // unsigned long DNS
server address
sl_NetCfgSet(SL_IPV4_AP_P2P_GO_STATIC_ENABLE,1,sizeof(_NetCfgIpV4Args_t),(unsigned
char *)
&ipV4);
sl_Stop(0);
sl_Start(NULL,NULL,NULL);
Note: AP mode must use static IP settings.
Note: All set functions require system restart in order for changes to take effect.
sl_NetCfgGet – Reads the network configurations. The options are:
• SL_MAC_ADDRESS_GET
• SL_IPV4_STA_P2P_CL_GET_INFO – Gets an IP address from the WLAN station or P2P client. A
DHCP flag is returned to indicate if the IP address is static or from DHCP.
• o SL_IPV4_AP_P2P_GO_GET_INFO – Returns the IP address of the AP.
An example of getting an IP address from a WLAN station or P2P client:
unsigned char len = sizeof(_NetCfgIpV4Args_t);
unsigned char dhcpIsOn = 0;
_NetCfgIpV4Args_t ipV4 = {0};
Asynchronous Events
The SimpleLink host driver interacts with the SimpleLink device through commands transmitted to the
device over the SPI or UART bus interface. Because some of the commands might trigger long processes
which can take several hundred milliseconds or even seconds, the device and the host driver support a
mechanism of asynchronous events sent from the device to the host driver.
Events notify on process completion such as a SmartConfig process done, notify on device status
changes such as a WLAN disconnection event, or notify on errors such as a fatal error event.
These events can be classified in the following logical sections:
• WLAN events
• Network application events
• Socket events
• General device events
19.1 WLAN
SL_WLAN_CONNECT_EVENT – Notifies that the device is connected to the AP. Event parameters:
• connection_type
• ssid_len
• ssid_name
• go_peer_device_name_len – Relevant for P2P
• go_peer_device_name
• bssid
SL_WLAN_DISCONNECT_EVENT – Notifies that the device is disconnected from the AP. Event
parameters:
• connection_type
• ssid_len
• ssid_name
• go_peer_device_name_len – Relevant for P2P
• go_peer_device_name
• bssid
• reason_code – WLAN disconnection reason
SL_WLAN_SMART_CONFIG_START_EVENT – Notifies the host that SmartConfig has ended. Event
parameters:
• Status
• ssid_len
• ssid
• private_token_len
• private_token
SL_WLAN_SMART_CONFIG_STOP_EVENT – Notifies the host that SmartConfig has stopped. Event
parameters:
• status
SL_WLAN_STA_CONNECTED_EVENT – Notifies that STA is connected; relevant in AP mode or P2P
GO. Event parameters:
• status
• go_peer_device_name
• mac
• go_peer_device_name_len
• wps_dev_password_id
• own_ssid
• own_ssid_len
SL_WLAN_STA_DISCONNECTED_EVENT – Notifies that STA is disconnected; relevant in AP mode or
P2P GO. Event parameters:
• Status
• go_peer_device_name
• mac
• go_peer_device_name_len
• wps_dev_password_id
• own_ssid
• own_ssid_len
SL_WLAN_P2P_DEV_FOUND_EVENT – Notifies that the device is found; relevant in P2P mode. Event
parameters:
• go_peer_device_name
• mac
• go_peer_device_name_len
• wps_dev_password_id
• own_ssid
• own_ssid_len
SL_WLAN_P2P_NEG_REQ_RECEIVED_EVENT – Notifies that the negotiation request received an
event; relevant in P2P mode. Event parameters:
• go_peer_device_name
• mac
• go_peer_device_name_len
• wps_dev_password_id
• own_ssid
• own_ssid_len
SL_WLAN_CONNECTION_FAILED_EVENT – Notifies negotiation failure; relevant in P2P mode. Event
parameters:
• status
19.2 Netapp
SL_NETAPP_IPV4_IPACQUIRED_EVENT – Notifies IPv4 enquired. Event parameters:
• ip
• gateway
• dns
SL_NETAPP_IP_LEASED_EVENT – Notifies STA IP lease; relevant in AP or P2P GO mode. Event
parameters:
• ip_address
• lease_time
• mac
SL_NETAPP_IP_RELEASED_EVENT – Notifies STA IP release; relevant in AP or P2P GO mode. Event
parameters:
• ip_address
• mac
• reason
19.3 Socket
SL_SOCKET_TX_FAILED_EVENT – Notifies of Tx failure. Event parameters:
• Status
• Sd
SL_SOCKET_ASYNC_EVENT – Notifies of asynchronous event. Event parameters:
• sd
• type – The event type can be one of the following:
– SL_SOCKET_ASYNC_EVENT_TYPE_SSL_ACCEPT – Accept failed due to SSL issue ( TCP
pass)
– SL_SOCKET_ASYNC_EVENT_TYPE_RX_FRAGMENTATION_TOO_BIG – Connectionless
mode, Rx packet fragmentation > 16K, packet is released.
– SL_SOCKET_ASYNC_EVENT_TYPE_OTHER_SIDE_CLOSE_SSL_DATA_NOT_ENCRYPTED –
Remote side down from secure to unsecure
• value
19.4 Device
SL_DEVICE_FATAL_ERROR_EVENT – Notifies of fatal error; needs to perform device reset. Event
parameters:
• Status
• sender
A.1 Overview
From a software perspective, the system can be separated into four parts:
• User application
• CC3100 Host driver – Platform independent part
– Host driver API
– Main driver logic and flow
• CC3100 Host driver – Platform dependent part
– OS wrapper implementation
– Transport layer (SPI/UART) implementation
• Figure A-1
• The host can send up to TxBuff packets (<1500B) without waiting for a response from the CC3100
device.
• The CC3100 device generates a dummy event if the number is changed (threshold from last update /
timeout if change is smaller than the threshold).
B.2 Limitations
1. HTTPS is currently not supported.
2. The HTTP web server can host a single domain only.
3. HTML form submission using GET method is not supported.
SWRU368 – June 2014 HTTP Server Supported Features and Limitation 153
Submit Documentation Feedback
Copyright © 2014, Texas Instruments Incorporated
Appendix C
SWRU368 – June 2014
SSL Limitations
1. Download and install the latest package of OpenSSL (either Windows or Linux).
2. In the installation path \bin library, find openssl.exe.
Private Key
To create a new private key for a certificate, use:
openssl genrsa -out privkey.pem 2048
Notes:
• The default key size is 2048, but the user can use any desired protocol key size (1024, 2048, 4096…).
• The name of the file is replaceable.
• The default format is PEM which is in ASCII form. In many systems the binary format, DER, is more
popular due to its smaller size. To convert between the formats use: openssl rsa -in privkey.pem
–inform PEM –out privkey.der –outform DER
Certificate and CA
The CA (Certificate Authority) is a certificate which is self-signed and used for signing other certificates.
To generate a CA, use the following command and insert the desired values:
openssl req -new -x509 -days 3650 -key privkey.pem -out root-ca.pem
Notes:
• The days argument determines how long the certificate is valid.
• The key is generated in the Private Key section of this document, in PEM format.
• The output is PEM format. To convert from PEM to DER use:
openssl x509 -in input.crt -inform PEM –out output.crt
-outform DER
To generate a certificate, prepare the certificate document first. Similar to making a CA, fill the desired
values such as country code name and so forth with the command:
openssl req -new -key privkey.pem -out cert.pem
The private key is different from the one used for the CA. Each certificate should have its own private key.
After generating a certificate form (also called certificate request), sign it with another certificate. The form
is usually signed with the CA but to make a chain, sign it with another certificate.
To do the signing process use:
openssl x509 -req -days 730 -in cert.pem -CA ca.pem -CAkey CAPrivate.pem -
set_serial 01 -out cert.pem
Notes:
• The example uses the CA to sign on the generated certificate.
• The key in the example is the CA private key.
• The days argument determines how long this certificate is valid.
• -set_serial 01 is needed.
To generate a CA and a certificate signed by the CA do the following:
1. Generate a private key for the CA.
2. Generate a private key for the certificate.
SWRU368 – June 2014 How to Generate Certificates, Public Keys and CA’s 155
Submit Documentation Feedback
Copyright © 2014, Texas Instruments Incorporated
Appendix D www.ti.com
156 How to Generate Certificates, Public Keys and CA’s SWRU368 – June 2014
Submit Documentation Feedback
Copyright © 2014, Texas Instruments Incorporated
Appendix E
SWRU368 – June 2014
Rx Statistics Limitations
1. The maximum histogram cell capacity is 65535 for both RSSI and rate. If more packets are received,
the accumulation will stop.
2. All other statistics are held in unsigned integers and wraparound when exceeding the maximum.
G.3 Limitations
The following are the known limitations of the mDNS feature.
1. The mDNS machine stops and starts when all services are deleted; the peer cache is deleted.
2. If the user registers a unique service but a service with the same name already exists in the network,
then the service name is changed to "name (number)," for example PC1 (2)_ipp._tcp.local. In this case,
the name in the DB is the original name but the advertising uses the new name.
3. Deleting a unique name that was changed because of mismatch between the names (the advertising
name and the DB name) causes the mDNS machine to stop and start, and deletes the peer cache.
4. If there is a one shot query but the peer cache is full, there will be no place to set the query. The peer
cache will be deleted, and then the query sent.
5. There is a partial check if the service name that is registered is legal. The user must send a legal name.
6. When using get host by service, only one answer is returned. To see all the answers, wait for all peer
answers to be sent and received, then read the answers by using the API get service list.
7. The max buffer list size of the API get service list is about 1500 bytes. Requests for a list bigger than
this size returns an error.
Socket Limitations
There are eight regular (un-secured) sockets and two secured* sockets available on CC3100. Table H-1
shows the number of available sockets, divided by client or server.
* Secure sockets indicate a SSL/TLS connection.
The client side can use eight normal sockets and two secure sockets, or all ten simultaneously.
The number of available sockets for communication depends on the number of listening sockets. If one
socket is reserved for public socket and used to listen to incoming client requests, this leaves seven
private sockets for actual client communication. If there are two server sockets for listening, only six
private sockets will remain for communication.
The number of available server sockets for UDP connection remains eight as UDP is a connectionless
socket. Since it does not require a socket to be in listening mode, all eight can be used for client
communication.
Server side secure socket (SSL/TLS) connection number isn't affected because a regular server socket
can be used for listening. After accepting a new client connection, the user can switch to a secure socket.
Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, enhancements, improvements and other
changes to its semiconductor products and services per JESD46, latest issue, and to discontinue any product or service per JESD48, latest
issue. Buyers should obtain the latest relevant information before placing orders and should verify that such information is current and
complete. All semiconductor products (also referred to herein as “components”) are sold subject to TI’s terms and conditions of sale
supplied at the time of order acknowledgment.
TI warrants performance of its components to the specifications applicable at the time of sale, in accordance with the warranty in TI’s terms
and conditions of sale of semiconductor products. Testing and other quality control techniques are used to the extent TI deems necessary
to support this warranty. Except where mandated by applicable law, testing of all parameters of each component is not necessarily
performed.
TI assumes no liability for applications assistance or the design of Buyers’ products. Buyers are responsible for their products and
applications using TI components. To minimize the risks associated with Buyers’ products and applications, Buyers should provide
adequate design and operating safeguards.
TI does not warrant or represent that any license, either express or implied, is granted under any patent right, copyright, mask work right, or
other intellectual property right relating to any combination, machine, or process in which TI components or services are used. Information
published by TI regarding third-party products or services does not constitute a license to use such products or services or a warranty or
endorsement thereof. Use of such information may require a license from a third party under the patents or other intellectual property of the
third party, or a license from TI under the patents or other intellectual property of TI.
Reproduction of significant portions of TI information in TI data books or data sheets is permissible only if reproduction is without alteration
and is accompanied by all associated warranties, conditions, limitations, and notices. TI is not responsible or liable for such altered
documentation. Information of third parties may be subject to additional restrictions.
Resale of TI components or services with statements different from or beyond the parameters stated by TI for that component or service
voids all express and any implied warranties for the associated TI component or service and is an unfair and deceptive business practice.
TI is not responsible or liable for any such statements.
Buyer acknowledges and agrees that it is solely responsible for compliance with all legal, regulatory and safety-related requirements
concerning its products, and any use of TI components in its applications, notwithstanding any applications-related information or support
that may be provided by TI. Buyer represents and agrees that it has all the necessary expertise to create and implement safeguards which
anticipate dangerous consequences of failures, monitor failures and their consequences, lessen the likelihood of failures that might cause
harm and take appropriate remedial actions. Buyer will fully indemnify TI and its representatives against any damages arising out of the use
of any TI components in safety-critical applications.
In some cases, TI components may be promoted specifically to facilitate safety-related applications. With such components, TI’s goal is to
help enable customers to design and create their own end-product solutions that meet applicable functional safety standards and
requirements. Nonetheless, such components are subject to these terms.
No TI components are authorized for use in FDA Class III (or similar life-critical medical equipment) unless authorized officers of the parties
have executed a special agreement specifically governing such use.
Only those TI components which TI has specifically designated as military grade or “enhanced plastic” are designed and intended for use in
military/aerospace applications or environments. Buyer acknowledges and agrees that any military or aerospace use of TI components
which have not been so designated is solely at the Buyer's risk, and that Buyer is solely responsible for compliance with all legal and
regulatory requirements in connection with such use.
TI has specifically designated certain components as meeting ISO/TS16949 requirements, mainly for automotive use. In any case of use of
non-designated products, TI will not be responsible for any failure to meet ISO/TS16949.
Products Applications
Audio www.ti.com/audio Automotive and Transportation www.ti.com/automotive
Amplifiers amplifier.ti.com Communications and Telecom www.ti.com/communications
Data Converters dataconverter.ti.com Computers and Peripherals www.ti.com/computers
DLP® Products www.dlp.com Consumer Electronics www.ti.com/consumer-apps
DSP dsp.ti.com Energy and Lighting www.ti.com/energy
Clocks and Timers www.ti.com/clocks Industrial www.ti.com/industrial
Interface interface.ti.com Medical www.ti.com/medical
Logic logic.ti.com Security www.ti.com/security
Power Mgmt power.ti.com Space, Avionics and Defense www.ti.com/space-avionics-defense
Microcontrollers microcontroller.ti.com Video and Imaging www.ti.com/video
RFID www.ti-rfid.com
OMAP Applications Processors www.ti.com/omap TI E2E Community e2e.ti.com
Wireless Connectivity www.ti.com/wirelessconnectivity
Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265
Copyright © 2014, Texas Instruments Incorporated