First starting Codewarrior for MPC55xx MPC56xx with MPC5604P(XPC56xx EVB REV.C) but Can't do ADC_SW example + printf

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

First starting Codewarrior for MPC55xx MPC56xx with MPC5604P(XPC56xx EVB REV.C) but Can't do ADC_SW example + printf

Jump to solution
1,569 Views
dyel
Contributor II

(I'm so sorry about don't good at write and read by english)

 

I just start using CW for MPC55xx MPC56xx with MPC5604P(XPC56xx EVB REV.C) few day ago.

 

I wan't use ADC function, for print read value to console. but debug(F5) say to me, " undeclared 'printf'".

(i'm just put #include <stdio.h>(or <console_io.h .. etc) on code.)

 

and i try Example MPC5604P ADC setting for scan mode on TRK board , but isn't work...

 

If it works well, LED1 be turn on, when rotate Trimmer (Jumper on J40, J21, J8.. and default etc), it isn't?

 

it's problem that what is going to wrong..

 

save me... OTL

Labels (1)
Tags (3)
1 Solution
717 Views
martin_kovar
NXP Employee
NXP Employee

Hi,

the example you try is created for different board (TRK). TRK board has different crystal (8MHz). MPC5604P in mini-module board has probably 40MHz crystal. You have to use different code to initialize PLL.

Replace function InitModesAndClks in you project with this source code:

 

/* Enter RUN0 with PLL as sys clk (64 MHz) with 40 MHz crystal reference. */                                                                                                                     

void InitModesAndClks(void) {                                                                                                                 

      ME.MER.R = 0x0000001D;          /* Enable DRUN, RUN0, SAFE, RESET modes */                                                                                                                              

      CGM.FMPLL[0].CR.R = 0x11200100;    /* 40MHz xtal: Set PLL0 to 64 MHz */                                                                                                                    

      ME.RUNPC[0].R = 0x000000FE; /* enable peripherals run in all modes */                                                                                                                        

      ME.RUN[0].R = 0x001F0074;       /* RUN0 cfg: IRCON,OSC0ON,PLL0ON,syclk=PLL */                                                                                                                    

      /* Mode Transition to enter RUN0 mode: */                                                                                                                

      ME.MCTL.R = 0x40005AF0;         /* Enter RUN0 Mode & Key */                                                                                                                             

      ME.MCTL.R = 0x4000A50F;         /* Enter RUN0 Mode & Inverted Key */                                                                                                                           

      while (ME.GS.B.S_MTRANS) {} ;    /* Wait for mode transition to complete */                                                                                                                              

      while(ME.GS.B.S_CURRENTMODE != 4) {}; /* Verify RUN0 is the current mode */                                                                                                                      

}                             

Now it should work. Please write me back if it helps you.

Regards,

Martin

View solution in original post

0 Kudos
4 Replies
718 Views
martin_kovar
NXP Employee
NXP Employee

Hi,

the example you try is created for different board (TRK). TRK board has different crystal (8MHz). MPC5604P in mini-module board has probably 40MHz crystal. You have to use different code to initialize PLL.

Replace function InitModesAndClks in you project with this source code:

 

/* Enter RUN0 with PLL as sys clk (64 MHz) with 40 MHz crystal reference. */                                                                                                                     

void InitModesAndClks(void) {                                                                                                                 

      ME.MER.R = 0x0000001D;          /* Enable DRUN, RUN0, SAFE, RESET modes */                                                                                                                              

      CGM.FMPLL[0].CR.R = 0x11200100;    /* 40MHz xtal: Set PLL0 to 64 MHz */                                                                                                                    

      ME.RUNPC[0].R = 0x000000FE; /* enable peripherals run in all modes */                                                                                                                        

      ME.RUN[0].R = 0x001F0074;       /* RUN0 cfg: IRCON,OSC0ON,PLL0ON,syclk=PLL */                                                                                                                    

      /* Mode Transition to enter RUN0 mode: */                                                                                                                

      ME.MCTL.R = 0x40005AF0;         /* Enter RUN0 Mode & Key */                                                                                                                             

      ME.MCTL.R = 0x4000A50F;         /* Enter RUN0 Mode & Inverted Key */                                                                                                                           

      while (ME.GS.B.S_MTRANS) {} ;    /* Wait for mode transition to complete */                                                                                                                              

      while(ME.GS.B.S_CURRENTMODE != 4) {}; /* Verify RUN0 is the current mode */                                                                                                                      

}                             

Now it should work. Please write me back if it helps you.

Regards,

Martin

0 Kudos
717 Views
dyel
Contributor II

I'm really sorry.. it works well.

i understand 1 is on, 0 is off... how stupid.

Thanks a lot.

717 Views
dyel
Contributor II

I'ts really helpful for me.

i notice that cause debug on 'end-less while' state in this line.

while(ME.GS.B.S_CURRENTMODE != 4) {} /* Verify RUN0 is the current mode */

so as u say, It's work and i can see on Variables window, after change code.

but it's still don't work LED1, what's can be problem? board configuration of jumper?

i'm really sorry and thanks again.

0 Kudos
717 Views
martin_kovar
NXP Employee
NXP Employee

Hi,

could you please send me a good quality photo of your board (mini-module and also EVB motherboard)? I need to check your jumper setting, because on my side it works correct.

Which debug probe you use?

Regards,

Martin

0 Kudos