From 5fc1a9f2247677032ceaeb6786a68e497fb0216b Mon Sep 17 00:00:00 2001 From: Mariano Alvira Date: Mon, 30 Mar 2009 16:11:08 -0400 Subject: [PATCH] baudrate mystery was my bad code. --- tests/uart1-loopback.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/uart1-loopback.c b/tests/uart1-loopback.c index 8a693fd49..54e0f7f68 100644 --- a/tests/uart1-loopback.c +++ b/tests/uart1-loopback.c @@ -17,8 +17,10 @@ void main(void) { *(volatile uint32_t *)UART1_CON = 0x0000c800; /* mask interrupts, 16 bit sample --- helps explain the baud rate */ - /* INC = 76; MOD = 1000 */ - *(volatile uint32_t *)UART1_BR = 0x004C03E8; /* Baud rate: (INC<<16 || MOD) */ /* is 115200 @ 24 MHz --- unexplained */ + /* INC = 767; MOD = 9999 works: 115200 @ 24 MHz 16 bit sample */ + #define INC 767 + #define MOD 9999 + *(volatile uint32_t *)UART1_BR = INC<<16 | MOD; /* see Section 11.5.1.2 Alternate Modes */ /* you must enable the peripheral first BEFORE setting the function in GPIO_FUNC_SEL */