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 */