MPC5605B will SS but not Go

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

MPC5605B will SS but not Go

Jump to solution
819 Views
Bob4831
Contributor I

I'm using the PE Multilink Universal JTAG'd to my MPC5605B target.  The CW is 5.9.0/3510.  Flash starting address for Main is 0x2000.

 

I couldn't seem to single step my code reliably so I striped down to just these few lines that I built using the CW wizard.

 

 

#include "MPC5605B.h"

int main(void)

{volatile int i = 0;

ME.RUNPC[1].R = 0x00000018; // Perif active in RUN0 or DRUN mode

ME.PCTL[68].R = 0x01;                // MPC56xxB/S SIU: select ME.RUNPC[1]

SIU.PCR[87].R = 0x0200;            // MPC56xxB: Initialize PF7 as output

SIU.GPDO[87].R = 0x0;                // turn on low true diag LED drive

for (;:smileywink: { i++;}                                    /* Loop forever */

}

 

If I set a break point at SIU.PCR[87].R = 0x0200, and single step from there, the write to GPDO[87] works, the output goes low, and all is well.  But, if I set the breakpoint beyond that point or just try to Go from reset with no break point, the variable counts but the I/O is not driven. I had been putting the processor in RUN0 mode, but I would often lose the debug control.

 

Why do I have to single step this to make it work?

 

Thanks

Labels (1)
0 Kudos
1 Solution
537 Views
stanish
NXP Employee
NXP Employee

Hello Bob4831,

 

I suspect your code is missing waiting loop to check sucessful mode transition. See below a snippet of a Cookbook example located in CodeWarrior examplesdirectory ("<CW for MPC55xx and MPC56xx 2.x>\(CodeWarrior_Examples)\560xB-CW" ) e.g.:

 

void initModesAndClock(void) {
  ME.MER.R = 0x0000001D; /* Enable DRUN, RUN0, SAFE, RESET modes */
  /* Initialize PLL before turning it on: */
  /* Use 1 of the next 2 lines depending on crystal frequency: */
  CGM.FMPLL_CR.R = 0x02400100; /* 8 MHz xtal: Set PLL0 to 64 MHz */
  ME.RUN[0].R = 0x001F0074; /* RUN0 cfg: 16MHzIRCON,OSC0ON,PLL0ON,syclk=PLL */
  ME.RUNPC[1].R = 0x00000010; /* Peri. Cfg. 1 settings: only run in RUN0 mode */
  ME.PCTL[92].R = 0x01; /* PIT, RTI: select ME_RUN_PC[1] */
  /* 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 */
  /* Note: could wait here using timer and/or I_TC IRQ */
  while(ME.GS.B.S_CURRENTMODE != 4) {} /* Verify RUN0 is the current mode */
}

 

Stanish

 


View solution in original post

0 Kudos
2 Replies
538 Views
stanish
NXP Employee
NXP Employee

Hello Bob4831,

 

I suspect your code is missing waiting loop to check sucessful mode transition. See below a snippet of a Cookbook example located in CodeWarrior examplesdirectory ("<CW for MPC55xx and MPC56xx 2.x>\(CodeWarrior_Examples)\560xB-CW" ) e.g.:

 

void initModesAndClock(void) {
  ME.MER.R = 0x0000001D; /* Enable DRUN, RUN0, SAFE, RESET modes */
  /* Initialize PLL before turning it on: */
  /* Use 1 of the next 2 lines depending on crystal frequency: */
  CGM.FMPLL_CR.R = 0x02400100; /* 8 MHz xtal: Set PLL0 to 64 MHz */
  ME.RUN[0].R = 0x001F0074; /* RUN0 cfg: 16MHzIRCON,OSC0ON,PLL0ON,syclk=PLL */
  ME.RUNPC[1].R = 0x00000010; /* Peri. Cfg. 1 settings: only run in RUN0 mode */
  ME.PCTL[92].R = 0x01; /* PIT, RTI: select ME_RUN_PC[1] */
  /* 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 */
  /* Note: could wait here using timer and/or I_TC IRQ */
  while(ME.GS.B.S_CURRENTMODE != 4) {} /* Verify RUN0 is the current mode */
}

 

Stanish

 


0 Kudos
537 Views
Bob4831
Contributor I

Not so much that I had no wait for the mode change, but that I had not requested a mode change.  That is, changes to the periferal clocks do not take effect until a mode change is requested... even if the 'change' is to the existing mode.

 

Thanks for your help!

0 Kudos