summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-02-08 17:25:29 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-02-08 17:25:29 +0000
commit4d38c9e58c3e7ffc7647b5729d77c91053bc49f7 (patch)
tree576daf7298d9450ab824fdb9a7626de65cd50d63 /nuttx/arch/arm
parentebff820250129b6361ff9de635578e07d11fe16c (diff)
downloadpx4-nuttx-4d38c9e58c3e7ffc7647b5729d77c91053bc49f7.tar.gz
px4-nuttx-4d38c9e58c3e7ffc7647b5729d77c91053bc49f7.tar.bz2
px4-nuttx-4d38c9e58c3e7ffc7647b5729d77c91053bc49f7.zip
Fix DM320 serial configuration problem
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@661 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm')
-rw-r--r--nuttx/arch/arm/src/common/up_internal.h10
-rw-r--r--nuttx/arch/arm/src/dm320/dm320_serial.c2
-rw-r--r--nuttx/arch/arm/src/dm320/dm320_uart.h40
3 files changed, 28 insertions, 24 deletions
diff --git a/nuttx/arch/arm/src/common/up_internal.h b/nuttx/arch/arm/src/common/up_internal.h
index 4d84f2cdd..182e6058c 100644
--- a/nuttx/arch/arm/src/common/up_internal.h
+++ b/nuttx/arch/arm/src/common/up_internal.h
@@ -49,11 +49,11 @@
* board bring-up and not part of normal platform configuration.
*/
-#undef CONFIG_SUPPRESS_INTERRUPTS /* Do not enable interrupts */
-#undef CONFIG_SUPPRESS_TIMER_INTS /* No timer */
-#undef CONFIG_SUPPRESS_SERIAL_INTS /* Console will poll */
-#define CONFIG_SUPPRESS_UART_CONFIG 1 /* Do not reconfig UART */
-#undef CONFIG_DUMP_ON_EXIT /* Dump task state on exit */
+#undef CONFIG_SUPPRESS_INTERRUPTS /* DEFINED: Do not enable interrupts */
+#undef CONFIG_SUPPRESS_TIMER_INTS /* DEFINED: No timer */
+#undef CONFIG_SUPPRESS_SERIAL_INTS /* DEFINED: Console will poll */
+#undef CONFIG_SUPPRESS_UART_CONFIG /* DEFINED: Do not reconfig UART */
+#undef CONFIG_DUMP_ON_EXIT /* DEFINED: Dump task state on exit */
/****************************************************************************
* Public Types
diff --git a/nuttx/arch/arm/src/dm320/dm320_serial.c b/nuttx/arch/arm/src/dm320/dm320_serial.c
index be32d269b..7018f7b41 100644
--- a/nuttx/arch/arm/src/dm320/dm320_serial.c
+++ b/nuttx/arch/arm/src/dm320/dm320_serial.c
@@ -379,7 +379,7 @@ static int up_setup(struct uart_dev_s *dev)
/* Setup the new UART configuration */
- up_serialout(priv,UART_MSR, priv->msr);
+ up_serialout(priv, UART_MSR, priv->msr);
up_serialout(priv, UART_BRSR, brsr);
up_enablebreaks(priv, FALSE);
#endif
diff --git a/nuttx/arch/arm/src/dm320/dm320_uart.h b/nuttx/arch/arm/src/dm320/dm320_uart.h
index 8938018a7..0c5d803be 100644
--- a/nuttx/arch/arm/src/dm320/dm320_uart.h
+++ b/nuttx/arch/arm/src/dm320/dm320_uart.h
@@ -70,24 +70,28 @@
#define UART_DTRR_DTR_MASK 0x00ff /* Data transmit/receive */
/* UART BRSR register bit definitions */
-/* The UART clock is half of the ARM clock */
-
-#define UART_CLK (DM320_ARM_CLOCK / 2)
-
-/* And baud rate = UART_CLK / 16 / (VALUE+1) */
-
-#define UART_BAUD_2400 ((uint16)(((UART_CLK / 16) / 2400 ) - 1))
-#define UART_BAUD_4800 ((uint16)(((UART_CLK / 16) / 4800 ) - 1))
-#define UART_BAUD_9600 ((uint16)(((UART_CLK / 16) / 9600 ) - 1))
-#define UART_BAUD_14400 ((uint16)(((UART_CLK / 16) / 14400 ) - 1))
-#define UART_BAUD_19200 ((uint16)(((UART_CLK / 16) / 19200 ) - 1))
-#define UART_BAUD_28800 ((uint16)(((UART_CLK / 16) / 28800 ) - 1))
-#define UART_BAUD_38400 ((uint16)(((UART_CLK / 16) / 38400 ) - 1))
-#define UART_BAUD_57600 ((uint16)(((UART_CLK / 16) / 57600 ) - 1))
-#define UART_BAUD_115200 ((uint16)(((UART_CLK / 16) / 115200) - 1))
-#define UART_BAUD_230400 ((uint16)(((UART_CLK / 16) / 230400) - 1))
-#define UART_BAUD_460800 ((uint16)(((UART_CLK / 16) / 460800) - 1))
-#define UART_BAUD_921600 ((uint16)(((UART_CLK / 16) / 921600) - 1))
+/* The UART module is clocked by either the AHB clock or PLLIN / 16 */
+
+#ifdef CONFIG_DM320_UARTPPLIN
+# define UART_REFCLK (27000000 / 16)
+#else
+# define UART_REFCLK (DM320_AHB_CLOCK / 16)
+#endif
+
+/* And baud = UART_REFCLK / (brsr+1) */
+
+#define UART_BAUD_2400 ((uint16)((UART_REFCLK / 2400 ) - 1))
+#define UART_BAUD_4800 ((uint16)((UART_REFCLK / 4800 ) - 1))
+#define UART_BAUD_9600 ((uint16)((UART_REFCLK / 9600 ) - 1))
+#define UART_BAUD_14400 ((uint16)((UART_REFCLK / 14400 ) - 1))
+#define UART_BAUD_19200 ((uint16)((UART_REFCLK / 19200 ) - 1))
+#define UART_BAUD_28800 ((uint16)((UART_REFCLK / 28800 ) - 1))
+#define UART_BAUD_38400 ((uint16)((UART_REFCLK / 38400 ) - 1))
+#define UART_BAUD_57600 ((uint16)((UART_REFCLK / 57600 ) - 1))
+#define UART_BAUD_115200 ((uint16)((UART_REFCLK / 115200) - 1))
+#define UART_BAUD_230400 ((uint16)((UART_REFCLK / 230400) - 1))
+#define UART_BAUD_460800 ((uint16)((UART_REFCLK / 460800) - 1))
+#define UART_BAUD_921600 ((uint16)((UART_REFCLK / 921600) - 1))
/* UART MSR register bit definitions */