This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2642R: COMPA Sensor Controller Studio x SCIF Framework

Part Number: CC2642R


Hi,

I created a project in SCS to use the COMPA and COMPA event trigger. To do that a linked the COMPA to the DIO30. DIO30 is an ADC powered with 3.3V. My trigger is set to occurs when the DIO30 falling edge. Everything works fine in SCS. I can see the event and the compaValue that changes.

But when I created a project in CCS (To do this I used the empty project in the skd drivers folder) and included the scif framework generate by the SCS, the compaValue starts with 0 (it should starts with 1 as we can see in the SCS) and I can't see the event happen.

When I look the DIO30 input, the value read is 0:

 

This is my code for the version sdk 3.40:

#include "ex_include_tirtos.h"
#include "scif.h"


#define BV(n)               (1 << (n))


// Display error message if the SCIF driver has been generated with incorrect operating system setting
#if !(defined(SCIF_OSAL_TIRTOS_H) || defined(SCIF_OSAL_TIDPL_H))
    #error "SCIF driver has incorrect operating system configuration for this example. Please change to 'TI-RTOS' or 'TI Driver Porting Layer' in the Sensor Controller Studio project panel and re-generate the driver."
#endif

// Display error message if the SCIF driver has been generated with incorrect target chip package
#ifndef SCIF_TARGET_CHIP_PACKAGE_QFN48_7X7_RGZ
    #error "SCIF driver has incorrect target chip package configuration for this example. Please change to 'QFN48 7x7 RGZ' in the Sensor Controller Studio project panel and re-generate the driver."
#endif


// Task data
Task_Struct myTask;
Char myTaskStack[1024];


// Semaphore used to wait for Sensor Controller task ALERT event
static Semaphore_Struct semScTaskAlert;
volatile uint16_t before_state;
volatile uint16_t after_state;

/*OPEN_CNT  | PIN_INPUT_EN  | PIN_PULLDOWN | PIN_HYSTERESIS,CLOSE_CNT | PIN_INPUT_EN  | PIN_PULLDOWN | PIN_HYSTERESIS,*/
const PIN_Config pwr_fail_PinTable[] = {
                                   IOID_20  | PIN_INPUT_EN | PIN_GPIO_LOW | PIN_DRVSTR_MAX,
                                   PIN_TERMINATE
                                  };
PIN_State  pwr_fail_PinState;

void scCtrlReadyCallback(void) {

} // scCtrlReadyCallback




void scTaskAlertCallback(void) {

    // Wake up the OS task
    Semaphore_post(Semaphore_handle(&semScTaskAlert));

} // scTaskAlertCallback


void taskFxn(UArg a0, UArg a1) {

    PIN_Handle pwr_fail_PinHandle;
    pwr_fail_PinHandle = PIN_open(&pwr_fail_PinState, pwr_fail_PinTable);


    // Initialize the Sensor Controller
    scifOsalInit();
    scifOsalRegisterCtrlReadyCallback(scCtrlReadyCallback);
    scifOsalRegisterTaskAlertCallback(scTaskAlertCallback);
    scifInit(&scifDriverSetup);

    before_state = scifTaskData.compaTask.output.compaValue;

    scifStartTasksNbl(BV(SCIF_COMPA_TASK_TASK_ID));

    // Main loop
    while (1) {

        PIN_setOutputValue(pwr_fail_PinHandle, IOID_20, 0);

        // Wait for an ALERT callback
        Semaphore_pend(Semaphore_handle(&semScTaskAlert), BIOS_WAIT_FOREVER);

        // Clear the ALERT interrupt source
        scifClearAlertIntSource();

        PIN_setOutputValue(pwr_fail_PinHandle, IOID_20, 1);
        after_state = scifTaskData.compaTask.output.compaValue;

        // Acknowledge the alert event
        scifAckAlertEvents();
    }

} // taskFxn




int main(void) {
    Task_Params taskParams;

    // Initialize the board
    Board_initGeneral();
#ifdef Board_shutDownExtFlash
    Board_shutDownExtFlash();
#endif

    // Configure the OS task
    Task_Params_init(&taskParams);
    taskParams.stack = myTaskStack;
    taskParams.stackSize = sizeof(myTaskStack);
    taskParams.priority = 3;
    Task_construct(&myTask, taskFxn, &taskParams, NULL);

    // Create the semaphore used to wait for Sensor Controller ALERT events
    Semaphore_Params semParams;
    Semaphore_Params_init(&semParams);
    semParams.mode = Semaphore_Mode_BINARY;
    Semaphore_construct(&semScTaskAlert, 0, &semParams);

    // Start TI-RTOS
    BIOS_start();
    return 0;

} // main

And for the sdk 6.10:

#include "ex_include_tirtos.h"
#include "scif.h"


#define BV(n)               (1 << (n))


// Display error message if the SCIF driver has been generated with incorrect operating system setting
#if !(defined(SCIF_OSAL_TIRTOS_H) || defined(SCIF_OSAL_TIDPL_H))
    #error "SCIF driver has incorrect operating system configuration for this example. Please change to 'TI-RTOS' or 'TI Driver Porting Layer' in the Sensor Controller Studio project panel and re-generate the driver."
#endif

// Display error message if the SCIF driver has been generated with incorrect target chip package
#ifndef SCIF_TARGET_CHIP_PACKAGE_QFN48_7X7_RGZ
    #error "SCIF driver has incorrect target chip package configuration for this example. Please change to 'QFN48 7x7 RGZ' in the Sensor Controller Studio project panel and re-generate the driver."
#endif


// Task data
Task_Struct myTask;
Char myTaskStack[1024];


// Semaphore used to wait for Sensor Controller task ALERT event
static Semaphore_Struct semScTaskAlert;
volatile uint16_t before_state;
volatile uint16_t after_state;

void scCtrlReadyCallback(void) {

} // scCtrlReadyCallback




void scTaskAlertCallback(void) {

    // Wake up the OS task
    Semaphore_post(Semaphore_handle(&semScTaskAlert));

} // scTaskAlertCallback


void taskFxn(UArg a0, UArg a1) {

    //Power fail: config DIO20 as output
    GPIO_setConfig(CONFIG_GPIO_20, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);

    // Initialize the Sensor Controller
    scifOsalInit();
    scifOsalRegisterCtrlReadyCallback(scCtrlReadyCallback);
    scifOsalRegisterTaskAlertCallback(scTaskAlertCallback);
    scifInit(&scifDriverSetup);

    before_state = scifTaskData.compaTask.output.compaValue;

    scifStartTasksNbl(BV(SCIF_COMPA_TASK_TASK_ID));

    // Main loop
    while (1) {
        //Power fail: clean DIO20
        GPIO_write(CONFIG_GPIO_20, 0);

        // Wait for an ALERT callback
        Semaphore_pend(Semaphore_handle(&semScTaskAlert), BIOS_WAIT_FOREVER);

        // Clear the ALERT interrupt source
        scifClearAlertIntSource();

        //Power fail: set DIO20
        GPIO_write(CONFIG_GPIO_20, 1);
        after_state = scifTaskData.compaTask.output.compaValue;

        // Acknowledge the alert event
        scifAckAlertEvents();
    }

} // taskFxn




int main(void) {
    Task_Params taskParams;

    // Initialize the board
    Board_initGeneral();
#ifdef Board_shutDownExtFlash
    Board_shutDownExtFlash();
#endif

    // Configure the OS task
    Task_Params_init(&taskParams);
    taskParams.stack = myTaskStack;
    taskParams.stackSize = sizeof(myTaskStack);
    taskParams.priority = 3;
    Task_construct(&myTask, taskFxn, &taskParams, NULL);

    // Create the semaphore used to wait for Sensor Controller ALERT events
    Semaphore_Params semParams;
    Semaphore_Params_init(&semParams);
    semParams.mode = Semaphore_Mode_BINARY;
    Semaphore_construct(&semScTaskAlert, 0, &semParams);

    // Start TI-RTOS
    BIOS_start();
    return 0;

} // main

I tried to generate the code with the Sensor Controller Studio: Version 2.6.0.132 (simplelink_cc13x2_26x2_sdk_3_40_00_02) and 2.9.0.208 (simplelink_cc13xx_cc26xx_sdk_6_10_00_29).

Code Composer Studio Version is 11.1.0.00011.

Thanks in advance,

Cristiane Bellenzier Piaia