[MPC5744P]Problem about ADC trigger mode change

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

[MPC5744P]Problem about ADC trigger mode change

Jump to solution
2,371 Views
fyw
Contributor IV

My program execution process is as follows:

 

s1: ctu0 trigger adc0&1

s2: wait for ctu0 trigger end

s3: disable adc0&1 ctu trigger mode(ADC_0(1).MCR.B.CTUEN=0), and injection start(ADC_0(1).MCR.B.JSTART=1)

s4: wait for injection conversion end

s5: enable adc0&1 ctu trigger mode(ADC_0(1).MCR.B.CTUEN=1), and goto s1

 

i find after s5, the ctu0 could not trigger adc0&1 any more. i am sure that ctu0 works well(because i can enter the ctu0 trigger out interrupt)

 

i simple the process like this:

s1: ctu0 trigger adc0&1

s2: wait for ctu0 trigger end

s3: disable adc0 or adc1 ctu trigger mode(ADC_0( or 1).MCR.B.CTUEN=0)

s4: wait for "a period of time"

s5: enable adc0&1 ctu trigger mode(ADC_0(1).MCR.B.CTUEN=1), and goto s1

i find the result depends on "a period of time":

if "a period of time" is short, e.g., for(k=0;k<100;k++); then no err will happen, the ctu will trigger adc0&1 well

if "a period of time" is long,  e.g., for(k=0;k<1000;k++); then the result will be same with the above, the ctu could not trigger adc0&1 any more

 

i wander what's the problem? Is there any rule if i want to clear and re-Set "MCR.B.CTUEN" ?

 

Thank you very much!

Labels (1)
0 Kudos
Reply
1 Solution
2,102 Views
petervlna
NXP TechSupport
NXP TechSupport

Hi,

Do you also disable to CTU triggers to ADC?

Or just change ADC mode to software?

Peter

View solution in original post

0 Kudos
Reply
3 Replies
2,102 Views
fyw
Contributor IV

Problem solved 

do as follows will be ok!  Can anybody explain when disable ADC CTU mode, why need to configure CTU0 first? Thank you very much!

 
pCTU_0->
TGSISR.R = 0x000000000;
pCTU_0->
CR.B.TGSISR_RE = 1;       
pADC_0->
MCR.B.CTUEN =0;            /*disable ADC CTU mode */       
pADC_1->
MCR.B.CTUEN =0;            /*disable ADC CTU mode */

-------------------------------------------------------------------------------------------------------

pADC_0->MCR.B.CTUEN = 1;          /* enable ADC CTU mode */   
pADC_1->
MCR.B.CTUEN =1;            /*enable ADC CTU mode */         
pCTU_0->
TGSISR.R  = ((h_u32)1<< ((CTU0_TRGCH * 2u) + 1u));

pCTU_0->CR.B.TGSISR_RE = 1;

0 Kudos
Reply
2,102 Views
petervlna
NXP TechSupport
NXP TechSupport

Hi,

You CTU will continue to request ADC conversions while is enabled.

Always disable triggers first. If it is DMA, ADC, or any other HW triggered periphery.

Peter

0 Kudos
Reply
2,103 Views
petervlna
NXP TechSupport
NXP TechSupport

Hi,

Do you also disable to CTU triggers to ADC?

Or just change ADC mode to software?

Peter

0 Kudos
Reply