LED blinker example for MPC5604B StarterTRAK USB  ?

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

LED blinker example for MPC5604B StarterTRAK USB  ?

1,640 Views
S1nn3r
Contributor I

Hi,

 

Would someone be able to provide me with a simple LED blinker example for the MPC5604B StarterTRAK USB board ?

Labels (1)
0 Kudos
Reply
4 Replies

1,147 Views
akhilmalik
Contributor II

hi

that is

the infinite for loop

for( ; ; )

0 Kudos
Reply

1,147 Views
S1nn3r
Contributor I

Many thanks for that, however the software for this forum has changed some of the text to read smiles instead it seems here:

for (; {/* Main loop */

Would you be able to upload this code some place in plain text format to avoid this ?

0 Kudos
Reply

1,147 Views
martin_kovar
NXP Employee
NXP Employee

Hi,

look at the following project:

Example MPC5604B PinToggleStationery CW210

Regards,

Martin

0 Kudos
Reply

1,147 Views
akhilmalik
Contributor II

hi

below is the code.

#include "MPC5606B.h"

void initModesAndClock(void);

void config_PORT_E(void);

uint32_t LED_state, i;

int main (void)

{

initModesAndClock(); /* Initialisation of the device */

config_PORT_E(); /* Configuration of GPIO */

    SIU.GPDO[68].B.PDO = 1; // All LEDs are off.

  SIU.GPDO[69].B.PDO = 1; // -

  SIU.GPDO[70].B.PDO = 1; // -

  SIU.GPDO[71].B.PDO = 1; // - */

for (; :smileywink: {/* Main loop */

  for (; !SIU.GPDI[65].B.PDI;){

  SIU.GPDO[68].B.PDO = 0;

  for (i=0; i<4500000; i++){}

  SIU.GPDO[69].B.PDO = 0;

  for (i=0; i<4500000; i++){}

  SIU.GPDO[70].B.PDO = 0;

  for (i=0; i<4500000; i++){}

  SIU.GPDO[71].B.PDO = 0;

  for (i=0; i<4500000; i++){}

  SIU.MPGPDO[4].R = 0x0F000F00;

  for (i=0; i<4500000; i++){}

  }

}

}

void config_PORT_E(void)

{

SIU.PCR[68].R = 0x0200; /* LEDs are connected between PORT E pins and 5V */

SIU.PCR[69].R = 0x0200; /* PE 4 to PE 7 */

SIU.PCR[70].R = 0x0200;

SIU.PCR[71].R = 0x0200;

SIU.PCR[65].R = 0x0100; /* PE 0 */

}

void initModesAndClock(void) {

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

CGM.FMPLL_CR.R = 0x02400100; /* 8 MHz xtal: Set PLL0 to 64 MHz */

ME.RUN[0].R = 0x001F0074; /* RUN0 config: clock selection(FMPLL) */

ME.RUNPC[1].R = 0x00000010;

ME.PCTL[68].R = 0x01; /* SIUL use the configuration of RunPC[1]

add other peripherals as needed.*/

/* 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 */

}

0 Kudos
Reply