SWRU368C May   2018  – January 2021 CC3100 , CC3100MOD , CC3200 , CC3200MOD

 

  1. Overview
    1. 1.1 Document Scope
    2. 1.2 Overview
      1. 1.2.1 Features List
    3. 1.3 Host Driver Overview
    4. 1.4 Configurable Information Element
  2. Writing a Simple Networking Application
    1. 2.1 Overview
      1. 2.1.1 Basic Example Code
  3. Device Initialization
    1. 3.1 Overview
    2. 3.2 Host Interface
      1. 3.2.1 SPI Interface
      2. 3.2.2 UART Interface
        1. 3.2.2.1 Change UART Baud Rate
  4. Device Configurations
    1. 4.1 Overview
    2. 4.2 Device Parameters
    3. 4.3 WLAN Parameters
      1. 4.3.1 Advanced
    4. 4.4 Network Parameters
    5. 4.5 Internet and Networking Services Parameters
    6. 4.6 Power-Management Parameters
      1. 4.6.1 Overview
      2. 4.6.2 Power Policy
    7. 4.7 Scan Parameters
      1. 4.7.1 Scan Policy
  5. Socket
    1. 5.1 Overview
      1. 5.1.1 Transmission Control Protocol (TCP)
      2. 5.1.2 User Datagram Protocol (UDP)
    2. 5.2 Socket Connection Flow
    3. 5.3 TCP Connection Flow
      1. 5.3.1 Client Side
      2. 5.3.2 Server Side
    4. 5.4 UDP Connection Flow
      1. 5.4.1 Client Side
      2. 5.4.2 Server Side
    5. 5.5 Socket Options
      1. 5.5.1 Blocking vs NonBlocking
      2. 5.5.2 Secure Sockets
    6. 5.6 SimpleLink Supported Socket API
    7. 5.7 Number of Available Sockets
    8. 5.8 Packet Aggregation
  6. Device Hibernate
    1. 6.1 Overview
  7. Provisioning
    1. 7.1 Overview
    2. 7.2 SmartConfig
      1. 7.2.1 General Description
      2. 7.2.2 How to Use / API
        1. 7.2.2.1 Automatic Activation (Out of the Box)
        2. 7.2.2.2 Manual Activation
        3. 7.2.2.3 Stopping Smart Config
    3. 7.3 AP Mode
      1. 7.3.1 General Description
      2. 7.3.2 How to Use / API
      3. 7.3.3 Things to Note When Configuring AP Provisioning
    4. 7.4 WPS
      1. 7.4.1 General Description
      2. 7.4.2 How to Use / API
      3. 7.4.3 Example of Using WPS
      4. 7.4.4 Tradeoffs Between Provisioning Options
  8. Security
    1. 8.1 WLAN Security
      1. 8.1.1 Personal
      2. 8.1.2 Enterprise
        1. 8.1.2.1 General Description
        2. 8.1.2.2 How to Use / API
        3. 8.1.2.3 Example
        4. 8.1.2.4 Limitations
    2. 8.2 Secured Socket
      1. 8.2.1 General Description
      2. 8.2.2 How to Use / API
        1. 8.2.2.1 Selecting a Method
        2. 8.2.2.2 Selecting a Cipher Suit
        3. 8.2.2.3 Selecting the Secured Files for the Socket
        4. 8.2.2.4 Set Domain Name for Verification and SNI
      3. 8.2.3 Example of Using the SSL
      4. 8.2.4 Supported Cryptographic Algorithms
    3. 8.3 Limitations
      1. 8.3.1 Main Known Limitations
        1. 8.3.1.1 STA Mode
        2. 8.3.1.2 AP Mode
        3. 8.3.1.3 JavaScript Example
        4. 8.3.1.4 Host Driver Example
  9. AP Mode
    1. 9.1 General Description
    2. 9.2 Setting AP Mode – API
    3. 9.3 WLAN Parameters Configuration – API
    4. 9.4 WLAN Parameters Query – API
    5. 9.5 AP Network Configuration
    6. 9.6 DHCP Server Configuration
    7. 9.7 Setting Device URN
    8. 9.8 Asynchronous Events Sent to the Host
    9. 9.9 Example Code
  10. 10Peer to Peer (P2P)
    1. 10.1 General Description
      1. 10.1.1 Scope
      2. 10.1.2 Wi-Fi Direct Advantage
      3. 10.1.3 Support and Abilities of Wi-Fi Direct
      4. 10.1.4 Limitations
    2. 10.2 P2P APIs and Configuration
      1. 10.2.1 Configuring P2P Global Parameters
        1. 10.2.1.1 Set P2P Role
        2. 10.2.1.2 Set P2P Network Configuration
        3. 10.2.1.3 Set P2P Device Name
        4. 10.2.1.4 Set P2P Device Type
        5. 10.2.1.5 Set P2P Listen and Operation Channels
      2. 10.2.2 Configuring P2P Policy
        1. 10.2.2.1 Configure P2P Intent Value and Negotiation Initiator
      3. 10.2.3 Configuring P2P Profile Connection Policy
      4. 10.2.4 Discovering Remote P2P Peers
        1. 10.2.4.1 How to Start P2P Discovery
        2. 10.2.4.2 How to See/Get P2P Remote Peers (Network P2P List)
      5. 10.2.5 Negotiation Method
      6. 10.2.6 Manual P2P Connection
      7. 10.2.7 Manual P2P Disconnection
      8. 10.2.8 P2P Profiles
      9. 10.2.9 Removing P2P Profiles
    3. 10.3 P2P Connection Events
    4. 10.4 Use Cases and Configuration
      1. 10.4.1 Case 1 – Nailed P2P Client Low-Power Profile
      2. 10.4.2 Case 2 – Mobile Client Low-Power Profile
      3. 10.4.3 Case 3 – Nailed Center Plugged-in Profile
      4. 10.4.4 Case 4 – Mobile Center Profile
      5. 10.4.5 Case 5 – Mobile General-Purpose Profile
    5. 10.5 Example Code
  11. 11HTTP Server
    1. 11.1  Overview
    2. 11.2  Supported Features
    3. 11.3  HTTP Web Server Description
      1. 11.3.1 Overview
        1. 11.3.1.1 Details
    4. 11.4  HTTP GET Processing
      1. 11.4.1 Overview
      2. 11.4.2 Default Web Page
      3. 11.4.3 SimpleLink GET Tokens
      4. 11.4.4 User-Defined Tokens
      5. 11.4.5 HTML Sample Code With Dynamic HTML Content
    5. 11.5  HTTP POST Processing
      1. 11.5.1 Overview
      2. 11.5.2 SimpleLink POST Tokens
      3. 11.5.3 SimpleLink POST Actions
      4. 11.5.4 User-Defined Tokens
      5. 11.5.5 Redirect after POST
      6. 11.5.6 HTML Sample Code With POST and Dynamic HTML Content
    6. 11.6  Internal Web Page
    7. 11.7  Force AP Mode Support
    8. 11.8  Accessing the Web Page
      1. 11.8.1 SimpleLink in Station Mode
      2. 11.8.2 SimpleLink in AP Mode
    9. 11.9  HTTP Authentication Check
    10. 11.10 Handling HTTP Events in Host Using the SimpleLink Driver
    11. 11.11 SimpleLink Driver Interface the HTTP Web Server
      1. 11.11.1 Enable or Disable HTTP Server
      2. 11.11.2 Configure HTTP Port Number
      3. 11.11.3 Enable or Disable Authentication Check
      4. 11.11.4 Set or Get Authentication Name, Password, and Realm
      5. 11.11.5 Set or Get Domain Name
      6. 11.11.6 Set or Get URN Name
      7. 11.11.7 Enable or Disable ROM Web Pages Access
    12. 11.12 SimpleLink Predefined Tokens
      1. 11.12.1 GET Values
      2. 11.12.2 POST Values
      3. 11.12.3 POST Actions
      4. 11.12.4 HTTP Server Limitations
  12. 12mDNS
    1. 12.1 Overview
    2. 12.2 Protocol Detail
    3. 12.3 Implementation
      1. 12.3.1 Default Implementation
      2. 12.3.2 173
      3. 12.3.3 Start and Stop mDNS
      4. 12.3.4 mDNS Query – One Shot
      5. 12.3.5 mDNS Query – Continuous
      6. 12.3.6 mDNS Service Registration
    4. 12.4 Supported Features
    5. 12.5 Limitations
  13. 13Serial Flash File System
    1. 13.1 Overview
      1. 13.1.1 Summary of Instructions
      2.      File Creation
      3.      File Opening
      4.      File Closing
      5.      File Writing
      6.      File Reading
      7.      File Deleting
      8.      File Information
  14. 14Rx Filter
    1. 14.1 Overview
    2. 14.2 Detailed Description
    3. 14.3 Examples
    4. 14.4 Creating Trees
    5. 14.5 Host API
      1. 14.5.1 Code Example
    6. 14.6 Notes and Limitations
  15. 15Transceiver Mode
    1. 15.1  General Description
    2. 15.2  How to Use / API
    3. 15.3  Sending and Receiving
    4. 15.4  Changing Socket Properties
    5. 15.5  Internal Packet Generator
    6. 15.6  Transmitting CW (Carrier-Wave)
    7. 15.7  Connection Policies and Transceiver Mode
    8. 15.8  Notes about Receiving and Transmitting
      1. 15.8.1 Receiving
    9. 15.9  Use Cases
      1. 15.9.1 Sniffer
    10. 15.10 TX Continues
    11. 15.11 Ping
    12. 15.12 Transceiver Mode Limitations
  16. 16Rx Statistics
    1. 16.1 General Description
    2. 16.2 How to Use / API
    3. 16.3 Notes about Receiving and Transmitting
    4. 16.4 Use Cases
    5. 16.5 Rx Statistics Limitations
  17. 17Asynchronous Events
    1. 17.1 Overview
    2. 17.2 WLAN Events
    3. 17.3 Netapp Events
    4. 17.4 Socket Events
    5. 17.5 Device Events
  18. 18Configurable Info Element
    1. 18.1 General
    2. 18.2 Interface to Application
      1. 18.2.1 API Output
    3. 18.3 Total Maximum Size of all Information Elements
  19. 19Debug
    1. 19.1 Capture NWP Logs
      1. 19.1.1 Overview
      2. 19.1.2 Instructions
        1. 19.1.2.1 Configuring Pin Mux for CC32xx
        2. 19.1.2.2 Terminal Settings
        3. 19.1.2.3 Run Your Program
        4. 19.1.2.4 Send to TI Engineer
          1.        A Host Driver Architecture
            1.         A.1 Overview
              1.          A.1.1 SimpleLink WiFi Host Driver -– Platform-Independent Part
              2.          A.1.2 SimpleLink WiFi Host Driver – Platform-Dependent Part
              3.          A.1.3 SimpleLink WiFi Driver Configuration
              4.          A.1.4 User Application
            2.         A.2 Driver Data Flows
              1.          A.2.1 Transport Layer Protocol
              2.          A.2.2 Command and Command Complete
              3.          A.2.3 Data Transactions
                1.           A.2.3.1 Data Send (From Host to SimpleLink Network Processor)
                2.           A.2.3.2 Data Flow Control
                3.           A.2.3.3 Data Receive (From SimpleLink Network Processor to Host)
                4.           A.2.3.4 Blocking Receive
                5.           A.2.3.5 NonBlocking Receive
                  1.            B Error Codes
                    1.             B.1 Error Codes
                      1.              C How to Generate Certificates, Public Keys, and CAs
                        1.               C.1 Certificate Generation
                          1.                Revision History

