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.

How to use comparator in Sensor Controller for cc26xx

Other Parts Discussed in Thread: CC2650

Hello Everyone,

I am working on CC2650 launchpad. Analog sensor connected to analog pin of cc2650.

I wants to use comparator of sensor controller as a interrupt. When analog input goes high and comparator trigger the cpu (cpu is in sleep mode). So CPU will wakeup from sleep mode.

How can I use comparator in sensor controller studio so I can configure analog input and get trigger?

Any help will be very great full.

Thanks,

Raj

  • Hi,

    We have simplelink academy talking about sensor controller studio and training. I believe you can benefit lots from it.

    Please find the link for simplelink academy : software-dl.ti.com/.../overview.html

    software-dl.ti.com/.../sc_01_project_from_scratch.html

    Also there is already out of box ADC project comes with sensor controller studio, you can take a look at it and modify from there.
  • Thanks for reply.

    I am using ADC window monitor sensor controller example code for generate ADC pin interrupt when pin voltage goes high from threshold.

    Now I can successfully integrate sensor controller driver with simpleBLEPeripheral example code and it's working fine.

    When gpio voltage goes high scTaskAlertCallback() callback called.

    When I call i2c related function from scTaskAlertCallback(), sensor controller task get stuck.

    Below is my code:

    void scTaskAlertCallback(void) {

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

    // Calling i2c function like i2c_transfer(..)  --> sensor controller task get stuck

    } // scTaskAlertCallback

    void taskFxn(UArg a0, UArg a1) {
    PIN_Handle hLedPins;

    // Enable LED pins
    hLedPins = PIN_open(&ledPinState, pLedPinTable);

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

    // Configure and start the Sensor Controller's ADC window monitor task (not to be confused with OS tasks)
    scifTaskData.adcWindowMonitor.cfg.adcWindowHigh = 800;
    scifStartTasksNbl(BV(SCIF_ADC_WINDOW_MONITOR_TASK_ID));

    // Main loop
    while (1) {

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

    // Clear the ALERT interrupt source
    scifClearAlertIntSource();

    // Acknowledge the alert event
    scifAckAlertEvents();
    }

    } // taskFxn

    Do you know why sensor controller task get stuck after calling i2c related API.

    Thanks.

    Raj

  • Did you initialize I2C first? If yes, can you post code snippet?
  • Hello Christin

    Yes I initialize i2c.

    Let's assume,

    i2cFxn(){

    .....

    ......

    }

    When I call i2cFxn() from simpleBLEPeripheral task its working fine. and when I call i2cFxn() from sensor controller task it's not working.

    As per my thought, May be problem in task switching from sensor controller to M3 Application (simpleBLEPeripheral task).

    Please help me if you can help me on this scenario.

    Thanks

    Raj