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.

Hercules TMS570LC43 ADC1 Group1 interrupt data collection problem

Other Parts Discussed in Thread: HALCOGEN

Dear community,

right now iam trying to solve my following problem with ADC1 Group1 conversion. Look at enclosed snippets with configuration from Halcogen for better understanding my situacion.

I want to use ADC1 Group1 channels 0, 1, 2, 3, 4, 9. I want software trigger and i want interrupt to notify when whole group is converted and ready to be read from buffer. I also want channel ID information. 

in my main i call all necesarry functions to set it up (i believe):

adcInit();
adcEnableNotification(adcREG1, adcGROUP1);

_enable_interrupt_();

adcStartConversion(adcREG1, adcGROUP1);

In HL_adc.c i use extern variable to notify main loop that conversion is ready

void adc1Group1Interrupt(void)
{
/* USER CODE BEGIN (39) */
ADC_ready1 = true;
/* USER CODE END */

adcREG1->GxINTFLG[1U] = 9U;

adcNotification(adcREG1, adcGROUP1);

/* USER CODE BEGIN (40) */
/* USER CODE END */
}

And in main i have following: (adc_data1 is array - adcData_t adc_data1[8];)

if(ADC_ready1)
{
uint16 ch_count = 0;
ADC_ready1 = false;
ch_count = adcGetData(adcREG1, adcGROUP1,&adc_data1[0]);
}

so when i start debugging and stop program right after adcGetData function call i look at adc_data1 array and see that there is only one valid value from channel 9 (that is internally connected to ambient light sensor). Other cannels doesnt have even channel ID filled. I would understand, that value of conversion for other channels is 0, because those are floating "in the air", so there could occur unpredictible values, but at least i would expect other channels to have id information filled ... 

Even if i look at returned value from adcGetData function, i see it returned value "1" that means only one channel converted? 

so what is going on here? How does this multiple channel conversion with interrupt notification works?

Thanks for any suggestions

regards
Jan, Technical support 
Honeywell Aerospace



  • I tried what you described above, but did not have the same results. ch_count was set to 6, and I can see the ID's and results in both the ADC1 ram and in the array adc_data1:

  • Hi Bob!

    Thanks for your effort! Truth is, that my code is little bit more complex then i have describer, for example i am using both ADC1 and ADC2 modules with multiple channels being converted, but as each of those ADC modules have its own buffer, i dont think it could influence each other.

    I am really wondering why i am not getting the same results as you do...

    Thanks
    Jan

  • So i have tried to make separate project just with ADCs and so far it is working! I will continue tracking where is the problem and report here. I am probably missing something ... 

  • Ok i have found the problem. It was really trivial and stupid mystake - i was giving both adcGetData function calls the same parameter adcREG1 and somehow it led to described strange behavior.

    if(ADC_ready1)
    {
    uint16 ch_count = 0;
    ADC_ready1 = false;
    ch_count = adcGetData(adcREG1, adcGROUP1,&adc_data1[0]);
    sciSend(sciREG1,5, "ADC1:");
    PrintADC(adc_data1);
    }

    if(ADC_ready2)
    {
    uint16 ch_count = 0;
    ADC_ready2 = false;
    ch_count = adcGetData(adcREG1, adcGROUP1,&adc_data2[0]);
    sciSend(sciREG1,5, "ADC2:");
    PrintADC(adc_data2);
    }

    Anyway, thanks Bob for your time!
    Jan