[uClinux-dev] slow UART on MCF 5272?

Wei Wang, P.E. wwang at electroind.com
Wed Nov 14 12:22:03 EST 2001

Please make sure the Programmable Divider value for MCF5272C3 evaluation
board is correct for the appropriate baud rate.  Normally, the error
rate should be less than 5% for any baud rate selection.  Unfortunately,
with the 66MHz crystal, there is no common divider value for all baud
rates.  The calculation is in the MCF5272 Coldfire User's Manual,

Here is the comment from Motorola's tech support regarding manually
change the MCF5272C3 UART divider upper/lower registers:
"The UDU and UDL registers can be modified using dBUG's "irm" command.
The catch is dBUG refers to them as UBG1 and UBG2 respectively. So to
modify UDU the syntax would be "irm uart0.ubg1" and then the hex value
you want to write to the register. These are write only registers so
they cannot be displayed. The UFPD register is not currently listed by
dBUG. However it can still be accessed using the "mm" and "md" commands
(memory display and memory modify) and the physical location of the
register-- 0x10000000 (MBAR used by dBUG) + the register offset. So if
you wanted to write to the UFPD for uart0, then you would use "mm.b
0x10000130 " and then the hex value to be written. You could also
display the value this way: "md.b 0x10000130""

"Magnusson, Johan" wrote:
> Hi all!
> I'm new to this list (not as a reader but anyway..). I have been working
> with the uClinux distribution for MCF5272 for two weeks now and it has been
> working pretty good, except from some problems using the second UART. So
> what would you expect? yet another UART problem? of course!
> I am having troubles running this UART in 115200. 9600 works fine but 115200
> is VERY shaky, 38400 works but i don't get the speed I am asking for. This
> feels like a problem induced by my UART initialization.
> So here is what I do:
> in mcfserial.c i do according to previous mails on the list from Greg
> Ungerer i add:
> >        /* Enable the output lines for the serial ports */
> >        portp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_PBCNT);
> >        *portp = (*portp & ~0x000000ff) | 0x00000055;
> >        portp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_PDCNT);
> >        *portp = (*portp & ~0x000003fc) | 0x000002a8;
> Ok?
> I then initialize my serial port from my program using:
> >  cfmakeraw(&t);
> >
> >  t.c_cflag &= ~CBAUD;
> >  t.c_cflag |= B115200 | CS8 | CLOCAL;
> >  t.c_oflag = 0; /* turn off output processing */
> >  t.c_lflag = 0; /* no local modes */
> >
> >  t.c_cflag |= CRTSCTS;
> > if (tcsetattr(fd, TCSANOW, &t) < 0)
> >  {
> >    perror("fd_setup : tcsetattr");
> >    exit(1);
> >  }
> ok?
> This results in my cellular phone (Ericsson t39) not getting my "message".
> speeds under 38400 works fine but higher speeds do not work. Ohh it works
> from my PC but not from my embedded system.
> I have tried a couple of arguments for the serial port set-up without any
> effect on the result. I also noticed someone pointing out a rounding problem
> (in mcfserial.c) in setting the speed registry bits (integer division to
> integer). I implemented the proposed solution, without any luck.
> what am I doing wrong here?? This have to be some silly initialization
> problem, but I am obviously not good enough to fix it!
> Best regards
> Johan K Magnusson
> This message resent by the uclinux-dev at uclinux.org list server http://www.uClinux.org/


Wei Wang, P.E.
Electro Industries/GaugeTech
1800 Shames Dr.
Westbury, NY  11590

email: wwang at electroind.com
Web:   http://www.electroind.com
This message resent by the uclinux-dev at uclinux.org list server http://www.uClinux.org/

More information about the uClinux-dev mailing list