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.

RM44L520: ADC ID always set to 0.

Part Number: RM44L520
Other Parts Discussed in Thread: HALCOGEN

Hello all, 

I have been having a bit of trouble getting the Pin ID from the ADC pointer. Right now I am using ADC1 Group 1 and have Pin 6 and Pin 3 enabled. I then use the following function to assign both ADC capture values to local variables: 

int value1 = 0;
int value2 = 0;
adcData_t adc1_data; //ADC Data Structure
adcData_t *adc1_data_ptr = &adc1_data; //ADC Data Pointer

adcStartConversion(adcREG1, adcGROUP1); //Start ADC conversion
while(!adcIsConversionComplete(adcREG1, adcGROUP1)); //Wait for ADC conversion
adcStopConversion(adcREG1, adcGROUP1);

adcGetData(adcREG1, 1U, adc1_data_ptr); //Store conversion into ADC pointer
value1 = (unsigned int)adc1_data_ptr -> value; //Store measured value locally

adcGetData(adcREG1, 1U, adc1_data_ptr); //Store conversion into ADC pointer
value2 = (unsigned int)adc1_data_ptr -> value; //Store measured value locally

The issue I have been having is the ID for both captures seems to always be 0. I'm not sure if there is some extra step in the ADC capture process that I am missing but any help would be greatly appreciated. 

Thank you in advance for your help. 

  • I now realize that the ID was not included because I did not check the Enable Channel ID in Conversion Results box in Halcogen. Unfortunately, It now seems like only one of the ADC conversions is being performed each time. Based on the documentation, I would expect that calling the adcGetData function would update the adc1_data_ptr with the second ADC capture values but it doesn't seem to be doing this. Does anyone know why this may be happening? 

  • I see what my issue is now. The adcGetData function pulls all queued adc and Id values which can then be stored locally. The adcGetData function only needs to be called once.