Hi Greg,
thank you for the accurate response. We use a Coldfire 5234. I have seen
on the Coldfire manual and the uClinux code (kernel 2.6.x).
Making some computations, we have seen that our 57600 baudrate is
changed by our micro to 57165 bps. In fact, the formula to compute the
divisor is:
Divisor = BusClock / (32 * baudrate)
In our case, BusClock = 75 Mhz, baudrate = 57600, so Divisor = 41.
Thus, the real baudrate is 75000000 / (32 * 41) = 57165 bps.
We could try to change divisor to 40 to have a 58594 bps baudrate, but
it's not so useful for our purposes.
We will try other solutions.
Thank you again
Regards
Salvatore
Il 01/06/2011 3.38, Greg Ungerer ha scritto:
Hi Salvatore,
On 31/05/11 22:29, Salvatore Frizzoli - IMS Italy wrote:
I have an issue to the RS232 serial port on a Coldfire board equipped
with uClinux. I have set the serial port with a baudrate of 57600 bps,
it is connected to a third-party device, but it doesn't work (all
charachters are corrupted). If I connect a PC directly to the device
with 57600 bps, it works.
If the bps is put down to 19200, also the connection by the board works.
Yeah, in most cases the ColdFire generated baud rates will not be
very accurate. They are a simple division of the CPU clock, so it
is easy to work out what exact baud rate you will see for a specific
baud setting. And faster baud rates usually have larger errors.
If you email your ColdFire CPU type and the clock you are driving
it with we could quickly figure it out.
(* One caveat is the 5272, which has a fine grained baud rate
setting as well)
This is due to the fact that the third party device probably has a
baudrate lightly different from 57600 bps and the PC serail port can
adjust its frequency according to the device one, while Coldfire cannot.
My question is: is there a way to configure the serial port by uClinux
such that also Coldfire can adjust its frequency?
Alternatively, can I configure the serial port with a baudrate slightly
different from the standard ones (for example: 57500 in place of 57600)?
You could easily modify the clock and divisor code for the serial
driver. Have a look at the code (depends on which kernel version
where the driver source is linux-2.4.x/drivers/char/mcfserial.c,
or linux-2.6.x/drivers/serial/mcf.c or even
linux-2.6.x/drivers/tty/serial/mcf.c for the very latest 2.6 kernels).
Regards
Greg
------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: g...@snapgear.com
SnapGear Group, McAfee PHONE: +61 7 3435 2888
8 Gardner Close FAX: +61 7 3217 5323
Milton, QLD, 4064, Australia WEB: http://www.SnapGear.com
--
Salvatore Frizzoli
Software Developer
Research& Development Department
IMS srl
Via Sagittario, 5
Fraz. Pontecchio Marconi
40037 Sasso Marconi (BO)
Italy
Tel. ++39 051 846851
Fax ++39 051 846856
mail: s f r i z z o l i (at) i m s i t a l y (dot) c o m
http://www.imsitaly.com
_______________________________________________
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev