SWRU455M February   2017  – October 2020 CC3120 , CC3120MOD , CC3130 , CC3135 , CC3135MOD , CC3220MOD , CC3220MODA , CC3220R , CC3220S , CC3220SF , CC3230S , CC3230SF , CC3235MODAS , CC3235MODASF , CC3235MODS , CC3235MODSF , CC3235S , CC3235SF

 

  1. Overview
    1. 1.1 Trademarks
  2. Introduction
    1. 1.1 Features
    2. 1.2 Key Features
    3. 1.3 Block Diagram
    4. 1.4 Host Driver Overview
      1. 1.4.1 Host Interface
      2. 1.4.2 OS versus Non-OS
      3. 1.4.3 Quick Reference
      4. 1.4.4 Porting to Different Platforms
    5. 1.5 Acronyms and Terminologies
  3. Networking Application
    1. 2.1 Introduction
      1. 2.1.1 Wi-Fi Connectivity
      2. 2.1.2 Traffic Types
      3. 2.1.3 Security
      4. 2.1.4 User Experience
      5. 2.1.5 Power Consumption
      6. 2.1.6 Provisioning
    2. 2.2 Basic Examples
      1. 2.2.1 Wi-Fi Doorbell
        1. 2.2.1.1 Description
        2. 2.2.1.2 Design Considerations
      2. 2.2.2 Power Socket
        1. 2.2.2.1 Description
        2. 2.2.2.2 Design Constraints
      3. 2.2.3 Wi-Fi Tag
        1. 2.2.3.1 Description
        2. 2.2.3.2 Design Consideration
  4. Device
    1. 3.1  Introduction
    2. 3.2  Key Features
    3. 3.3  Start and Stop
      1. 3.3.1 Start
      2. 3.3.2 Stop
      3. 3.3.3 Hibernate and Shutdown
      4. 3.3.4 Lock State
      5. 3.3.5 Initialization Sequence
    4. 3.4  Host Interface
      1. 3.4.1 SPI Interface
      2. 3.4.2 UART Interface
        1. 3.4.2.1 Change UART Baud Rate
    5. 3.5  Version
    6. 3.6  Event Mask
    7. 3.7  Time and Date
    8. 3.8  MAC Address
    9. 3.9  Device Name
    10. 3.10 Domain Name
    11. 3.11 Device Status
    12. 3.12 Persistent Configuration
    13. 3.13 Device Statistics
    14. 3.14 Errors
  5. WLAN
    1. 4.1  Introduction
    2. 4.2  Key Features
    3. 4.3  Station (STA)
      1. 4.3.1 General Description
      2. 4.3.2 Configurations and Settings
        1. 4.3.2.1 Set Mode
        2. 4.3.2.2 Set General STA Parameters
      3. 4.3.3 Connection
        1. 4.3.3.1 Connection Policies
        2. 4.3.3.2 Preferred Networks (Profiles)
        3. 4.3.3.3 Manual Connection
      4. 4.3.4 Events and Errors
      5. 4.3.5 RSSI Trigger
      6. 4.3.6 Soft-Roaming
      7. 4.3.7 Beacon Interval and DTIM Period
      8. 4.3.8 Agile Multiband
      9. 4.3.9 Triggered Roaming
    4. 4.4  Access Point
      1. 4.4.1 General Description
      2. 4.4.2 Configurations and Settings
        1. 4.4.2.1 Set Mode
        2. 4.4.2.2 Set General AP Parameters
        3. 4.4.2.3 Get General AP Parameters
        4. 4.4.2.4 Black List
      3. 4.4.3 Set Network Configuration
        1. 4.4.3.1 Set AP IP Parameters
      4. 4.4.4 Station Management
        1. 4.4.4.1 Get Connected Stations
        2. 4.4.4.2 Disconnect a Station
      5. 4.4.5 Events and Errors
      6. 4.4.6 Limitations
    5. 4.5  Wi-Fi Direct
      1. 4.5.1 General Description
      2. 4.5.2 Supported Features
      3. 4.5.3 Configurations and Settings
        1. 4.5.3.1 Configuring Wi-Fi Direct General Parameters
        2. 4.5.3.2 Set Wi-Fi Direct Policy
        3. 4.5.3.3 Configure Connection Policy
      4. 4.5.4 Connection
      5. 4.5.5 Events and Errors
      6. 4.5.6 Limitations
    6. 4.6  WLAN Security
      1. 4.6.1 Personal Security
      2. 4.6.2 Enterprise Security
      3. 4.6.3 WPS
    7. 4.7  Scan
      1. 4.7.1 General Description
      2. 4.7.2 Connection Scan
      3. 4.7.3 Configuration (AP/STA)
      4. 4.7.4 Usage
      5. 4.7.5 Miscellaneous
    8. 4.8  Antenna Diversity
      1. 4.8.1 Overview
      2. 4.8.2 Configuration
      3. 4.8.3 Pad Selection
    9. 4.9  Calibrations
      1. 4.9.1 2.4-GHz Wi-Fi Calibration Modes
      2. 4.9.2 5-GHz Wi-Fi Calibration Modes
        1. 4.9.2.1 Serving Channel Calibrations
        2. 4.9.2.2 Non-Serving Channel Calibrations
        3. 4.9.2.3 Storing Calibration Data
        4. 4.9.2.4 Transceiver Socket
    10. 4.10 BLE / 2.4-GHz Radio Coexistence
      1. 4.10.1 Key Features
      2. 4.10.2 Configuration and Settings
      3. 4.10.3 Operation
        1. 4.10.3.1 Calibration
  6. Network Addresses
    1. 5.1 Introduction
    2. 5.2 Key Features
    3. 5.3 Addressing
      1. 5.3.1 IPv4 Addresses
      2. 5.3.2 IPv6 Addresses
        1. 5.3.2.1 Local Link
        2. 5.3.2.2 Link-Global
      3. 5.3.3 DNS Addresses
    4. 5.4 DHCPv4 Client
      1. 5.4.1 Modes
      2. 5.4.2 Address Release
    5. 5.5 DHCPv4 Server
      1. 5.5.1 Enable and Disable the DHCP Server
      2. 5.5.2 Set DHCP Server Parameters
    6. 5.6 DNS Server
    7. 5.7 Errors and Asynchronous Events
  7. Socket
    1. 6.1 Introduction
    2. 6.2 Key Features
    3. 6.3 Socket Types
    4. 6.4 BSD API
    5. 6.5 Socket Working Flow
      1. 6.5.1 TCP
        1. 6.5.1.1 Client Side
        2. 6.5.1.2 Server Side
        3. 6.5.1.3 TCP Keep Alive
      2. 6.5.2 UDP
        1. 6.5.2.1 Multicast
        2. 6.5.2.2 Packet Boundary
      3. 6.5.3 RAW
        1. 6.5.3.1 Layer 4: Transport
        2. 6.5.3.2 Layer 3: Network
        3. 6.5.3.3 Layer 2: Data Link (Transceiver Mode, Not Connected)
      4. 6.5.4 Network Bypass Mode
    6. 6.6 DNS
    7. 6.7 Operation Modes
      1. 6.7.1 Nonblocking Mode
      2. 6.7.2 Trigger Mode
        1. 6.7.2.1 Trigger Mode for Accept
        2. 6.7.2.2 Trigger Mode for Data Reception
      3. 6.7.3 Multiple Select
    8. 6.8 IP Fragmentation
    9. 6.9 Errors
  8. Secure Socket
    1. 7.1 Introduction
    2. 7.2 Key Features
    3. 7.3 Opening a Secure Socket
    4. 7.4 Trusted Root-Certificate Catalog
    5. 7.5 Options and Features Use
      1. 7.5.1 Set TLS Version
      2. 7.5.2 Set Cipher Suites
      3. 7.5.3 Set Certificates, Root CA, Private Key, and DH Files
      4. 7.5.4 Disable the Use of the Trusted Root-Certificate Catalog
      5. 7.5.5 Set ALPN List
        1. 7.5.5.1 ALPN Fixed List
        2. 7.5.5.2 ALPN Generic
      6. 7.5.6 Set Domain Name for Verification and SNI
      7. 7.5.7 Enable OCSP Check
      8. 7.5.8 Upgrade Nonsecured Socket to Secured
      9. 7.5.9 Get Connection Parameters
    6. 7.6 Supported Cryptographic Algorithms
    7. 7.7 Common Errors and Asynchronous Events
      1. 7.7.1 Using Socket Asynchronous Events in TLS
      2. 7.7.2 Common Errors
  9. File System
    1. 8.1  Introduction
    2. 8.2  Key Features
    3. 8.3  File System Characteristics
    4. 8.4  Write a File
      1. 8.4.1 Introduction
      2. 8.4.2 Create a File versus Open for Write
      3. 8.4.3 Create a File
        1. 8.4.3.1 Secure File Creation Notes
        2. 8.4.3.2 Forced Creation Flags
      4. 8.4.4 Open a File for Write
      5. 8.4.5 Write an Opened File
      6. 8.4.6 Close an Opened File (for Write)
      7. 8.4.7 Close an Opened Secure-Signed File (for Write)
    5. 8.5  Read a File
      1. 8.5.1 Open a File for Read
      2. 8.5.2 Read an Opened File
      3. 8.5.3 Close an Opened File (for Read)
    6. 8.6  Delete a File
    7. 8.7  Rename a File
    8. 8.8  File System Helper Functions
      1. 8.8.1 Get File Information
      2. 8.8.2 Get Storage Information
      3. 8.8.3 Get List of Files
    9. 8.9  Bundle Protection
      1. 8.9.1 Bundle File States
      2. 8.9.2 Bundle States
        1. 8.9.2.1 STOPPED
        2. 8.9.2.2 STARTED
        3. 8.9.2.3 PENDING_COMMIT
      3. 8.9.3 Commit a Bundle
      4. 8.9.4 Rollback a Bundle
      5. 8.9.5 Retrieve the Bundle and Files State
      6. 8.9.6 M4 Host Application Bundle Aspects
    10. 8.10 File Commit Feature
      1. 8.10.1 File Commit Process
    11. 8.11 File Rollback Process
    12. 8.12 Programming
      1. 8.12.1 Creation of the Programming Image
        1. 8.12.1.1 Programming Image Types
        2. 8.12.1.2 Program the Device
          1. 8.12.1.2.1 Image Creator Tool (UART) Programming
          2. 8.12.1.2.2 Host Programming
          3. 8.12.1.2.3 External Tool Programming
    13. 8.13 Restore to Factory
      1. 8.13.1 Restore to Factory by the Host
      2. 8.13.2 Restore to Factory by Using the SOP
        1. 8.13.2.1 CC31xx
        2. 8.13.2.2 CC32xx
    14. 8.14 Security Alerts
    15. 8.15 Design Consideration
      1. 8.15.1 Choosing SFLASH Type
      2. 8.15.2 Software Design Consideration
      3. 8.15.3 Retrieving Info Regarding SFLASH Usage
      4. 8.15.4 SFLASH Size
        1. 8.15.4.1 Restore to Factory is Disabled
        2. 8.15.4.2 Restore to Factory is Enabled
      5. 8.15.5 Storage Usage Information
  10. HTTP Server
    1. 9.1 Introduction
      1. 9.1.1 Built-in Configuration Pages
      2. 9.1.2 RESTful APIs
        1. 9.1.2.1 Changing Configuration
        2. 9.1.2.2 Reading Configuration
      3. 9.1.3 Custom Static Pages
        1. 9.1.3.1 Custom Pages With Device Tokens
        2. 9.1.3.2 Static Pages With Host Tokens
      4. 9.1.4 Host Application Interface
    2. 9.2 Key Features
    3. 9.3 Configurations and Settings
    4. 9.4 RESTful API Processing
      1. 9.4.1  Ping
      2. 9.4.2  IP Configuration
      3. 9.4.3  URN Configuration
      4. 9.4.4  WLAN Profiles
      5. 9.4.5  WLAN Scan
      6. 9.4.6  Provisioning Confirmation
      7. 9.4.7  Connection Policy
      8. 9.4.8  Station Action
      9. 9.4.9  AP Black List
      10. 9.4.10 Date and Time
    5. 9.5 Device Parameter Querying Through HTTP (Device Tokens)
      1. 9.5.1  Retrieving Tokens Through GET Request
      2. 9.5.2  Embedded Tokens
      3. 9.5.3  System Information
      4. 9.5.4  Version Information
      5. 9.5.5  Network Information
      6. 9.5.6  Ping Results
      7. 9.5.7  Connection Policy Status
      8. 9.5.8  Provisioning
      9. 9.5.9  Display Profile Information
      10. 9.5.10 P2P Information
      11. 9.5.11 Host Tokens
    6. 9.6 Resource Search Order
      1. 9.6.1 GET Request Search Order
      2. 9.6.2 POST Request Search Order
      3. 9.6.3 PUT and DELETE Request Search Order
    7. 9.7 Host HTTP Requests Processing
      1. 9.7.1 Metadata (TLVs) Description
      2. 9.7.2 GET Processing
        1. 9.7.2.1 Fragmentation
      3. 9.7.3 POST Processing
        1. 9.7.3.1 Long Requests and Delayed Responses
      4. 9.7.4 PUT Processing
      5. 9.7.5 DELETE Processing
    8. 9.8 Security
      1. 9.8.1 Authentication
        1. 9.8.1.1 HTTP Realm
      2. 9.8.2 Secure Connection
    9. 9.9 Processing of Parallel Requests
  11. 10mDNS
    1. 10.1 Introduction
    2. 10.2 Key Features
    3. 10.3 Configurations and Settings
    4. 10.4 Query
      1. 10.4.1 One Shot Query
      2. 10.4.2 Continuous Query
      3. 10.4.3 Mask Services
    5. 10.5 Get Service List
    6. 10.6 Advertisement
      1. 10.6.1 Registering mDNS Services
      2. 10.6.2 Unregistering mDNS Services
      3. 10.6.3 Advertisement Settings
        1. 10.6.3.1 Timing
        2. 10.6.3.2 Update Text
    7. 10.7 Limitations
  12. 11Rx Filters
    1. 11.1 Introduction
    2. 11.2 Matching Process
      1. 11.2.1 Filter Matching
      2. 11.2.2 Tree Traversal
    3. 11.3 Examples of Filter Use
      1. 11.3.1 Example 1
      2. 11.3.2 Example 2
    4. 11.4 Filter Creation
      1. 11.4.1 Filter Type
      2. 11.4.2 Filter Flags
      3. 11.4.3 Rule Structure for Header Filters
        1. 11.4.3.1 Field
        2. 11.4.3.2 Compare Functions
        3. 11.4.3.3 Rule Fields
        4. 11.4.3.4 Pattern-Matching Rule Fields
      4. 11.4.4 Rule Structure for Combined Filters
      5. 11.4.5 Filter Trigger
        1. 11.4.5.1 Parent Filter ID
        2. 11.4.5.2 Connection State and Role
        3. 11.4.5.3 Filter During Transceiver Mode
      6. 11.4.6 Rx Filter Action
        1. 11.4.6.1 Send Events Action
        2. 11.4.6.2 Multiple Bits Set on the Same Event
        3. 11.4.6.3 Multiple Events From the Same Rx Frame
        4. 11.4.6.4 Code Example
        5. 11.4.6.5 Counter Action
    5. 11.5 Managing Filters
      1. 11.5.1 Enable and Disable Filters
      2. 11.5.2 Get Filter Status
      3. 11.5.3 Removing a Filter
      4. 11.5.4 Storing Filters into the SFLASH
      5. 11.5.5 Update Filter Arguments
  13. 12Ping
    1. 12.1 General Description
    2. 12.2 Start and Stop Ping
    3. 12.3 Limitations
  14. 13Transceiver
    1. 13.1 Introduction
    2. 13.2 Key Features
    3. 13.3 Configurations and Setting
      1. 13.3.1 Open Transceiver Socket
      2. 13.3.2 Close Transceiver Socket
      3. 13.3.3 Send Data
      4. 13.3.4 Receive Data
    4. 13.4 Internal Packet Generator
    5. 13.5 CW
    6. 13.6 Changing Socket Properties
      1. 13.6.1 Change Operating Channel
      2. 13.6.2 Change Default PHY Data Rate
      3. 13.6.3 Change Tx Power
      4. 13.6.4 Change Number of Frames to Transmit (Internal Packet Generator)
      5. 13.6.5 Change 802.11b Preamble
      6. 13.6.6 Set CCA Threshold
      7. 13.6.7 Set Tx Frames Time-out
      8. 13.6.8 Enable or Disable Sending ACKs
    7. 13.7 Limitations
  15. 14Real-Time RSSI
    1. 14.1 Introduction
    2. 14.2 Data Structure
    3. 14.3 Configurations and Settings
      1. 14.3.1 Connect to an AP
      2. 14.3.2 Opening Real-Time RSSI Socket
      3. 14.3.3 Example Code
    4. 14.4 Constraints
  16. 15Power Management
    1. 15.1 Introduction
      1. 15.1.1 Key Features
      2. 15.1.2 LPDS
      3. 15.1.3 802.11 Power Save
        1. 15.1.3.1 LSI (Long Sleep Interval)
      4. 15.1.4 WFA IoT Low Power
      5. 15.1.5 Low Power versus Latency
      6. 15.1.6 Power Modes versus Device Modes
    2. 15.2 Configurations and Settings
      1. 15.2.1 Changing Power Policy
      2. 15.2.2 Enabling Fast Connect
    3. 15.3 Network Applications and Power Consumption
      1. 15.3.1 mDNS
      2. 15.3.2 HTTP Server
    4. 15.4 Design Guidelines
      1. 15.4.1 LSI and Packet Loss
      2. 15.4.2 PHY Calibration Mode
  17. 16Provisioning
    1. 16.1  Introduction
    2. 16.2  Key Features
    3. 16.3  Provisioning Process Overview
      1. 16.3.1 Configuring a Profile
      2. 16.3.2 Confirming a Profile
    4. 16.4  Host Provisioning Application Flow
    5. 16.5  Configuration Modes
      1. 16.5.1 AP Provisioning
      2. 16.5.2 SC Provisioning
      3. 16.5.3 AP and SC Provisioning
      4. 16.5.4 AP and SC and External Configuration Provisioning
    6. 16.6  Starting and Stopping the Provisioning Process
    7. 16.7  Auto-Provisioning
    8. 16.8  Delivering Feedback to the User
      1. 16.8.1 External Confirmation
    9. 16.9  External Configuration
    10. 16.10 Common Events and Errors
      1. 16.10.1 Provisioning Status Event
      2. 16.10.2 Provisioning Profile-Added Event
      3. 16.10.3 Reset Request Event
      4. 16.10.4 Errors
      5. 16.10.5 Host Commands During Provisioning
    11. 16.11 Usage Examples
      1. 16.11.1 Successful SmartConfig Provisioning
      2. 16.11.2 Unsuccessful SmartConfig Provisioning
      3. 16.11.3 Successful SmartConfig Provisioning With AP Fallback
      4. 16.11.4 Successful AP Provisioning
      5. 16.11.5 Successful AP Provisioning With Cloud Confirmation
      6. 16.11.6 Using External Configuration Method: WAC
      7. 16.11.7 Successful SmartConfig Provisioning While External Configuration Enabled
  18. 17Crypto Utilities
    1. 17.1 Introduction
      1. 17.1.1 API and Usage
        1. 17.1.1.1 Install and Uninstall Key-Pairs and Certificates
        2. 17.1.1.2 Create or Remove Temporary Key
        3. 17.1.1.3 Get Public Key
        4. 17.1.1.4 Certificate Creation
        5. 17.1.1.5 Sign Buffer
        6. 17.1.1.6 Verify Buffer
        7. 17.1.1.7 True Random Number
      2. 17.1.2 Limitations and Constraints
      3. 17.1.3 Errors
    2. 17.2 Secured Content Delivery
      1. 17.2.1 SimpleLink Wi-Fi Side Process Flow
      2. 17.2.2 Encrypted File Format
  19. 18Hostless Mode
    1. 18.1 Introduction
    2. 18.2 Script Overview
    3. 18.3 Conditions
      1. 18.3.1 Pre-Initialization
      2. 18.3.2 System Event
      3. 18.3.3 Timer Expiration
      4. 18.3.4 Counter Threshold
      5. 18.3.5 Internal Errors
    4. 18.4 Sub-Conditions
    5. 18.5 Actions
      1. 18.5.1 Pre-Initialization Actions
        1. 18.5.1.1 Set Role
        2. 18.5.1.2 Delete All Profiles
        3. 18.5.1.3 Hardware GPIO
      2. 18.5.2 Run-Time Actions
        1. 18.5.2.1 Send Transceiver Packet
        2. 18.5.2.2 Send UDP Packet
        3. 18.5.2.3 Send TCP Packet
        4. 18.5.2.4 Set/Increment Counter
        5. 18.5.2.5 Timer Control
        6. 18.5.2.6 Set GPIO
        7. 18.5.2.7 Enter Hibernate
  20. 19Porting the Host Driver
    1. 19.1 Introduction
    2. 19.2 Create Platform Porting File
    3. 19.3 Select Capabilities Set
    4. 19.4 Bind the Device Enable/Disable Line
    5. 19.5 Implement the Interface Communication Abstract Layer
    6. 19.6 Choose Memory-Management Model
    7. 19.7 Implement OS Adaptation Layer
      1. 19.7.1 Sync Objects
      2. 19.7.2 Locking Objects
    8. 19.8 Implement Timestamp Services
    9. 19.9 Set Asynchronous Event Handler Routines
  21. 20Debug
    1. 20.1 Capture NWP Logs
      1. 20.1.1 Overview
      2. 20.1.2 Instructions
        1. 20.1.2.1 Configuring Pin Mux for CC32xx
        2. 20.1.2.2 Terminal Settings
        3. 20.1.2.3 Run Your Program
        4. 20.1.2.4 Send to TI Engineer
          1.        A Host APIs
            1.         A.1 Host APIs
              1.          B Persistency
                1.           B.1 Persistency
                  1.            C Regulatory Domain
                    1.             C.1 Regulatory Domain
                      1.              D Supported Host Interfaces
                        1.               D.1 SPI Host Interface
                          1.                D.1.1 Introduction
                          2.                D.1.2 Abbreviations
                          3.                D.1.3 SPI Modes
                          4.                D.1.4 SPI Configurations (Shared SPI)
                          5.                D.1.5 SPI Initialization
                          6.                D.1.6 Host Interface Protocol - SPI Perspective
                        2.               D.2 UART Host Interface
                          1.                D.2.1 Introduction
                          2.                D.2.2 Host Low Power Modes
                          3.                D.2.3 UART Host Topologies
                            1.                 D.2.3.1 5-Wire UART Topology
                            2.                 D.2.3.2 4-Wire UART Topology
                            3.                 D.2.3.3 3-Wire UART Topology
                          4.                D.2.4 UART Configuration
                          5.                D.2.5 UART Initialization
                            1.                 D.2.5.1 Changing the UART Baud Rate
                          6.                D.2.6 Implementing the UART Driver - Concept and Terminology
                            1.                 D.2.6.1 UART Read API Implementation
                            2.                 D.2.6.2 UART Write API Implementation
                          7.                D.2.7 Register/Unregister Interrupt Handler API Implementation
                          8.                D.2.8 Host Interface Protocol – UART Perspective
                            1.                 D.2.8.1 UART Host Command Flow
                            2.                 D.2.8.2 Synchronization Words
                              1.                  Revision History

