ADC EOSI Delay not as expected (MC56F82726)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ADC EOSI Delay not as expected (MC56F82726)

Jump to solution
1,485 Views
admin
Specialist II

Hi All,

 

I trigger my ADC with PWM-Trigger and sample 4 samples (ANA0,ANA3,ANB0,ANB3) in parallel mode, but the EndOfScanInterrupt occurs to late (3.2us instead of 1.8us)

- Clock divider is correct (50MHz / 5 = 10MHz)          => ADC_CTRL2[DIV] = 5;

- No Automatic Standby or Power Down enabled      => ADC_PWR[ASB] = 0; ADC_PWR[APD] = 0;

 

It looks like the ADC need to power up each time (delayed ~1.4us => Power up delay = 1.3us) and I can not see any differences when I enable ADC_PWR[ASB] or ADC_PWR[APD]...

 

I have no Idea what is wrong initialised.

 

Regards

Matthias

Labels (1)
0 Kudos
1 Solution
1,267 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Regarding your question, I think 3.2us delay is understandable. As you said you set up 10MHz for the ADC12 clock, in parallel mode, the first conversion takes 10 ADC clock cycles or 1uS, the second  conversion takes 8 ADC clock cycles or 0.8us, the ADC conversions need total 1.8uS. But you have to consider software latency, especially, when you develop application code based on PE. I suppose you develop code based on PE, you use interrupt mechanism, in the ISR of ADC end of scan interrupt, you toggle a GPIO, then compare the delay between PWM signal and the GPIOs. The function calling takes a lot of time, saving register takes time.

In order to reduce the latency, I suggest you develop code without PE, even you can use polling mode, after checking the EOSI in ADC_STAT register, once it is set, toggle GPIO immediately, you will see the latency.

Pls refer to the following code:

in the ADC1.C

#pragma interrupt alignsp saveall
void AD1_InterruptCC(void)
{
  setRegBits(ADC12_STAT,0x0800);       /* Clear EOSI flag */
  OutFlg = TRUE;                       /* Measured values are available */
  if (!(getRegBit(ADC12_CTRL1,SMODE2))) { /* Not running in trigger mode? */
    AD1_ModeFlg = IDLE;                /* Set the component to the idle mode */
  }
  AD1_OnEnd();                         /* If yes then invoke user event */
}

#pragma interrupt called
void AD1_OnEnd(void)
{
  /* Write your code here ... */
    AD1_GetValue16(&sample[0]);
    Bit1_NegVal();
    asm(nop);
}

the fu

View solution in original post

0 Kudos
2 Replies
1,268 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Regarding your question, I think 3.2us delay is understandable. As you said you set up 10MHz for the ADC12 clock, in parallel mode, the first conversion takes 10 ADC clock cycles or 1uS, the second  conversion takes 8 ADC clock cycles or 0.8us, the ADC conversions need total 1.8uS. But you have to consider software latency, especially, when you develop application code based on PE. I suppose you develop code based on PE, you use interrupt mechanism, in the ISR of ADC end of scan interrupt, you toggle a GPIO, then compare the delay between PWM signal and the GPIOs. The function calling takes a lot of time, saving register takes time.

In order to reduce the latency, I suggest you develop code without PE, even you can use polling mode, after checking the EOSI in ADC_STAT register, once it is set, toggle GPIO immediately, you will see the latency.

Pls refer to the following code:

in the ADC1.C

#pragma interrupt alignsp saveall
void AD1_InterruptCC(void)
{
  setRegBits(ADC12_STAT,0x0800);       /* Clear EOSI flag */
  OutFlg = TRUE;                       /* Measured values are available */
  if (!(getRegBit(ADC12_CTRL1,SMODE2))) { /* Not running in trigger mode? */
    AD1_ModeFlg = IDLE;                /* Set the component to the idle mode */
  }
  AD1_OnEnd();                         /* If yes then invoke user event */
}

#pragma interrupt called
void AD1_OnEnd(void)
{
  /* Write your code here ... */
    AD1_GetValue16(&sample[0]);
    Bit1_NegVal();
    asm(nop);
}

the fu

0 Kudos
1,267 Views
matthiasuhlmann
Contributor II

Thank you xiangjun,

Your answer was helpfully.

Unfortunately i can not rate your answer because i need to make a new login because i forgot mi old one... sorry!

Regards

Matthias

0 Kudos