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.

CC2541: Getting ADC converter going

Part Number: CC2541

Adding ADC function to an existing product that uses  CC2541.  Having a tough go getting the ADC going on P0_7

Confirmed that the output of a differential opamp is putting just over 2 VDC  on P0_7  (pin 12)

Have tried to distill down to the simplest form but haven't gotten it running yet.

Probably missing something.  Have played with it for a while and read as much as I could find here.

Any assistance appreciated.

This code runs very early on boot up: 

P0DIR = 0x00;

P1DIR = 0x00;

P2DIR = 0x00;

P0INP = 0x00;

P1INP = 0x00;

P2INP = 0x00;

P0SEL = 0x80; // P0_7 is A/D

P1SEL = 0x00;

P2SEL = 0x00;

APCFG = 0x80;

HalAdcInit();

HalAdcSetReference(HAL_ADC_REF_AVDD);

uint16 reading = HalAdcRead(HAL_ADC_CHANNEL_7, HAL_ADC_RESOLUTION_12);

printf("Reading = %d \r\n", reading);