AnsweredAssumed Answered

UART mode linflex baud rate setting issue on MPC5604E

Question asked by Jakub Jirka on Dec 5, 2012

Hello I'm using following code to setup my LINFLEX1 into uart mode and 19200bps. The problem is that via the debugger I can see that procesor set the LINFLEX1.LINFBRR.B.DIV_F = 0x05 but didn't set up the integer part in LINFLEX1.LINIBRR.B.IBR = 0xD0; Linflex is during this step still in initialization mode but the register value doesn't change even when I try to write it in debug session in eclipse based codewarrior manually.

 

Thank you in advance for any ideas.

 

Linflex initialization code follows:

 

LINFLEX1.LINCR1.R &= ~(1<<LINFLEX1.LINCR1.B.SLEEP);    /* Put LINFlex hardware in init mode */

  LINFLEX1.LINCR1.R |= (1<<LINFLEX1.LINCR1.B.INIT);    /* Put LINFlex hardware in init mode */

  while(LINFLEX1.LINSR.B.LINS != 0x01) { } /* Wait for the transition to initialization mode*/

 

  /*Set up baud rate for UART - LINFLEX1 - default to 19200bps*/

  LINFLEX1.LINFBRR.B.DIV_F = 0x05;

  LINFLEX1.LINIBRR.B.IBR = 0xD0;

 

  /*Setup UART mode*/

  LINFLEX1.UARTCR.R |= (1<<LINFLEX1.UARTCR.B.UART); /*Enable UART mode*/

  LINFLEX1.UARTCR.R = 0x33; /*8-bit data, Enable receive, Enable transmit*/

 

  /*Configure ports*/

  SIUL.PCR[8].R = 0x0103; /* MPC56xxE: Configure port A8 as LIN1RX */

  SIUL.PCR[9].R = 0x0C00; /* MPC56xxE: Configure port A9 as LIN1TX */

 

  /*Back to normal mode*/

  LINFLEX1.LINCR1.R = 0x90; /* Put LINFlex hardware in normal mode */

  while(LINFLEX1.LINSR.B.LINS != 0) { } /* Wait for hardware to go to normal/sleep mode */

Attachments

Outcomes