TIDUE59A May   2018  – September 2020

 

  1.   Description
  2.   Resources
  3.   Features
  4.   Applications
  5. 1System Description
    1. 1.1 Key System Specifications
  6. 2System Overview
    1. 2.1 Block Diagram
    2. 2.2 Design Considerations
    3. 2.3 Highlighted Products
      1. 2.3.1 CC3220
      2. 2.3.2 CC2640R2F
      3. 2.3.3 DRV8837
    4. 2.4 System Design Theory
      1. 2.4.1 CC3220S to CC2640R2F Interface
      2. 2.4.2 CC3220S to DRV8837 Interface
      3. 2.4.3 Software Architecture
      4. 2.4.4 Network Connection Management
      5. 2.4.5 Provisioning
        1. 2.4.5.1 AP Provisioning and SmartConfig™
        2. 2.4.5.2 Wi-Fi Provisioning Over BLE
      6. 2.4.6 Sending and Receiving Messages Through Cloud
        1. 2.4.6.1 Message Queue Telemetry Transport Protocol
        2. 2.4.6.2 MQTT Client Implementation
      7. 2.4.7 Over-the-Air Updates
        1. 2.4.7.1 HyperText Transfer Protocol
      8. 2.4.8 Security Enablers
        1. 2.4.8.1 Secure Boot
        2. 2.4.8.2 Secure Sockets
          1. 2.4.8.2.1 Hardware Accelerators
          2. 2.4.8.2.2 Simple Network Time Protocol
        3. 2.4.8.3 File System Security
          1. 2.4.8.3.1 Failsafe Files and Bundle Protection
      9. 2.4.9 Low-Power Consumption
  7. 3Hardware, Software, Testing Requirements, and Test Results
    1. 3.1 Required Hardware and Software
      1. 3.1.1 Hardware
        1. 3.1.1.1 CC3220S LaunchPad™ Development Kit
        2. 3.1.1.2 CC2640R2F LaunchPad™ Development Kit
        3. 3.1.1.3 Sensor BoosterPack™ Connections (BMI160)
        4. 3.1.1.4 DRV8837EVM Modifications and Connections
        5. 3.1.1.5 Assembling EVMs
      2. 3.1.2 Software
        1. 3.1.2.1 Getting Started With Software
          1. 3.1.2.1.1 Build simple_np Application and Flash CC2640R2F
          2. 3.1.2.1.2 Use Premade UniFlash ImageCreator Project
          3. 3.1.2.1.3 Importing Project Source Files Into CCS
        2. 3.1.2.2 User Files
        3. 3.1.2.3 Run Wi-Fi® Doorlock Demo
          1. 3.1.2.3.1 Connect CC3220 to Network
          2. 3.1.2.3.2 Networking Functions
            1. 3.1.2.3.2.1 Get Current Date and Time (SNTP)
            2. 3.1.2.3.2.2 Send and Receive Messages (MQTT)
            3. 3.1.2.3.2.3 Perform Software Update Using Dropbox (OTA Update)
    2. 3.2 Testing and Results
      1. 3.2.1 Pass or Fail Tests
      2. 3.2.2 Power Measurements
      3. 3.2.3 Test Setup
        1. 3.2.3.1 CC3220S
        2. 3.2.3.2 CC2640R2F
        3. 3.2.3.3 DRV8837
      4. 3.2.4 Test Results
      5. 3.2.5 Battery Life Estimate
  8. 4Design Files
  9. 5Software Files
  10. 6Related Documentation
    1. 6.1 Trademarks
  11. 7Terminology
  12. 8About the Author
  13. 9Revision History
Importing Project Source Files Into CCS

The downloaded software includes source files and a premade CCS project, which enables users to quickly start debugging, modifying, and rebuilding the code used by the design. When the software is successfully extracted into the CC3220S RTOS demos folder of the SimpleLink Wi-Fi SDK, the software can be directly imported into a CCS workspace by doing the following:

  1. Right-click in the Project Explorer.
  2. Select the Import → CCS Project option.
  3. Navigate to the wifi_doorlock folder in the SDK (<SDK Install Location>/simplelink_cc32xx_sdk_2_10_00_04/examples/rtos/CC3220S_LAUNCHXL/demos/wifi_doorlock).
  4. Select the Ok button.
  5. A project called wifi_doorlock_CC3220S_LAUNCHXL_tirtos_ccs appears in the Discovered Projects list of the Import window. Select the project and then press Finish.

When the project imports, it also imports a tirtos_build project for the CC3220S, if one does not already exist in the workspace.

Note:

For the wifi_doorlock project to build successfully, both the OTA library and the SimpleLink Wi-Fi host driver must be imported into the same workspace and successfully built first.

Prior to building the wifi_doorlock_CC3220S_LAUNCHXL_tirtos_ccs project, users must also import and build the OTA library and the SimpleLink Wi-Fi host driver library projects from the SDK. To import and build the OTA library, do the following:

  1. Right-click on the Project Explorer.
  2. Select the Import → CCS Project option.
  3. Navigate to the source/ti/net folder of the SDK.
  4. Select the Ok button.
  5. Select the ota library from the list of Discovered projects, then click Finish.

Before building the ota library, a couple of changes must be made to the project properties. The changes can be made by doing the following:

  1. Right-click on the ota project in the workspace and select Properties.
  2. Select Resource → Linked Resources from the list on the left-hand side of the CCS Project Properties window.
  3. Choose the Linked Resources tab.
  4. Edit all of the paths that appear as Invalid Locations, by replacing the PROJECT_LOC symbol in the path with ORIGINAL_PROJECT_ROOT.
  5. Select Build → Arm Compiler → Optimization from the list on the left-hand side of the CCS Project Properties window.
  6. Change the Optimization level to 2-Global Optimizations.
  7. Select Build → Arm Compiler → Advanced Options → Runtime Model Options.
  8. Enable the option to place each function in a separate subfunction (set to on).
  9. When all the changes are made, select Apply and then Close.

To import and build the SimpleLink Wi-Fi host-driver library, do the following:

  1. Right-click on the Project Explorer.
  2. Select the Import → CCS Project option.
  3. Navigate to the source/ti/drivers/net/wifi folder of the SDK.
  4. Select the Ok button.
  5. Select the simplelink project from the list of Discovered projects, then click Finish.
  6. Right-click on the simplelink project when it appears in the workspace.
  7. Select Build → Arm Compiler → Optimization from the list on the left-hand side of the CCS Project Properties window.
  8. Change the Optimization level to 4-Whole Program Optimizations.
  9. Select Build → Arm Compiler → Advanced Options → Runtime Model Options.
  10. Enable the option to place each function in a separate subfunction (set to on).
  11. Select Apply and then Close, to apply the change.

After making the changes to both the ota and simplelink project properties, the libraries can be rebuilt and then the wifi_doorlock_CC3220S_LAUNCHXL_tirtos_ccs project can be successfully built.

By default, the CCS application is configured without power management enabled, to let the debugger maintain a connection to the CC3220S while the wifi_doorlock application is running. Without the power policy enabled, the application can be debugged, as long as the necessary user files are first added to the CC3220 file system. Alternatively, the CCS project can be used to modify and rebuild the application, then replace the mcuimg.bin file in the provided UniFlash ImageCreator project. Section 3.1.2.2 describes how to add the necessary User Files when debugging the application using CCS.

The Wi-Fi doorlock software was created so that different key modules in the software can be disabled during development and evaluation. A set of defines at the top of the wifi_doorlock_app.h file control whether different modules are enabled or disabled. Specifically, it is often convenient to disable the provisioning process during development and instead use a statically defined set of AP credentials to connect to a test network. Setting both the APSC_PROVISIONING and BLE_PROVISIONING defines to (0) instead of (1) bypasses the provisioning process and uses statically defined network credentials located in wifi_doolock_app.h to connect the system to a network.

Note:

By default, the power manager is disabled in the CCS project, to let the system remain connected to the CCS IDE while debugging. Enable the power manager by adding USE_POWER_POLICY to the list of Predefined Symbols in the wifi_doorlock_CC3220S_LAUNCHXL_tirtos_ccs project.