summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nuttx/arch/arm/src/nuc1xx/nuc_clockconfig.c2
-rw-r--r--nuttx/arch/arm/src/nuc1xx/nuc_lowputc.c10
-rw-r--r--nuttx/configs/nutiny-nuc120/README.txt60
-rw-r--r--nuttx/configs/nutiny-nuc120/include/board.h8
-rw-r--r--nuttx/configs/nutiny-nuc120/ostest/defconfig22
-rw-r--r--nuttx/drivers/usbdev/Kconfig12
6 files changed, 74 insertions, 40 deletions
diff --git a/nuttx/arch/arm/src/nuc1xx/nuc_clockconfig.c b/nuttx/arch/arm/src/nuc1xx/nuc_clockconfig.c
index b89d9e036..500856254 100644
--- a/nuttx/arch/arm/src/nuc1xx/nuc_clockconfig.c
+++ b/nuttx/arch/arm/src/nuc1xx/nuc_clockconfig.c
@@ -127,7 +127,7 @@ void nuc_clockconfig(void)
/* Enable External 4~24 mhz high speed crystal */
- regval = getreg32(NUC_CLK_PWRCON);
+ regval = getreg32(NUC_CLK_PWRCON);
regval |= CLK_PWRCON_XTL12M_EN;
putreg32(regval, NUC_CLK_PWRCON);
diff --git a/nuttx/arch/arm/src/nuc1xx/nuc_lowputc.c b/nuttx/arch/arm/src/nuc1xx/nuc_lowputc.c
index 50b9b35f0..77b744948 100644
--- a/nuttx/arch/arm/src/nuc1xx/nuc_lowputc.c
+++ b/nuttx/arch/arm/src/nuc1xx/nuc_lowputc.c
@@ -276,7 +276,7 @@ void nuc_lowputc(uint32_t ch)
#ifdef HAVE_SERIAL_CONSOLE
/* Wait for the TX FIFO to be empty (excessive!) */
- while ((getreg32(NUC_CONSOLE_BASE + NUC_UART_FSR_OFFSET) & UART_FSR_TX_EMPTY) != 0);
+ while ((getreg32(NUC_CONSOLE_BASE + NUC_UART_FSR_OFFSET) & UART_FSR_TX_EMPTY) == 0);
/* Then write the character to to the TX FIFO */
@@ -331,15 +331,15 @@ void nuc_setbaud(uintptr_t base, uint32_t baud)
/* Check if the divxider exceeds the range */
- if (clksperbit > 0xffff)
+ if (brd > 0xffff)
{
/* Try to Set Divider X up 10 (MODE#1) */
regval &= ~UART_BAUD_DIV_X_ONE;
- for (divx = 8; divx <16; divx++)
+ for (divx = 8; divx < 16; divx++)
{
- brd = (clksperbit % (divx+1));
+ brd = (clksperbit % (divx + 1));
if (brd < 3)
{
regval &= ~UART_BAUD_DIVIDER_X_MASK;
@@ -357,4 +357,4 @@ void nuc_setbaud(uintptr_t base, uint32_t baud)
putreg32(regval, base + NUC_UART_BAUD_OFFSET);
}
-#endif /* HAVE_UART */ \ No newline at end of file
+#endif /* HAVE_UART */
diff --git a/nuttx/configs/nutiny-nuc120/README.txt b/nuttx/configs/nutiny-nuc120/README.txt
index ac43cbb6b..69cf3c2e0 100644
--- a/nuttx/configs/nutiny-nuc120/README.txt
+++ b/nuttx/configs/nutiny-nuc120/README.txt
@@ -95,19 +95,39 @@ LEDs
Serial Console
==============
-To be provided
+By default UART1 is used as the serial console on these boards. NUC120LE3AN
+is provided as an LQFP48 package and, for this case, the UART1 RX signal
+(RXD1) is on PB.4, pin 8, and the TX signal (TXD1) is on PB.5, pin 9.
+These pins are available on the NuTiny-SDC-NUC120 JP5.
+
+ NOTE: The TX vs RX terminology is confusing. On my RS-232 driver board,
+ I need to connect the NUC120 TXD0 pin to the driver boards RXD pin. How
+ confusing!
+
+UART0 is an alternative that can be selected by modifying the default
+configuation. UART0 RX (RXD0) is on PB.0, pin 17, and the TX signal (TXD0)
+is on PB.1, pin 18. These pins are available on the NuTiny-SDC-NUC120 JP1.
+
+ NOTE: PB.0, pin 17, is also used to control the user LED on board (labeled
+ "IO"). CONFIG_ARCH_LED should not be selected if UART0 is used.
+
+The NUC120LE3AN does not support UART2.
Debugging
=========
The NuTiny-SDK-NUC120 includes a built-in NuLink debugger. Unfortunately,
full debug support is available only with the Keil and IAR toolchains.
-There is, however, a free program call call ICP (In-Circuit Programmer).
-It can be used to burn programs into FLASH (aka APROM).
+There is, however, a free program called ICP (In-Circuit Programmer). It
+can be used to burn programs into FLASH (aka APROM).
The ICP program can also be used to burn an ISP program into LDROM. The
ISP (In-System Programmer) is available free from the Nuvton website.
+Then NuttX build does not set the configuration words at 0x0030000-0x00300004.
+You should uncheck the Config box when burning APROM or the previous contents
+of the configuration words will be erased.
+
NuTiny-specific Configuration Options
=====================================
@@ -179,7 +199,9 @@ NuTiny-specific Configuration Options
the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
the delay actually is 100 seconds.
- Individual subsystems can be enabled:
+ Individual subsystems can be enabled as follows. These settings are for
+ all of the NUC100/120 line and may not be available for the NUC120LE3AN
+ in particular:
AHB
---
@@ -226,13 +248,14 @@ NuTiny-specific Configuration Options
NUC1XX specific device driver settings
- CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn (n=0,1,2) for the
- console and ttys0 (default is the USART0).
+ CONFIG_UARTn_SERIAL_CONSOLE - Selects the UARTn (n=0,1,2) for the
+ console and ttys0.
CONFIG_UARTn_RXBUFSIZE - Characters are buffered as received.
- This specific the size of the receive buffer
+ This specific the size of the receive buffer for UARTn.
CONFIG_UARTn_TXBUFSIZE - Characters are buffered before
being sent. This specific the size of the transmit buffer
- CONFIG_UARTn_BAUD - The configure BAUD of the UART. Must be
+ for UARTn.
+ CONFIG_UARTn_BAUD - The configure BAUD of UARTn,
CONFIG_UARTn_BITS - The number of bits. Must be 5, 6, 7, or 8.
CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
CONFIG_UARTn_2STOP - Two stop bits
@@ -277,12 +300,17 @@ Where <subdir> is one of the following:
CONFIG_WINDOWS_CYGWIN=y : Using Cygwin
CONFIG_ARMV6M_TOOLCHAIN_CODESOURCERYW=y : CodeSourcery for Windows
+ 3. Serial Console. The serial console is on UART1 which is available
+ on JP5:
+
+ UART1 RX signal (RXD1) is on PB.4, pin 8, and
+ UART1 TX signal (TXD1) is on PB.5, pin 9.
+
nsh:
---
Configures the NuttShell (nsh) located at apps/examples/nsh. The
- Configuration enables the serial interfaces on UART0. Support for
- builtin applications is enabled, but in the base configuration no
- builtin applications are selected (see NOTES below).
+ Configuration enables the serial interfaces on UART1. Support for
+ builtin applications is disabled.
NOTES:
@@ -303,7 +331,13 @@ Where <subdir> is one of the following:
CONFIG_WINDOWS_CYGWIN=y : Using Cygwin
CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y : CodeSourcery for Windows
- 3. This configuration includes USB Support (CDC/ACM device)
+ 3. Serial Console. The serial console is on UART1 which is available
+ on JP5:
+
+ UART1 RX signal (RXD1) is on PB.4, pin 8, and
+ UART1 TX signal (TXD1) is on PB.5, pin 9.
+
+ 4. This configuration includes USB Support (CDC/ACM device)
CONFIG_STM32_USB=y : STM32 USB device support
CONFIG_USBDEV=y : USB device support must be enabled
@@ -311,7 +345,7 @@ Where <subdir> is one of the following:
CONFIG_NSH_BUILTIN_APPS=y : NSH built-in application support must be enabled
CONFIG_NSH_ARCHINIT=y : To perform USB initialization
- The CDC/ACM example is included as two NSH "built-in" commands.\
+ The CDC/ACM example is included as two NSH "built-in" commands.
CONFIG_EXAMPLES_CDCACM=y : Enable apps/examples/cdcacm
diff --git a/nuttx/configs/nutiny-nuc120/include/board.h b/nuttx/configs/nutiny-nuc120/include/board.h
index 14842db86..47b43c044 100644
--- a/nuttx/configs/nutiny-nuc120/include/board.h
+++ b/nuttx/configs/nutiny-nuc120/include/board.h
@@ -85,13 +85,13 @@
/* HCLK. FOUT is the HCLK source clock. */
-#define BOARD_HCLK_N 0
-#define BOARD_HCLK_FREQUENCY (BOARD_PLL_FOUT / (BOARD_HCLK_N + 1))
+#define BOARD_HCLK_N 1
+#define BOARD_HCLK_FREQUENCY (BOARD_PLL_FOUT / BOARD_HCLK_N)
/* USB. FOUT is the source. The USB CLK must be 48MHz */
-#define BOARD_USB_N 0
-#define BOARD_USB_FREQUENCY (BOARD_PLL_FOUT / (BOARD_USB_N + 1))
+#define BOARD_USB_N 1
+#define BOARD_USB_FREQUENCY (BOARD_PLL_FOUT / BOARD_USB_N)
/* LED definitions ******************************************************************/
/* The NuTiny has a single green LED that can be controlled from sofware. This LED
diff --git a/nuttx/configs/nutiny-nuc120/ostest/defconfig b/nuttx/configs/nutiny-nuc120/ostest/defconfig
index 1c068001d..81d3f3eec 100644
--- a/nuttx/configs/nutiny-nuc120/ostest/defconfig
+++ b/nuttx/configs/nutiny-nuc120/ostest/defconfig
@@ -156,8 +156,8 @@ CONFIG_ARCH_NUC_MEDIUMDENSITY=y
# CONFIG_NUC_PWM5 is not set
# CONFIG_NUC_PWM6 is not set
# CONFIG_NUC_PWM7 is not set
-CONFIG_NUC_UART0=y
-# CONFIG_NUC_UART1 is not set
+# CONFIG_NUC_UART0 is not set
+CONFIG_NUC_UART1=y
# CONFIG_NUC_USBD is not set
# CONFIG_NUC_ACMP is not set
# CONFIG_NUC_ADC is not set
@@ -311,20 +311,20 @@ CONFIG_DEV_NULL=y
CONFIG_SERIAL=y
CONFIG_DEV_LOWCONSOLE=y
# CONFIG_16550_UART is not set
-CONFIG_ARCH_HAVE_UART0=y
+CONFIG_ARCH_HAVE_UART1=y
CONFIG_MCU_SERIAL=y
-CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=y
# CONFIG_NO_SERIAL_CONSOLE is not set
#
-# UART0 Configuration
+# UART1 Configuration
#
-CONFIG_UART0_RXBUFSIZE=256
-CONFIG_UART0_TXBUFSIZE=256
-CONFIG_UART0_BAUD=115200
-CONFIG_UART0_BITS=8
-CONFIG_UART0_PARITY=0
-CONFIG_UART0_2STOP=0
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART1_BAUD=115200
+CONFIG_UART1_BITS=8
+CONFIG_UART1_PARITY=0
+CONFIG_UART1_2STOP=0
# CONFIG_USBDEV is not set
# CONFIG_USBHOST is not set
# CONFIG_WIRELESS is not set
diff --git a/nuttx/drivers/usbdev/Kconfig b/nuttx/drivers/usbdev/Kconfig
index f8e21c143..4c8e888bb 100644
--- a/nuttx/drivers/usbdev/Kconfig
+++ b/nuttx/drivers/usbdev/Kconfig
@@ -3,7 +3,7 @@
# see misc/tools/kconfig-language.txt.
#
-menu "Device Controller Driver Options"
+comment "USB Device Controller Driver Options"
config USBDEV_ISOCHRONOUS
bool "Enable isochronous"
@@ -98,9 +98,9 @@ bool "Decode device controller events"
extern const struct trace_msg_t g_usb_trace_strings_intdecode[];
#endif
-endmenu
+comment "USB Device Class Driver Options"
-menuconfig USBDEV_COMPOSITE
+config USBDEV_COMPOSITE
bool "USB composite device support"
default n
---help---
@@ -162,7 +162,7 @@ config COMPOSITE_VERSIONNO
Interface version number.
endif
-menuconfig PL2303
+config PL2303
bool "Prolific PL2303 serial/USB converter emulation"
default n
select SERIAL_REMOVABLE
@@ -235,7 +235,7 @@ config PL2303_PRODUCTSTR
default "PL2303 Emulation"
endif
-menuconfig CDCACM
+config CDCACM
bool "USB Modem (CDC ACM) support"
default n
select SERIAL_REMOVABLE
@@ -400,7 +400,7 @@ config CDCACM_PRODUCTSTR
default "CDC/ACM Serial"
endif
-menuconfig USBMSC
+config USBMSC
bool "USB Mass storage class device"
default n
---help---