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.

CC2652R: CC2652R: Integrationof the Sensor Controller into Project Zero, Trouble Halting Target CPU (Error -2062 @ 0x0) appears

Part Number: CC2652R


Hi,

I used the Project Zero example as a base for my project. The Sensor controller unit is supposed sample the sensor with 1 kHz. If it´s memory is full it hands over the buffer to the main CPU.

The sensor data should the be send out via bluetooth.

The integration of the sensor controller unit makes some problems.

I followed the intructions in :  http://software-dl.ti.com/lprf/simplelink_academy/modules/sc_01_project_from_scratch/sc_01_project_from_scratch.html#bonus-tasks-1-ndash-integrate-with-ble

static void ProjectZero_init(void)
{
   
    /***************** Initialize the SCIF Driver (added)**********/ //Marked for long term tests
        // Initialize the SCIF operating system abstraction layer
        scifOsalInit();
        scifOsalRegisterCtrlReadyCallback(scCtrlReadyCallback);
        scifOsalRegisterTaskAlertCallback(scTaskAlertCallback);

        // Initialize the SCIF driver
        scifInit(&scifDriverSetup);

        // Set the Sensor Controller task tick interval
        uint32_t N = 1000;  // 1kHz RTC --> Not sure about it!
        // Enable RTC ticks, with N Hz tick interval
        scifStartRtcTicksNow(0x00010000 / N);

        // Start the "ReadCap" Sensor Controller task: Sensor Controller starts to measure
        scifStartTasksNbl(1 << SCIF_READ_CAP_TASK_ID);
    /**********************************************************/
}

/****************************SCIF Driver Callback Functions (added)***********************************/// Marked for long term tests
  // SCIF driver callback: Task control interface ready (non-blocking task control operation completed)
static void scCtrlReadyCallback(void)
{
    // Notify application `Control READY` is active
    ProjectZero_enqueueMsg(APP_MSG_SC_CTRL_READY, NULL);
} // scCtrlReadyCallback
static void scTaskAlertCallback(void)
{
    // Notify application `Task ALERT` is active
    ProjectZero_enqueueMsg(APP_MSG_SC_TASK_ALERT, NULL);
} // scTaskAlertCallback
static void processTaskAlert(void)
{
    // Clear the ALERT interrupt source
    scifClearAlertIntSource();

    //... Access Sensor Controller task data structures here ... for whole array
    // For each available output buffer ...
    while (scifGetTaskIoStructAvailCount(SCIF_READ_CAP_TASK_ID,
                                         SCIF_STRUCT_OUTPUT) > 0)
    {
        SCIF_READ_CAP_OUTPUT_T* pOutput = scifGetTaskStruct(
        SCIF_READ_CAP_TASK_ID, SCIF_STRUCT_OUTPUT);

        for (int n = 0; n < SCIF_READ_CAP_BUFFER_SIZE; n++)
        {
            DATA_ARRAY[n] = pOutput->tdcBuffer[n];
            
        }

        //Hand the buffer back to the Sensor Controller
        scifHandoffTaskStruct(SCIF_READ_CAP_TASK_ID, SCIF_STRUCT_OUTPUT); 
    }

    // Acknowledge the ALERT event
    scifAckAlertEvents();
} // processTaskAlert


