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.

CCS/CC2640R2F: Cannot read output of Sensor Controller in Code Composer

Part Number: CC2640R2F

Tool/software: Code Composer Studio

Hi,

I have implemented and tested an SPI interface to an accelerometer (ADXL362) in SCS and it works fine.  The initialization code sets up the ADXL and starts it running.  The execution code reads the FIFO buffer from the ADXL and stores it in the output variable I created called  fifo which is a 150 element array of unsigned ints. 

16 bit unsigned output.fifo[150]

In the task iteration action sequence I wait for 1 second and then read and store the fifo from the ADXL into the output.fifo array (not using multi buffered outputs).  I run the initialization code and then continuously run the task sequence and can observe the output changing as I expect it to.  So far, so good.

I generate source code and compile it into my Code Composer Studio project.  There I set up the SCS as follows:

// Initialize the Sensor Controller
scifOsalInit();
RES = scifInit(&scifAdxDriverSetup);

// Start Sensor Controller task
RES2 = scifWaitOnNbl(500000);
RES3 = scifStopTasksNbl(BV(SCIF_ADX_ADXL362_TASK_ID));
RES4 = scifWaitOnNbl(500000);

scifOsalRegisterCtrlReadyCallback(scCtrlReadyCallback);
scifOsalRegisterTaskAlertCallback(scTaskAlertCallback);

RES5 = scifStartTasksNbl(BV(SCIF_ADX_ADXL362_TASK_ID));  // Run SCS initialization code

and then wait in a while loop on a sempahore.  Once the initialization code has completed, I receive the expected READY notification, and start a utility clock which launches the SCS execution code once every second using:

RES6 = scifSwTriggerExecutionCodeNbl(BV(SCIF_ADX_ADXL362_TASK_ID));

At the completion of the execution code, I raise an alert:

fwGenAlertInterrupt();

which is successfully captured in the AlertCallback, which posts a semaphore to the main thread, which attempts to read the output.fifo[] from the SCS output structure into a local array.  Here is where the problem lies.  All reads from output.fifo[] return 0XFFFF.  I am pretty sure I am getting the correct address for the fifo using this:

uint16_t *buf = scifAdxTaskData.adxl362.output.fifo;

I am really stumped here and would appreciate any and all help.

Thanks!

  • Hello Peter,
    The addressing appears to be correct, but how do you read the data and how to you control the FIFO index?
    How do you implement the subsequent calls to scifSwTriggerExecutionCodeNbl?

    I would perhaps enable some GPIO toggling in the sensor controller code and observe the signals with a logic analyzer to verify that the tasks run as expected.

    You should search for all comments for the "READY event" in scif_framework.c so that you are aware of the different expected behavior for this event. For example the READY event is generated when the tasks have been started (not completed) after the call to scifStartTasksNbl. Also the READY event does not generate MCU domain and System CPU wake-up.
  • Hi Eirik,

    I am using the LaunchPad  CC2640R2 for this development.  I have instrumented the execution code in SC to toggle between the red & green leds each time it is run, and I observe that happening on the expected 1 second interval when I run it from CCS.

    I have changed the CCS so that I no longer rely on any READY signals, just one ALERT which is triggered after the completion of the execution run.  It is caught correctly in the CCS code and uses a semaphore to wake up the main task.  This simply copies the output from the AUX RAM into a local buffer.  I have inserted a couple of Display_print lines to observe the AUX RAM and local buffer and they both hold the same incorrect values.

    Thanks for your help,

    Peter

  • 1. Verify the data traffic over SPI with a logic analyzer when you run the application generated from CCS (TI-RTOS+SC Driver). This is to check that the IO lines are configured correctly and that no IO configuration from TI-RTOS overrides the sensor controller IO config.
    2. You can also observe the sensor controller data in memory debug and set up data watchpoints for the task data region:
    in scif.h:
    #define scifTaskData (*((volatile SCIF_TASK_DATA_T*) 0x400E00EA))
  • Hi Eirik,

    It was a problem with the TI_RTOS IO configuration overriding the SC config.  It's working correctly now.

    Many Thanks,

    Peter