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!