From a1f1299ddcb617b1235a22913ce0dfcb6187c622 Mon Sep 17 00:00:00 2001 From: patacongo Date: Mon, 1 Jun 2009 19:29:14 +0000 Subject: Fix UART configuration issues git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1843 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/ChangeLog | 3 +++ nuttx/Documentation/NuttX.html | 5 +++- nuttx/arch/arm/src/str71x/str71x_lowputc.c | 4 +-- nuttx/arch/arm/src/str71x/str71x_map.h | 2 +- nuttx/arch/arm/src/str71x/str71x_pcu.h | 2 +- nuttx/arch/arm/src/str71x/str71x_prccu.c | 36 +++++++++++++-------------- nuttx/arch/arm/src/str71x/str71x_rccu.h | 2 +- nuttx/configs/olimex-strp711/ostest/defconfig | 4 +-- 8 files changed, 32 insertions(+), 26 deletions(-) diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index d1c865a9e..48c647e55 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -755,5 +755,8 @@ 0.4.8 2009-xx-xx Gregory Nutt * lib/lib_*stream.c: Extend internal stream logic to support incoming streams. + * arch/arm/src/str71x: Made some progress with the Olimex STR-P711 before my + emulator stopped working. Serial output is now correct. I don't think it + would take much more to get it working! diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html index 172f27998..632acf17e 100644 --- a/nuttx/Documentation/NuttX.html +++ b/nuttx/Documentation/NuttX.html @@ -8,7 +8,7 @@

NuttX RTOS

-

Last Updated: May 30, 2009

+

Last Updated: June 01, 2009