What is missing? Where could be the error?
I have no idea anymore what to test. I already tried a hardware and software interrupt, but it didn't solve the error.

  • Hi,

    We have a newer version of the SimpleLink Academy lab here: Can you follow these instructions and retry?

  • Hi,

    thanks for the hint, but there are no changes in the part which referes to the integration of the sensor controller. The only thing is that they use user_enqueueRawAppMsg() which does not exist in the Project Zero code. I had to exchange it by ProjectZero_enqueueMsg()

    Do you have any other ideas?

    I have already changed the base project once to simple_peripheral, but the same error appears.

     

  • Hi,

    I see. There has been some changes in Project Zerof r CC13x2/CC26x2 that we haven't updated. I will fix it for the next release. In the mean while, can you try the following:

    Import and Modify Project Zero

    First, import a fresh version of Project Zero. Import it to CCS from the SDK installation directory: <SDK>\examples\rtos\CC26X2R1_LAUNCHXL\ble5stack\project_zero.

    Do the following:

    • Copy and paste (you can drag and drop with the mouse in CCS) all 6 scif related code files from the empty project into the Application/ folder in Project Zero.

    • Open the project_zero.c file.

    • Add #include "scif.h" at the top.

    • Add PZ_SC_CTRL_READY and PZ_SC_TASK_ALERT in the application messages defines list.

      // Types of messages that can be sent to the user application task from other
      // tasks or interrupts. Note: Messages from BLE Stack are sent differently.
      #define PZ_SERVICE_WRITE_EVT     0  /* A characteristic value has been written     */
      #define PZ_SERVICE_CFG_EVT       1  /* A characteristic configuration has changed  */
      #define PZ_UPDATE_CHARVAL_EVT    2  /* Request from ourselves to update a value    */
      #define PZ_BUTTON_DEBOUNCED_EVT  3  /* A button has been debounced with new value  */
      #define PZ_PAIRSTATE_EVT         4  /* The pairing state is updated                */
      #define PZ_PASSCODE_EVT          5  /* A pass-code/PIN is requested during pairing */
      #define PZ_ADV_EVT               6  /* A subscribed advertisement activity         */
      #define PZ_START_ADV_EVT         7  /* Request advertisement start from task ctx   */
      #define PZ_SEND_PARAM_UPD_EVT    8  /* Request parameter update req be sent        */
      #define PZ_CONN_EVT              9  /* Connection Event End notice                 */
      #define PZ_READ_RPA_EVT         10  /* Read RPA event                              */
      #define PZ_SC_CTRL_READY        11  /* Sensor controller control ready             */
      #define PZ_SC_TASK_ALERT        12  /* Sensor controller task alert                */
      

      Add two sensor controller message defines.

    • Find the ledPinTable[] array. Comment out the CONFIG_PIN_GLED member. Remember that this is the LED that the SC task controls.

    • Add the following function declarations

      // Sensor Controller functions
      static void scCtrlReadyCallback(void);
      static void scTaskAlertCallback(void);
      static void processTaskAlert(void);
      

      Sensor Controller Function Declarations

    • Add the following functions

      static void scCtrlReadyCallback(void)
      {
        // Notify application `Control READY` is active
          ProjectZero_enqueueMsg(PZ_SC_CTRL_READY, 0);
      } // scCtrlReadyCallback
      
      static void scTaskAlertCallback(void)
      {
        // Notify application `Task ALERT` is active
          ProjectZero_enqueueMsg(PZ_SC_TASK_ALERT, 0);
      } // scTaskAlertCallback
      
      static void processTaskAlert(void)
      {
        // Clear the ALERT interrupt source
        scifClearAlertIntSource();
      
        // Get 'state.high', and set highStr to appropriate string
        uint16_t high = scifTaskData.adcLevelTrigger.state.high;
        char *highStr = (high != 0) ? "HIGH" : "LOW";
        // Set the highStr to the String characteristic in Data Service
        DataService_SetParameter(DS_STRING_ID, strlen(highStr), highStr);
      
        // Set/clear red LED.
        PIN_setOutputValue(ledPinHandle, CONFIG_PIN_RLED, high);
      
        // Acknowledge the ALERT event
        scifAckAlertEvents();
      } // processTaskAlert
      

      Sensor Controller Functions

    • Copy and paste the SC Driver initialization into ProjectZero_taskFxn().

    • In ProjectZero_processApplicationMessage(), add the following case in the switch statement:

      • Note that a case for PZ_SC_CTRL_READY is not added because it is not needed in this application.
      case PZ_SC_TASK_ALERT:
        processTaskAlert();
        break;
      

      Sensor Controller Switch Case

    • Build and debug the project. The first build may take a while.