[ECOS] Correction of baudrate calculation for QUICC SMC uart

Tord Andersson Tord.Andersson@combitechsystems.com
Mon Sep 8 06:58:00 GMT 2003


Hi,

When using higher baudrates in an MPC823e based system using eCos and
the SMC UART, I found that the baudrate was slightly wrong. I checked
the baudrate calculation and believe that it could be somewhat altered. 
The change has solved our problem. 
Below is the result of "diff -u -5 -b -p" between the original and the
patched file for review.
The file is located in
.../packages/devs/serial/powerpc/quicc/current/src

---------------------------------------

--- quicc_smc_serial.h	Thu Sep  4 08:50:14 2003
+++ patched_quicc_smc_serial.h	Thu Sep  4 09:04:26 2003
@@ -130,8 +130,8 @@
     0,      // 230400
 };
 
-#define UART_BITRATE(n)
(((CYGHWR_HAL_POWERPC_BOARD_SPEED*1000000)/16)/n)
-#define UART_SLOW_BITRATE(n)
((CYGHWR_HAL_POWERPC_BOARD_SPEED*1000000)/n))
+#define UART_BITRATE(n)
((((CYGHWR_HAL_POWERPC_BOARD_SPEED*1000000)/16)/n)-1)
+#define UART_SLOW_BITRATE(n)
(((CYGHWR_HAL_POWERPC_BOARD_SPEED*1000000)/n))-1)
 
 // Channel type select
 #define _SCC_CHAN 0

--------------------------------------

Kind regards,

Tord Andersson
Combitech Systems AB


--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss



More information about the Ecos-discuss mailing list