Connection

  • Discovering Remote Wi-Fi Direct Peers

    This section describes how to start a Wi-Fi Direct search or discovery, and how to view the discovered remote Wi-Fi Direct devices. The scan policy must be set to start the Wi-Fi Direct find process, and to discover remote Wi-Fi Direct peers. This process is done by setting a scan policy for Wi-Fi Direct mode.

    Note:
    • Setting the scan policy should be done while the device is in Wi-Fi Direct mode.
    • Wi-Fi Direct discovery is performed as a part of any connection, but it can be activated using SCAN_POLICY as well.
    • This configuration is not persistent.

    Example:

    _u32 intervalInSeconds = 20;    
    _i16 Status;
    Status  = sl_WlanPolicySet(SL_WLAN_POLICY_SCAN, SL_WLAN_SCAN_POLICY(1,1), (_u8*)&intervalInSeconds,sizeof(intervalInSeconds));
    if( Status )
    {
        /* error */
    }
    
  • Retrieve Remote Wi-Fi Direct Peers

    There are two ways to see and get Wi-Fi Direct remote devices that were discovered during the Wi-Fi Direct find and search operation:

    • Listening to the event SL_WLAN_EVENT_P2P_DEVFOUND:

      This event is sent asynchronously to the host when a remote Wi-Fi Direct is found, and contains the MAC address, device name, and length of the device name. By listening to this event, the user can immediately find each remote Wi-Fi Direct device that exists in their neighborhood, and issue a connect or add profile command.

    • Calling sl_WlanGetNetworkList:

      By calling this API, the user receives a list of remote peers that were found during the scan and saved in the device cache memory. By receiving the network list, the user can immediately find any remote Wi-Fi Direct device and issue a manual connection or add profile command.

    Example:

    SlWlanNetworkEntry_t netEntries[30];
    _i16 resultsCount = sl_WlanGetNetworkList(0,30,&netEntries[0]);
    
  • Wi-Fi Direct Remote Connection

    Enabling the scan policy sets the device to be discoverable for other devices. The two following options are available to complete the connection:

    • Combine the scan policy first with the connection policy AnyP2P, and allow the remote device to find and complete the connection without any action from the user side (PBC only).
    • Listen to the SL_WLAN_EVENT_P2P_REQUEST event. This event holds information about the remote device that initiated the connection such as the device name, name length, MAC address, and WPS method. To complete the connection issue, connect or add profile command with the correct parameters.

  • Negotiation Method

    The following are two different Wi-Fi Direct negotiation methods which indicate the WPS phase that follows to the negotiation:

    • Push-button

      Both sides negotiate with PBC method. Define: SL_WLAN_SEC_TYPE_P2P_PBC.

    • Pin Code Connection

      Divided to two options:

      • PIN_DISPLAY – this side looks for this pin to be written by its remote peer. Define: SL_WLAN_SEC_TYPE_P2P_PIN_DISPLAY
      • PIN_KEYPAD – this side sends a pin code to its remote peer. Define: SL_WLAN_SEC_TYPE_P2P_PIN_KEYPAD

