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

Software Architecture

The software provided for the TIDC-01005 is a multithreaded application based on the SimpleLink CC3220 SDK, SimpleLink SDK BLE Plugin, and the Sensor and Actuator Plugin. The TIDC-01005 software uses TI-RTOS to support multithreading and TI-Drivers as the primary interface for managing hardware peripherals (for example, communications peripherals, timers, and digital I/Os). Figure 2-3 shows an overall block diagram for the software.

GUID-73943870-271E-4AD4-B48B-083689B722B9-low.gifFigure 2-3 Wi-Fi, Door-Lock Software Block Diagram

The software for the TIDC-01005 demonstrates multiple features that are supported in a Wi-Fi, electronic, smart-lock design including controlling a motor driver to actuate a lock, reading sensor data, managing a Wi-Fi connection (including provisioning), sending and receiving messages through the cloud, and performing OTA software updates. Each of these features are handled by different software modules in the application, and each module consists of one or more TI-RTOS tasks. In addition to tasks dedicated for each feature, the software includes an overall Wi-Fi door-lock module that is responsible for spawning all other threads and a control module that handles system-level requests such as resets. Dividing the software into separate modules and dedicating independent tasks to each feature helps make the design more modular, so it can be easily modified for different applications.

Table 2-2 lists a description of each software module and the associated source files.

Table 2-2 Wi-Fi Door-Lock Software Modules
MODULESOURCE FILESDESCRIPTION
Wi-Fi Door Lock Application Modulewifi_doorlock_app.h/.cStarts Wi-Fi door-lock application by initializing system and spawning threads
Control Modulecontrol_task.h/.cHandles system-level requests such as system resets
Wi-Fi Connection Managementnetwork_if.h/.cConnects CC3220 to an AP based on profiles, or handles events to start provisioning
Wi-Fi Provisioningprovisioning_task.h/.cStarts or stops provisioning process and executes state machine to handle provisioning events
MQTT Clientmqtt_client_task.h/.c and mqtt_client_cbs.h/.cRuns MQTT client, receives incoming MQTT messages, publishes MQTT messages to signal device state, and triggers events based on MQTT messages
Wi-Fi OTAcloud_ota_task.h/.cRuns OTA state machine
Motor Controlmotor_driver_if.h/.cDrives motor based on MQTT messages received from the cloud
Sensorbmi160_support.h/.cConfigures and reads sensor data from IMU when enabled

Figure 2-4 shows the overall software flow used to initialize the system and spawn all of the software tasks. The details of each of the spawned tasks are described in the following sections.

GUID-BF3C1685-DC24-40E0-B20B-E36A931F719A-low.gifFigure 2-4 Overall Software Flow Diagram