AnsweredAssumed Answered

Problem when triggering both ADC0 and ADC1 in ADuCM360

Question asked by Absel on Jan 9, 2018
Latest reply on Jan 12, 2018 by barryzhang

Hello.

 

I'm using this code in order to initialize both ADC:

 

ADC1INIT();   // Setup ADC1
ADC0INIT();    // Setup ADC0   

 

being these functions:

 

void ADC1INIT(void)
{
     
     AdcGo(pADI_ADC1,ADCMDE_ADCMD_IDLE);     // Place ADC1 in Idle mode
   AdcMski(pADI_ADC1,ADCMSKI_RDY,1);              // Enable ADC ready interrupt source      
   AdcFlt(pADI_ADC1,0,0,FLT_NORMAL|ADCFLT_NOTCH2|ADCFLT_SINC4EN); // ADC filter set formax update rate
   AdcRng(pADI_ADC1,ADCCON_ADCREF_AVDDREF,ADCMDE_PGA_G1,ADCCON_ADCCODE_UINT); // reference selected, Gain of 1, truncate negative results to 0  Signed integer output
   // Turn off input buffers to ADC and external reference  
   AdcBuf(pADI_ADC1,ADCCFG_EXTBUF_OFF,ADCCON_BUFBYPN|ADCCON_BUFBYPP|ADCCON_BUFPOWP|ADCCON_BUFPOWN);
     //AdcBuf(pADI_ADC1,ADCCFG_EXTBUF_VREFPN,ADC_BUF_ON);     //Buffered mode -> Less voltage range, same delay L-Z
   AdcPin(pADI_ADC1,ADCCON_ADCCN_AGND,ADCCON_ADCCP_AIN1); // Select AIN1 as postive input and AGND as negative input
   AdcGo(pADI_ADC1,ADCMDE_ADCMD_CONT);            // Start ADC1 for continuous conversions
   NVIC_EnableIRQ(ADC1_IRQn); //Enable ADC Interrupt sources
 
}
void ADC0INIT(void)
{
     
   AdcGo(pADI_ADC0,ADCMDE_ADCMD_IDLE);     // Place ADC1 in Idle mode
   AdcMski(pADI_ADC0,ADCMSKI_RDY,1);              // Enable ADC ready interrupt source      
   AdcFlt(pADI_ADC0,0,0,FLT_NORMAL|ADCFLT_NOTCH2|ADCFLT_SINC4EN); // ADC filter set formax update rate
   AdcRng(pADI_ADC0,ADCCON_ADCREF_AVDDREF,ADCMDE_PGA_G1,ADCCON_ADCCODE_UINT); // reference selected, Gain of 1, truncate negative results to 0  Signed integer output
   // Turn off input buffers to ADC and external reference  
   AdcBuf(pADI_ADC0,ADCCFG_EXTBUF_OFF,ADCCON_BUFBYPN|ADCCON_BUFBYPP|ADCCON_BUFPOWP|ADCCON_BUFPOWN);
     //AdcBuf(pADI_ADC0,ADCCFG_EXTBUF_VREFPN,ADC_BUF_ON);     //Buffered mode -> Less voltage range, same delay L-Z
   AdcPin(pADI_ADC0,ADCCON_ADCCN_AGND,ADCCON_ADCCP_AIN1); // Select AIN1 as postive input and AGND as negative input
   AdcGo(pADI_ADC0,ADCMDE_ADCMD_CONT);            // Start ADC1 for continuous conversions
   NVIC_EnableIRQ(ADC0_IRQn); //Enable ADC Interrupt sources
 
}

 

I'm having problems with the initialization of both ADC. If I only initialize ADC1, everything in my system goes fine, but when activating ADC0 it stops working properly and the measures of ADC1 get corrupted.

 

I would also like the triggering of the ADC to be syncronous. Any idea? I've read something about setting ADCCFG.15=1 but that doesn't work in my code, how do I have to code it?

 

Thank you in advance, I really need this help.

Outcomes