SWRA578B October   2017  – April 2020 CC1312PSIP , CC1312R , CC1314R10 , CC1352P , CC1352P7 , CC1352R , CC2620 , CC2630 , CC2640 , CC2640R2F-Q1 , CC2642R , CC2642R-Q1 , CC2650MODA , CC2652P , CC2652R , CC2652R7 , CC2652RB , CC2652RSIP

 

  1.   Ultra-Low Power Sensing Applications With CC13x2/CC26x2
    1.     Trademarks
    2. 1 Overview
    3. 2 Measurement Conditions
      1. 2.1 Software
      2. 2.2 Hardware
    4. 3 Measurements
      1. 3.1 BOOSTXL-ULPSENSE
        1. 3.1.1 Analog Light Sensor
        2. 3.1.2 Capacitive Touch
        3. 3.1.3 LC Flow Meter
        4. 3.1.4 Potentiometer
        5. 3.1.5 Reed Switch
        6. 3.1.6 SPI Accelerometer
      2. 3.2 LPSTK-CC1352R
        1. 3.2.1 I2C Light Sensor
        2. 3.2.2 I2C Temperature and Humidity Sensor
        3. 3.2.3 SPI Accelerometer
        4. 3.2.4 Hall Effect Sensor
      3. 3.3 Comparison with System CPU
        1. 3.3.1 4 MHz SPI Transfer
        2. 3.3.2 1 MHz SPI Transfer
        3. 3.3.3 Wake-up and Sleep
    5. 4 Summary
    6. 5 References
  2.   A Creating the comparison examples
    1.     A.1 SPI Transfer – Sensor Controller
    2.     A.2 SPI Transfer – System CPU
    3.     A.3 Wake Up and Sleep – Sensor Controller
    4.     A.4 Wake up and Sleep – System CPU
  3.   Revision History

SPI Transfer – System CPU

The SPI transfer example is created in the following way:

  1. Open a spimaster_CCXXX2X1_LAUNCHXL_tirtos_ccs project in CCS, for example spimaster_CC1312R1_LAUNCHXL_tirtos_ccs.
  2. Replace the spimaster.c with the following code:
  3. #include <string.h> /* Driver Header files */ #include <ti/drivers/GPIO.h> #include <ti/drivers/SPI.h> #include <ti/sysbios/knl/Task.h> #include <ti/sysbios/knl/Clock.h> #include <ti/sysbios/knl/Semaphore.h> #include <ti/sysbios/BIOS.h> /* Driver configuration */ #include "ti_drivers_config.h" #define WAKEUPFREQUENCY 100 #define SPI_MSG_LENGTH (18) #define MASTER_MSG ("Texas Instruments!") unsigned char masterTxBuffer[SPI_MSG_LENGTH]; Semaphore_Struct semLedTask; Semaphore_Params semParams; void spiCallback(SPI_Handle spiHandle, SPI_Transaction *transaction); SPI_Handle spiHandle; SPI_Params spiParams; SPI_Transaction transaction; /* ======== mainThread ======== */ void *mainThread(void *arg0) { SPI_init(); SPI_Params_init(&spiParams); spiParams.bitRate = 1000000; spiParams.transferMode = SPI_MODE_CALLBACK; spiParams.transferCallbackFxn = spiCallback; strncpy((char *) masterTxBuffer, MASTER_MSG, SPI_MSG_LENGTH); transaction.count = SPI_MSG_LENGTH; transaction.txBuf = (void *) masterTxBuffer; // Create the semaphore used to wait for Sensor Controller ALERT events Semaphore_Params_init(&semParams); semParams.mode = Semaphore_Mode_BINARY; Semaphore_construct(&semLedTask, 0, &semParams); while(1){ spiHandle = SPI_open(CONFIG_SPI_MASTER, &spiParams); SPI_transfer(spiHandle, &transaction); Semaphore_pend(Semaphore_handle(&semLedTask), BIOS_WAIT_FOREVER); SPI_close(spiHandle); Task_sleep((1000000/WAKEUPFREQUENCY) / Clock_tickPeriod); } } void spiCallback(SPI_Handle spiHandle, SPI_Transaction *transactions){ Semaphore_post(Semaphore_handle(&semLedTask)); }
  4. Open spimaster.syscfg.
  5. In the SPI driver, under the “Use Hardware” configurable, select “None”.
  6. In the PinMux configurable in the SPI driver, select pin DIO25, DIO26 and DIO27 for SCLK, MISO and MOSI, respectively, to make sure the SPI does not interface with the external flash on the Launchpad.
  7. In the GPIO driver, remove all defined pins to make sure no pins are left floating.