@@ -1421,6 +1421,9 @@ buildroot-0.1.6 2009-xx-xx <spudmonkey@racsa.co.cr> nuttx-0.4.8 2009-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> * lib/lib_*stream.c: Extend internal stream logic to support incoming streams. + * arch/arm/src/str71x: Made some progress with the Olimex STR-P711 before my + emulator stopped working. Serial output is now correct. I don't think it + would take much more to get it working! pascal-0.1.3 2009-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> diff --git a/nuttx/arch/arm/src/str71x/str71x_lowputc.c b/nuttx/arch/arm/src/str71x/str71x_lowputc.c index aa8218204..740155e8d 100644 --- a/nuttx/arch/arm/src/str71x/str71x_lowputc.c +++ b/nuttx/arch/arm/src/str71x/str71x_lowputc.c @@ -196,7 +196,7 @@ #if STR71X_UART_2STOP != 0 # define STR71X_UARTCR_STOP STR71X_UARTCR_STOPBIT20 #else -# define STR71X_UARTCR_STOP STR71X_UARTCR_STOPBIT05 +# define STR71X_UARTCR_STOP STR71X_UARTCR_STOPBIT10 #endif #define STR71X_UARTCR_VALUE (STR71X_UARTCR_MODE|STR71X_UARTCR_PARITY|STR71X_UARTCR_STOP|\ @@ -212,7 +212,7 @@ */ #define UART_BAUDDIVISOR (16 * STR71X_UART_BAUD) -#define UART_BAUDRATE ((STR71X_PCLK1 + (UART_BAUDDIVISOR/2) / UART_BAUDDIVISOR)) +#define UART_BAUDRATE ((STR71X_PCLK1 + (UART_BAUDDIVISOR/2)) / UART_BAUDDIVISOR) /************************************************************************** * Private Types diff --git a/nuttx/arch/arm/src/str71x/str71x_map.h b/nuttx/arch/arm/src/str71x/str71x_map.h index 419215297..67abd49d7 100644 --- a/nuttx/arch/arm/src/str71x/str71x_map.h +++ b/nuttx/arch/arm/src/str71x/str71x_map.h @@ -1,7 +1,7 @@ /************************************************************************************ * arch/arm/src/str71x/str71x_map.h * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without diff --git a/nuttx/arch/arm/src/str71x/str71x_pcu.h b/nuttx/arch/arm/src/str71x/str71x_pcu.h index 29b08659b..9883b3331 100644 --- a/nuttx/arch/arm/src/str71x/str71x_pcu.h +++ b/nuttx/arch/arm/src/str71x/str71x_pcu.h @@ -1,7 +1,7 @@ /************************************************************************************ * arch/arm/src/str71x/str71x_pcu.h * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without diff --git a/nuttx/arch/arm/src/str71x/str71x_prccu.c b/nuttx/arch/arm/src/str71x/str71x_prccu.c index fce496e3c..f43958539 100644 --- a/nuttx/arch/arm/src/str71x/str71x_prccu.c +++ b/nuttx/arch/arm/src/str71x/str71x_prccu.c @@ -1,7 +1,7 @@ /******************************************************************************** * arch/arm/src/str71x/str71x_prccu.c * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -48,21 +48,12 @@ #include "chip.h" #include "up_arch.h" +#include "str71x_internal.h" /******************************************************************************** * Definitions ********************************************************************************/ -/* Input frequency (CLK2) is either the main oscillator or the main oscillator - * divided by 2. - */ - -#ifdef STR71X_PLL1_DIV2 -# define STR71X_PLL1_CLK2 (STR71X_RCCU_MAIN_OSC/2) -#else -# define STR71X_PLL1_CLK2 STR71X_RCCU_MAIN_OSC -#endif - /* Select set of peripherals to be enabled */ /* APB1 periperals */ @@ -371,9 +362,9 @@ void str71x_prccuinit(void) uint32 reg32; uint16 reg16; - /* Divide RCLK to obtain PCLK1 & 2 clock for the APB1 & 2 peripherals. The divider - * values are provided in board.h - */ + /* Divide RCLK to obtain PCLK1 & 2 clock for the APB1 & 2 peripherals. The divider + * values are provided in board.h + */ reg16 = getreg16(STR71X_PCU_PDIVR); reg16 &= ~(STR71X_PCUPDIVR_FACT1MASK|STR71X_PCUPDIVR_FACT2MASK); @@ -382,7 +373,7 @@ void str71x_prccuinit(void) /* Configure the main system clock (MCLK) divider with value from board.h */ - reg16 = getreg16(STR71X_PCU_MDIVR); + reg16 = getreg16(STR71X_PCU_MDIVR); reg16 &= ~STR71X_PCUMDIVR_FACTMASK; reg16 |= MCLKDIV; putreg16(reg16 , STR71X_PCU_MDIVR); @@ -396,7 +387,7 @@ void str71x_prccuinit(void) * (CLK2) is greater than 3MHz. */ -#if STR71X_PLL1_CLK2 > 3000000 +#if STR71X_CLK2 > 3000000 putreg32(PLL1MUL|PLL1DIV, STR71X_RCCU_PLL1CR); #else putreg32(PLL1MUL|PLL1DIV|STR71X_RCCUPLL1CR_FREFRANGE, STR71X_RCCU_PLL1CR); @@ -408,8 +399,17 @@ void str71x_prccuinit(void) /* Set the CK2_16 Bit in the CFR to use CLK2/PLL1OUT as CLK3 */ - reg32 = getreg32(STR71X_RCCU_CFR); - putreg32(reg32 | STR71X_RCCUCFR_CK216, STR71X_RCCU_CFR); + reg32 = getreg32(STR71X_RCCU_CFR); + reg32 |= STR71X_RCCUCFR_CK216; + + /* Should the main oscillator divided down by 2? */ + +#ifdef STR71X_PLL1IN_DIV2 + reg32 |= STR71X_RCCUCFR_DIV2; +#else + reg32 &= ~STR71X_RCCUCFR_DIV2; +#endif + putreg32(reg32, STR71X_RCCU_CFR); /* Wait for the PLL to lock */ diff --git a/nuttx/arch/arm/src/str71x/str71x_rccu.h b/nuttx/arch/arm/src/str71x/str71x_rccu.h index 0c13644c3..18bd448d0 100644 --- a/nuttx/arch/arm/src/str71x/str71x_rccu.h +++ b/nuttx/arch/arm/src/str71x/str71x_rccu.h @@ -1,7 +1,7 @@ /************************************************************************************ * arch/arm/src/str71x/str71x_rccu.h * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without diff --git a/nuttx/configs/olimex-strp711/ostest/defconfig b/nuttx/configs/olimex-strp711/ostest/defconfig index 4849621d1..e9734c1d8 100644 --- a/nuttx/configs/olimex-strp711/ostest/defconfig +++ b/nuttx/configs/olimex-strp711/ostest/defconfig @@ -1,7 +1,7 @@ ############################################################################ # configs/olimes-strp711/ostest/defconfig # -# Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved. +# Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -556,7 +556,7 @@ CONFIG_USBSTRG_REMOVABLE=y # # Settings for examples/ostest CONFIG_EXAMPLES_OSTEST_LOOPS=1 -CONFIG_EXAMPLES_OSTEST_STACKSIZE=4096 +CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048 CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 # -- cgit v1.2.3