Ping

As an illustration of how a RAW packet is built at the application level. The following demonstrates to build a PING packet encapsulated w/ ICMP, IP and MAC protocols.

  1. First, there is the PING message that needs to be transmitted over WLAN PHY.
    GUID-20201223-CA0I-SZVD-K4JN-JWS0BQJ0FGVX-low.png Figure 15-5 Ping Data to be Sent
  2. PING is an ICMP QUERY message, and hence, should first be encapsulated w/ ICMP header.
    GUID-20201223-CA0I-VCHQ-NXDG-54GTJB1CQX8V-low.png Figure 15-6 Frame Format - ICMP
    1. ICMP TYPE is set to 0x08 since this is an ‘Echo-Request’ message.
    2. ICMP CODE will always be 0x00 for PING message.
    3. ICMP CHECKSUM is for header and data and is ‘0xA5, 0x51’ for our message.
    4. ICMP DATA is “PING data to be sent” defined above.
  3. Before sending the ICMP encapsulated PING command to MAC layer, the messages should be encapsulated into IP data grams. Figure 15-7 shows the frame-format of IPv4 packet.
    GUID-20201223-CA0I-SPS1-VGXJ-L8QNBVTB9RJ4-low.png Figure 15-7 Frame Format - IP
    1. VER is set to 4 since it is a IPv4 packet.
    2. HLEN is header length in ‘lwords’ - It will be set to 5 here since the header length is 20 Bytes.
    3. SERVICE TYPE is set to 0x00 since ICMP is a normal service.
    4. TOTAL LENGTH is set as ‘0x00 0x54’ bytes, which includes header and data length.
    5. VENDOR ID is set to 0x00, 0x00, 0x00.
    6. IDENTIFICATION is the unique identity for all data grams sent from this source IP – Let’s set it as ‘0x96, 0xA1’ for our packet.
    7. FLAG and FRAGMENTATION OFFSET is set to 0x00, 0x00 since there is no intent to fragment the packet. Reason: The packet being sent here is smaller than a WLAN frame size.
    8. TIME TO LIVE is set to 0x40 because the packet will be discarded after 64 hops.
    9. PROTOCOL is set to 0x01 since it is an ICMP packet.
    10. 2 Bytes is HEADER CHECKSUM, which is set to 0x57, 0xFA in this case.
    11. SOURCE IP ADDRESS is set to 0xc0, 0xa8, 0x01, 0x64 (which is 192.168.1.100).
    12. DESTINATION IP ADDRESS is set to 0xc0, 0xa8, 0x01, 0x65 (which is 192.168.1.101).
    13. OPTIONS field is left blank.
  4. Next, LLC and MAC headers should be added to the IP encapsulated message. Figure 15-8shows the frame-format of LLC+SNAP header:
    GUID-20201223-CA0I-L31R-SDCT-KMQPGFQ2KZX8-low.png Figure 15-8 Frame Format - IEEE 802.2 LLC (3 bytes) + SNAP (5 bytes)
    1. DSAP is set to 0xAA to specify that it is a SNAP frame.
    2. SSAP is set to 0xAA to specify that it is a SNAP frame.
    3. CONTROL FIELD is set to 0x03 for Sub-Network Access Protocol (SNAP).
    4. VENDOR ID is set to 0x00, 0x00, 0x00.
    5. PROTOCOL TYPE is set to 0x08, 0x00 – This is to indicate that the protocol at layer-4 is IP.
  5. The message is finally encapsulated with the MAC header. Figure 15-9 shows the frame-format of 802.11 MAC header.
    GUID-20201223-CA0I-PSLX-0KPT-ZXFDW82TGHJX-low.png Figure 15-9 Frame Format - 802.11 MAC

    FRAME CONTROL is set to 0x88, 0x02 because of below configuration:

    1. 2-Bits for Protocol Version are set as 00 for 802.11 standard.
    2. 2-Bits for Type are set as 10 for ‘Data’.
    3. 4-Bits for Subtype will set as 1000 for ‘QoS Data’.
    4. Frame Control Field 0x02 is to indicate that the frame is coming from a Distributed-System.
    5. DURATION ID is set to 44 μS.
    6. DESTINATION MAC ADDRESS is set to 0x00, 0x23, 0x75, 0x55,0x55, 0x55.
    7. BSSID MAC ADDRESS is set to 0x00, 0x22, 0x75, 0x55,0x55, 0x55.
    8. SOURCE MAC ADDRESS is set to 0x00, 0x22, 0x75, 0x55,0x55, 0x55.
    9. SEQUENCE CONTROL FIELD is set to 0x42, 0x80.
      1. Sequence Number is set to 1064 – It is the unique identity for all data grams sent from this source MAC.
      2. Fragmentation Number is set to 0 – Indicates that there is no fragmentation required.
  6. The data packet is now encapsulated with ICMP, IP and MAC headers and is ready to be transmitted over WLAN PHY. The following is the complete packet.
    RawPingPacket[] = { 
                   /*---- 802.11 MAC Header -----*/
                          0x88,
                          0x02,
                          0x2C, 0x00,
                          0x00, 0x23, 0x75, 0x55,0x55, 0x55,
                          0x00, 0x22, 0x75, 0x55,0x55, 0x55,
                          0x00, 0x22, 0x75, 0x55,0x55, 0x55,
                          0x80, 0x42, 0x00, 0x00,
       /*---- LLC & SNAP Header -----*/ 
                          0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00,
                          /*---- IP Header -----*/
                          0x45, 0x00, 0x00, 0x54, 0x96, 0xA1, 0x00, 0x00, 0x40, 0x01,
                          0x57, 0xFA,
                          0xc0, 0xa8, 0x01, 0x64,
                          0xc0, 0xa8, 0x01, 0x65,
                          /*---- ICMP Header -----*/
                          0x08, 0x00, 0xA5, 0x51,
                          0x5E, 0x18, 0x00, 0x00,
                   /*---- Payload -----*/
                          0x41, 0x08, 0xBB, 0x8D, 0x00, 0x00,
                          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                          0x00, 0x00, 0x00, 0x00
                          };
  7. To decode the packet, the received response can be unpacked with the following in mind:
    1. CC3x00 device will add 8 Bytes of proprietary radio header to the received packet. The header will have important information about the packet.
      1. 1 Byte (unsigned char) for RATE: This has rate of data reception.
      2. 1 Byte (unsigned char) for CHANNEL: This has the channel-number on which the data is received.
      3. 1 Byte (signed char) for RSSI: It has the computed RSSI value (in dB) of the current frame.
      4. 1 Byte for PADDING-BITS: It’s for 4B alignment.
      5. 4 Byte (unsigned long) for TIMESTAMP: Timestamp (in μS) of the received packet. The received messages are tagged with system-time, which by-default starts from 1-1-2000.
    2. The actual data will follow this 8 Byte header and the application developers should parse it as per their protocol.
    3. Considering 8 Bytes of proprietary radio header that gets added to the received packet, 802.11 MAC Header starts from offset-8 of the received packet.
      1. DESTINATION MAC ADDRESS (6 Byte information) is at offset-4 of 802.11 MAC Header and hence can be extracted starting from offset-12 of received packet.
      2. SOURCE MAC ADDRESS (6 Bytes information) is at offset-16 of 802.11 MAC Header and, hence, can be extracted starting from offset-24 of received packet.
    4. Considering 8 Bytes of proprietary radio header, 26B of MAC header and 8B of LLC & SNAP header, IP-Header starts from offset-42 of received packet.
      1. SOURCE IP ADDRESS (4 Byte information) is at offset-12 of ‘IP Header’ and hence can be extracted starting from offset-54 of received packet.
      2. DESTINATION IP ADDRESS (4 Byte information) is at offset-16 of ‘IP Header’ and, hence, can be extracted starting from offset-58 of received packet.
    5. The rest of the packet can be decoded as per the next level protocol, and the final decoding code will look like the following:
    typedef struct { 
       UINT8   rate;
       UINT8   channel;
       INT8    rssi;
       UINT8   padding;
       UINT32 timestamp;
    } 
    TransceiverRxOverHead_t; 
    void TransceiverModeRx (INT8 <channel_number>, INT32 <pkts_to_receive>) { 
       TransceiverRxOverHead_t *frameRadioHeader = NULL;
       UINT8 buffer[BUFFER_SIZE] = {'\0'};
       INT32 <socket_hanlde> = -1;
       INT32 recievedBytes = 0;
       <socket_hanlde>= sl_Socket(SL_AF_RF, SL_SOCK_RAW, <channel_number>);
       while(<pkts_to_receive>--)
       {
           memset(&buffer[0], 0, sizeof(buffer));
           recievedBytes = sl_Recv(<socket_hanlde>, buffer, BUFFER_SIZE, 0);
           frameRadioHeader = (TransceiverRxOverHead_t *)buffer;
           PRINT(" ===>>> Timestamp: %iuS, Signal Strength: %idB\n\r", frameRadioHeader->timestamp, frameRadioHeader->rssi);
           PRINT(" ===>>> Destination MAC Address: %02x:%02x:%02x:%02x:%02x:%02x\n\r", buffer[12], buffer[13], buffer[14], buffer[15], buffer[16], buffer[17]);
           PRINT(" ===>>> Source MAC Address: %02x:%02x:%02x:%02x:%02x:%02x\n\r", buffer[24], buffer[25], buffer[26], buffer[27], buffer[28], buffer[29]);
           PRINT(" ===>>> Source IP Address: %d.%d.%d.%d\n\r", buffer[54],  buffer[55], buffer[56],  buffer[57]);
           PRINT(" ===>>> Destination IP Address: %d.%d.%d.%d\n\r", buffer[58],  buffer[59], buffer[60],  buffer[61]);
       }
       sl_Close(<socket_handle>);