These parameters influence the negotiation method and are supplied during the manual connection API command that comes from the host or by setting the profile for automatic connection. The negotiation method is performed by the device without a user interference.

Note:

If no pin code is entered in the display side, the NWP auto-generates the pin code from the device MAC using the following method:

  1. Take the 7 LSB decimal digits in the device MAC address.
  2. Add the checksum of the 7 LSB decimal digits to the LSB (8 digits total).

For example, if the MAC address is 03:4A:22:3B:FA:42, convert to it decimals (059:250:066); 7 LSB decimal digits are: 9250066, and the WPS pin checksum digit is 2. The default pin code for this MAC is 92500662.

Configure the negotiation method by setting the security type in the security structure when issuing a connect or add profile command.

  • Push Button: secParams.Type = SL_WLAN_SEC_TYPE_P2P_PBC
  • Pin Code Keypad:
    • secParams.Type = SL_WLAN_SEC_TYPE_PIN_KEYPAD
    • secParams.Key = “12345670”
  • Pin Code Display:
    • secParams.Type = SL_WLAN_SEC_TYPE_PIN_ DISPLAY
    • secParams.Key = “12345670”

  • Manual Connection

    After finding a remote Wi-Fi Direct device, the host can instruct the device to connect to it by issuing a simple connect command. This command performs immediate Wi-Fi Direct discovery, and once the remote device is found, the negotiation phase is started according to the negotiation initiator policy, method, and intent selected.

    Note:
    • The connection parameters are not saved to flash memory so in case of disconnection or reset no reconnection will be done, unless fast-connect policy is on.
    • This connection is treated as higher priority than connection through profiles. This indicates that if there is already an existing Wi-Fi Direct connection in the system, the current connection will be disconnected and the manual connection is carried out.
    • At the beginning of the discovery phase, full scan cycle on all channels is performed to find Autonomous GO which can operate on every channel.

    Example:

    _i16 Status;
    SlWlanSecParams_t SecParams;
    Status  = sl_WlanConnect("my-tv-p2p-device", 16, NULL, &SecParams ,0);
    if( Status )
    {
        /* error */
    }
    
  • Manual Disconnection

    The manual disconnect option lets the user disconnect from the remote peer by a host command. This command performs Wi-Fi Direct group.

    Example:

    _i16 Status;
    Status  = sl_WlanDisconnect();
    if( Status )
    {
         /* error */
    }
    
  • Wi-Fi Direct Profiles

    The purpose of profile configuration is to make an automatic Wi-Fi Direct connection after reset, or after disconnection from the remote peer device. The add profile command stores the Wi-Fi Direct remote device parameters in flash as a new profile, along with profile priority. These profiles are similar to the STA mode profiles and have the same automatic connection behavior. The connection is dependent on the profile policy configuration (see the connection policy section). If the Auto policy is on, a Wi-Fi Direct discovery is performed, and if one or more of the found remote devices matches one of the profiles, a negotiation phase is started according to the negotiation initiator policy, method, and intent selected. The chosen profile is the one with the highest-priority profile.

    Note:

    If a manual connection is sent during a profile connection, the profile connection is stopped, and the manual connection is started.

    Example:

    _u8 val = 1;
    _u8 policyVal;
    _i16 Role, Status;
    _u8  my_p2p_device[33];
    _u8  remote_p2p_device[33];
    _u8 bssidEmpty[6] = {0,0,0,0,0,0};
    SlWlanSecParams_t SecParams;
    Role = sl_Start(NULL, NULL, NULL);
    if( Role !=  ROLE_P2P)
    {
       /* Set P2P as active mode */
       Status = sl_WlanSetMode(ROLE_P2P);
    }
    /* Set Wi-Fi Direct client dhcp enable (assuming remote GO running DHCP server) */
    Status = sl_NetCfgSet(SL_NETCFG_IPV4_STA_ADDR_MODE, SL_NETCFG_ADDR_DHCP,0,0);
    if( Status )
    {
        /* error */
    }
    /* Set Device Name */
    strcpy(my_p2p_device,"sl_p2p_device");
    Status = sl_NetAppSet (SL_NETAPP_DEVICE_ID, SL_NETAPP_DEVICE_URN, strlen(my_p2p_device), (_u8 *) my_p2p_device);
    if( Status )
    {
        /* error */
    }
    /* set connection policy Auto-Connect and Fast*/
    Status = sl_WlanPolicySet(SL_WLAN_POLICY_CONNECTION, SL_WLAN_CONNECTION_POLICY (1/*Auto*/,1/*Fast*/, 0/*OpenAP*/,0/*AnyP2P*/,0/*auto provisioning*/), NULL, 0 );
    /* set P2P Policy - intent 0, random backoff */
    Status = sl_WlanPolicySet( SL_WLAN_POLICY_P2P, SL_WLAN_P2P_POLICY(SL_WLAN_P2P_ROLE_CLIENT/*Intent 0 - Client*/,
    SL_WLAN_P2P_NEG_INITIATOR_RAND_BACKOFF/*Negotiation initiator – random backoff*/),NULL,0);
    SecParams.Type = SL_WLAN_SEC_TYPE_P2P_PBC;
    SecParams.Key = "";
    SecParams.KeyLen = 0;
    strcpy(remote_p2p_device,"Remote_GO_Device_XX");
    Status = sl_WlanProfileAdd(remote_p2p_device, strlen(remote_p2p_device),bssidEmpty,&SecParams ,NULL ,7,0);
    if( Status )
    {
        /* error */
    }
    //restart the device
    Status = sl_Stop(100);
    if( Status )
    {
        /* error */
    }
    Role = sl_Start(NULL, NULL, NULL);