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.

  • Resolved

CCS/CC1352P: ADCBuf SwiFxn issue

Prodigy 180 points

Replies: 17

Views: 410

Part Number: CC1352P

Tool/software: Code Composer Studio

Hi,

I'm using multiple ADC channels. one of them is used by the Sensor controller.

Randomly when using ADC measurement from both sides (MCU and SC, note:  HW semaphore is used to determine which is the current controller and work great), I get HW reset.

after investigation of this issue, I'm noticed that the function 'ADCBufCC26X2_swiFxn' in 'ADCBufCC26X2_open' randomly set the 'object->activeSamplebuffer' from normal address to 0XFFFFFFF and then we got assertion.

  • In reply to moshe genish:

    Hi M-W,

    I am Implemented reading of the return value of "ADCBufCC26X2_CMD_ACQUIRE_ADC_SEMAPHORE" call, and the HW Exception issue still occurred.

    ......
    // Control ADC Hardware semaphore to keep while converting //
    ADCBuf_control(gADCData.adcBuf, ADCBufCC26X2_CMD_KEEP_ADC_SEMAPHORE, NULL);
    status = ADCBuf_control(gADCData.adcBuf, ADCBufCC26X2_CMD_ACQUIRE_ADC_SEMAPHORE, NULL);

    if(status != 0)
    {
    // Convert failed
    status = 0;
    break;
    }

    ...

    the status always == 0. and the HW exception that I described still occurs.
  • In reply to moshe genish:

    Hi Moshe,

    If I remember correctly, you also use the "Peripheral Sharing" mechanism on the Sensor Controller Side right? Would it be possible for you to share the current ADCBuf driver you use so that I can look closer at it and try it out on my side to see if I can figure anything out.

     As for the Sensor Controller, are you in control of when it uses the ADC to the level where you know it is currently not trying to use it, or is it continuously trying to sample if it get the semaphore? 

    Best regards,

    M-W

    I'm currently out of office until January 2020, there will be no answers during this period. Please feel free to open a new thread using the "Ask a related question" if you feel that your see your thread with me has not been picked up by someone else.

  • In reply to M-W:

  • In reply to moshe genish:

    Hi M-W,

    A2D.c file and the Sensor Controller A2D implement picture are attached
  • In reply to moshe genish:

    Hi Moshe,

    I have tried to recreate the issue using the following example but without any luck:

    while(1) {
            // Do SCS reading
            scifResetTaskStructs(1 << SCIF_ADC_DATA_LOGGER_TASK_ID, 1 << SCIF_STRUCT_OUTPUT);
            uint32_t ret = scifExecuteTasksOnceNbl(1 << SCIF_ADC_DATA_LOGGER_TASK_ID);
            while(scifWaitOnNbl(0) != SCIF_SUCCESS);
    
            // Control ADC Hardware semaphore to keep while converting
            ADCBuf_Handle adcHandle = ADCBuf_open(CC1352R1_LAUNCHXL_ADCBUF0, &adcParams);
            ADCBuf_control(adcHandle, ADCBufCC26X2_CMD_KEEP_ADC_SEMAPHORE, NULL);
            ADCBuf_control(adcHandle, ADCBufCC26X2_CMD_ACQUIRE_ADC_SEMAPHORE, NULL);
    
            // Configure the conversion structure
            conv.arg = NULL;
            conv.adcChannel = CC1352R1_LAUNCHXL_ADCBUF0CHANNEL6;
            conv.sampleBuffer = buffer;
            conv.sampleBufferTwo = NULL;
            conv.samplesRequestedCount = 20;
    
            // Do the conversion
            uint32_t status = ADCBuf_convert(adcHandle, &conv, 1);
            if (status != ADCBuf_STATUS_SUCCESS) {
                while(1){};
            }
    
            // Control ADC Hardware semaphore release  //
            ADCBuf_control(adcHandle, ADCBufCC26X2_CMD_KEEP_ADC_SEMAPHORE_DISABLE, NULL);
            ADCBuf_close(adcHandle);
            /* Release the ADC semaphore */
            AUXSMPHRelease(AUX_SMPH_2);
            sleep(1);
        }

    Could you possibly share your version of the driver and/or a small example project which shows the issue that I can run?

    Best regards,

    M-W

    I'm currently out of office until January 2020, there will be no answers during this period. Please feel free to open a new thread using the "Ask a related question" if you feel that your see your thread with me has not been picked up by someone else.

  • In reply to M-W:

    Hi Moshe,

    This seems to be related to the fact that you do not own the semaphore prior to opening the ADCBuf driver. A workaround for this is to perform a small hack when opening the driver:

    // Acquire semaphore
    AUXSMPHAcquire(AUX_SMPH_2);
    ADCBuf_Handle adcHandle = ADCBuf_open(CC1352R1_LAUNCHXL_ADCBUF0, &adcParams);
    // Control ADC Hardware semaphore to keep while converting
    ADCBuf_control(adcHandle, ADCBufCC26X2_CMD_KEEP_ADC_SEMAPHORE, NULL);
    // Manually set the semaphore to be in possession of the driver
    ((ADCBufCC26X2_Object *) adcHandle->object)->adcSemaphoreInPossession = true;
    

    Best regards,

    M-W

    I'm currently out of office until January 2020, there will be no answers during this period. Please feel free to open a new thread using the "Ask a related question" if you feel that your see your thread with me has not been picked up by someone else.

  • In reply to M-W:

    Hi M-W,

    after some tests, it seems that this workaround solves this issue.
    Thanks.

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.