ADC EOSI Delay not as expected (MC56F82726)

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

ADC EOSI Delay not as expected (MC56F82726)

ソリューションへジャンプ
1,598件の閲覧回数
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

ラベル(1)
0 件の賞賛
返信
1 解決策
1,380件の閲覧回数
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 件の賞賛
返信
2 返答(返信)
1,381件の閲覧回数
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 件の賞賛
返信
1,380件の閲覧回数
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 件の賞賛
返信