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.

SIMPLELINK-CC2640R2-SDK: 2.40: Not able to open ADC Channel 0 and 1 at Simple Peripheral

Part Number: SIMPLELINK-CC2640R2-SDK

Hi,

I tested the adc single channel example program with my analog sensors and it works. I re-use the code and try to make it work at Simple Peripheral.

void ADC_Read(void)
{
    uint16_t     i;
    ADC_Handle   adc;
    ADC_Params   params;
    int_fast16_t res;
    uint16_t pressureValues[ADC_SAMPLE_COUNT];
    uint16_t pressureValue = 0;


    ADC_Params_init(&params);
    adc = ADC_open(Board_ADC0, &params);

    if (adc == NULL)
    {

        while (1);
    }

    for (i = 0; i < ADC_SAMPLE_COUNT; i++)
    {
        res = ADC_convert(adc, &pressureValues[i]);

        if (res == ADC_STATUS_SUCCESS)
        {
            pressureValue += pressureValues[i];

        }
        else
        {
            while(1);
        }
    }

    pressureValue >>= 3;

    ADC_close(adc);
}

I call ADC_Read() at SimplePeripheral_init(). When I debug step the code, the return of ADC_open() is NULL and goes to while(1). Why does that happen? adc single channel example program and Simple Peripheral example program have same board files so should work.

-kel