LPCXpression console on UART3

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3497 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2011-04-13 03:12:51 +00:00
parent 993cb7d700
commit 1526b63f26
5 changed files with 65 additions and 78 deletions

View File

@ -23,7 +23,7 @@ LCPXpresso LPC1768 Board
-------------------------------- --------- -------------- ---------------------
P0[0]/RD1/TXD3/SDA1 J6-9 I2C E2PROM SDA TXD3/SDA1
P0[1]/TD1/RXD3/SCL J6-10 RXD2/SCL1
P0[1]/TD1/RXD3/SCL J6-10 RXD3/SCL1
P0[2]/TXD0/AD0[7] J6-21
P0[3]/RXD0/AD0[6] J6-22
P0[4]/I2SRX-CLK/RD2/CAP2.0 J6-38 CAN_RX2
@ -45,7 +45,7 @@ LCPXpresso LPC1768 Board
P0[23]/AD0[0]/I2SRX_CLK/CAP3[0] J6-15 AD0.0
P0[24]/AD0[1]/I2SRX_WS/CAP3[1] J6-16 AD0.1
P0[25]/AD0[2]/I2SRX_SDA/TXD3 J6-17 AD0.2
P0[26]/AD0[3]/AOUT/RXD3 J6-18 AD0.3/AOUT
P0[26]/AD0[3]/AOUT/RXD3 J6-18 AD0.3/AOUT / RGB LED
P0[27]/SDA0/USB_SDA J6-25
P0[28]/SCL0 J6-26
P0[29]/USB_D+ J6-37 USB_D+
@ -76,8 +76,8 @@ LCPXpresso LPC1768 Board
P1[30]/VBUS/AD0[4] J6-19 AD0.4
P1[31]/SCK1/AD0[5] J6-20 AD0.5
P2[0]/PWM1.1/TXD1 J6-42 PWM1.1
P2[1]/PWM1.2/RXD1 J6-43 PWM1.2
P2[0]/PWM1.1/TXD1 J6-42 PWM1.1 / RGB LED / RS422 RX
P2[1]/PWM1.2/RXD1 J6-43 PWM1.2 / OLED voltage / RGB LED
P2[2]/PWM1.3/CTS1/TRACEDATA[3] J6-44 PWM1.3
P2[3]/PWM1.4/DCD1/TRACEDATA[2] J6-45 PWM1.4
P2[4]/PWM1.5/DSR1/TRACEDATA[1] J6-46 PWM1.5
@ -321,44 +321,30 @@ LEDs
- configs/lpcxpresso-lpc1768/src/up_leds.c - LED control logic.
The LPCXpresso has 3 LEDs... two on the Babel CAN board and a "heartbeat" LED."
The LEDs on the Babel CAN board are capabl of OFF/GREEN/RED/AMBER status.
In normal usage, the two LEDs on the Babel CAN board would show CAN status, but if
CONFIG_ARCH_LEDS is defined, these LEDs will be controlled as follows for NuttX
debug functionality (where NC means "No Change").
The LPCXpresso LPC1768 has a single LEDs (there are more on the Embedded Artists
base board, but those are not controlled by NuttX). Usage this single LED by NuttX
is as follows:
During the boot phases. LED1 and LED2 will show boot status.
- The LED is not illuminated until the LPCXpresso completes initialization.
If the LED is stuck in the OFF state, this means that the LPCXpresso did not
complete intialization.
/* LED1 LED2 HEARTBEAT */
#define LED_STARTED 0 /* OFF OFF OFF */
#define LED_HEAPALLOCATE 1 /* GREEN OFF OFF */
#define LED_IRQSENABLED 2 /* OFF GREEN OFF */
#define LED_STACKCREATED 3 /* OFF OFF OFF */
- Each time the OS enters an interrupt (or a signal) it will turn the LED OFF and
restores its previous stated upon return from the interrupt (or signal).
#define LED_INIRQ 4 /* NC NC ON (momentary) */
#define LED_SIGNAL 5 /* NC NC ON (momentary) */
#define LED_ASSERTION 6 /* NC NC ON (momentary) */
#define LED_PANIC 7 /* NC NC ON (0.5Hz flashing) */
#undef LED_IDLE /* Sleep mode indication not supported */
The normal state, after initialization will be a dull glow. The brightness of
the glow will be inversely related to the proportion of time spent within interrupt
handling logic. The glow may decrease in brightness when the system is very
busy handling device interrupts and increase in brightness as the system becomes
idle.
After the system is booted, this logic will no longer use LEDs 1 and 2. They
are then available for use the application software using lpc17_led1() and
lpc17_led2():
Stuck in the OFF state suggests that that the system never completed
initialization; Stuck in the ON state would indicated that the system
intialialized, but is not takint interrupts.
enum lpc17_ledstate_e
{
LPC17_LEDSTATE_OFF = 0,
LPC17_LEDSTATE_GREEN = 1,
LPC17_LEDSTATE_RED = 2,
LPC17_LEDSTATE_AMBER = (LPC17_LEDSTATE_GREEN|LPC17_LEDSTATE_RED),
};
EXTERN void lpc17_led1(enum lpc17_ledstate_e state);
EXTERN void lpc17_led2(enum lpc17_ledstate_e state);
The heartbeat LED is illuminated during all interrupt and signal procressing.
Normally, it will glow dimly to inicate that the LPC17xx is taking interrupts.
On an assertion PANIC, it will flash at 1Hz.
- If a fatal assertion or a fatal unhandled exception occurs, the LED will flash
strongly as a slow, 1Hz rate.
LPCXpresso Configuration Options
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -146,7 +146,7 @@
/* Pin Description Connector On Board Base Board
* -------------------------------- --------- -------------- ---------------------
* P0[0]/RD1/TXD3/SDA1 J6-9 I2C E2PROM SDA TXD3/SDA1
* P0[1]/TD1/RXD3/SCL J6-10 RXD2/SCL1
* P0[1]/TD1/RXD3/SCL J6-10 RXD3/SCL1
* P0[2]/TXD0/AD0[7] J6-21
* P0[3]/RXD0/AD0[6] J6-22
* P0[4]/I2SRX-CLK/RD2/CAP2.0 J6-38 CAN_RX2
@ -168,14 +168,16 @@
* P0[23]/AD0[0]/I2SRX_CLK/CAP3[0] J6-15 AD0.0
* P0[24]/AD0[1]/I2SRX_WS/CAP3[1] J6-16 AD0.1
* P0[25]/AD0[2]/I2SRX_SDA/TXD3 J6-17 AD0.2
* P0[26]/AD0[3]/AOUT/RXD3 J6-18 AD0.3/AOUT
* P0[26]/AD0[3]/AOUT/RXD3 J6-18 AD0.3/AOUT / RGB LED
* P0[27]/SDA0/USB_SDA J6-25
* P0[28]/SCL0 J6-26
* P0[29]/USB_D+ J6-37 USB_D+
* P0[30]/USB_D- J6-36 USB_D-
*/
#define GPIO_UART3_TXD GPIO_UART3_TXD_1
#define GPIO_I2C1_SDA GPIO_I2C1_SDA_1
#define GPIO_UART3_RXD GPIO_UART3_RXD_1
#define GPIO_I2C1_SCL GPIO_I2C1_SCL_1
#define GPIO_SSP1_SCK GPIO_SSP1_SCK_1
#define GPIO_UART2_TXD GPIO_UART2_TXD_1
@ -216,8 +218,8 @@
#define GPIO_ENET_MDC GPIO_ENET_MDC_1
#define GPIO_ENET_MDIO GPIO_ENET_MDIO_1
/* P2[0]/PWM1.1/TXD1 J6-42 PWM1.1
* P2[1]/PWM1.2/RXD1 J6-43 PWM1.2
/* P2[0]/PWM1.1/TXD1 J6-42 PWM1.1 / RGB LED / RS422 RX
* P2[1]/PWM1.2/RXD1 J6-43 PWM1.2 / RGB LED / RS422 RX
* P2[2]/PWM1.3/CTS1/TRACEDATA[3] J6-44 PWM1.3
* P2[3]/PWM1.4/DCD1/TRACEDATA[2] J6-45 PWM1.4
* P2[4]/PWM1.5/DSR1/TRACEDATA[1] J6-46 PWM1.5

View File

@ -108,10 +108,10 @@ CONFIG_LPC17_ETHERNET=y
CONFIG_LPC17_USBHOST=n
CONFIG_LPC17_USBOTG=n
CONFIG_LPC17_USBDEV=n
CONFIG_LPC17_UART0=y
CONFIG_LPC17_UART0=n
CONFIG_LPC17_UART1=n
CONFIG_LPC17_UART2=n
CONFIG_LPC17_UART3=n
CONFIG_LPC17_UART3=y
CONFIG_LPC17_CAN1=n
CONFIG_LPC17_CAN2=n
CONFIG_LPC17_SPI=n
@ -148,10 +148,10 @@ CONFIG_LPC17_GPDMA=n
# CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
# CONFIG_UARTn_2STOP - Two stop bits
#
CONFIG_UART0_SERIAL_CONSOLE=y
CONFIG_UART0_SERIAL_CONSOLE=n
CONFIG_UART1_SERIAL_CONSOLE=n
CONFIG_UART2_SERIAL_CONSOLE=n
CONFIG_UART3_SERIAL_CONSOLE=n
CONFIG_UART3_SERIAL_CONSOLE=y
CONFIG_UART0_TXBUFSIZE=256
CONFIG_UART1_TXBUFSIZE=256

View File

@ -108,10 +108,10 @@ CONFIG_LPC17_ETHERNET=n
CONFIG_LPC17_USBHOST=n
CONFIG_LPC17_USBOTG=n
CONFIG_LPC17_USBDEV=n
CONFIG_LPC17_UART0=y
CONFIG_LPC17_UART0=n
CONFIG_LPC17_UART1=n
CONFIG_LPC17_UART2=n
CONFIG_LPC17_UART3=n
CONFIG_LPC17_UART3=y
CONFIG_LPC17_CAN1=n
CONFIG_LPC17_CAN2=n
CONFIG_LPC17_SPI=n
@ -148,10 +148,10 @@ CONFIG_LPC17_GPDMA=n
# CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
# CONFIG_UARTn_2STOP - Two stop bits
#
CONFIG_UART0_SERIAL_CONSOLE=y
CONFIG_UART0_SERIAL_CONSOLE=n
CONFIG_UART1_SERIAL_CONSOLE=n
CONFIG_UART2_SERIAL_CONSOLE=n
CONFIG_UART3_SERIAL_CONSOLE=n
CONFIG_UART3_SERIAL_CONSOLE=y
CONFIG_UART0_TXBUFSIZE=256
CONFIG_UART1_TXBUFSIZE=256

View File

@ -44,34 +44,32 @@ echo " - LPC17xx"
echo ""
echo "You will need to edit this is any of the above are false"
# This is the default install location for binaries on Linux
#BINDIR=/usr/local/LPCXpresso/bin/dfu-util
# This is the default install location for binaries on Windows (note that this
# path could change with the Code Red version number
BINDIR=/cygdrive/c/nxp/lpcxpresso_3.6/bin
# path could change with the Code Red version number)
BINDIR="/cygdrive/c/nxp/lpcxpresso_3.6/bin"
if [ ! -d "${BINDIR}" ]; then
echo "Directory ${BINDIR} does not exist"
exit 1
fi
# This is the default install location for DFUAPP.exe on Windows
DFUAPP="$BINDIR/DFUAPP.exe"
# This is the relative path to the booLPCXpresso utility
BOOTLPC="Scripts/bootLPCXpresso.cmd"
if [ ! -x "${BINDIR}/$BOOTLPC" ]; then
echo "No executable at ${BINDIR}/${BOOTLPC}"
exit 1
fi
# ROM image for resetting LPC-Link
# ROM=LPCXpressoWIN.enc # WinUSB
# ROM=LPCXpressoFS.enc # Win2000
# ROM=LPCXpressoFS.enc # WinXP
# ROM=LPCXpressoFS.enc # Win2003
# ROM=LPCXpressoHS.enc # WinVista
ROM=LPCXpressoHS.enc # Win7
# BOOTLPC_ARG=winusb # WinXP
BOOTLPC_ARG=hid # Win7
ROMPATH=`cygpath -w "$BINDIR/$ROM"`
# FLASHUTIL="crt_emu_lpc11_13" # for LPC11xx or LPC13xx parts)
FLASHUTIL="crt_emu_cm3_nxp" # for LPC17xx parts
# FLASHUTIL="crt_emu_a7_nxp" # for LPC21/22/23/24 parts)
# FLASHUTIL="crt_emu_a9_nxp" # for LPC31/32 and LPC29xx parts)
# FLASHUTIL="crt_emu_cm3_lmi" # for TI Stellaris LM3S parts
# FLASHUTIL="$BINDIR/crt_emu_lpc11_13" # for LPC11xx or LPC13xx parts)
FLASHUTIL="$BINDIR/crt_emu_cm3_nxp" # for LPC17xx parts
# FLASHUTIL="$BINDIR/crt_emu_a7_nxp" # for LPC21/22/23/24 parts)
# FLASHUTIL="$BINDIR/crt_emu_a9_nxp" # for LPC31/32 and LPC29xx parts)
# FLASHUTIL="$BINDIR/crt_emu_cm3_lmi" # for TI Stellaris LM3S parts
if [ ! -x "$FLASHUTIL" ]; then
echo "No executable file at ${FLASHUTIL}"
if [ ! -x "${BINDIR}/${FLASHUTIL}" ]; then
echo "No executable file at ${BINDIR}/${FLASHUTIL}"
exit 1
fi
@ -79,10 +77,9 @@ fi
# WIRE="-wire=hi" # for RDB1768v2 without upgraded firmware)
# WIRE="-wire=winusb" # for RDB1768v2 with upgraded firmware)
# WIRE="-wire=winusb" # for LPC-Link on Windows XP)
WIRE="-wire=hid" # for LPC-Link on Windows Vista/ Windows 7)
WIRE="-wire=hid" # for LPC-Link on Windows Vista/Windows 7)
TARGET=LPC1768
#TARGET=NXP_dir_part_LPC17
# The nuttx directory must be provided as an argument
@ -115,13 +112,15 @@ else
mv ${NUTTX}/nuttx ${NUTTX}/nuttx.axf
fi
fi
NUTTXPATH=`cygpath -w "${NUTTX}/nuttx.axf"`
# First of all boot the LPC-Link using the script:
#${DFUAPP} /f ${ROMPATH} /tl 250 dfuapp.log
cd ${BINDIR} || \
{ echo "Failed to CD to ${BINDIR}"; exit 1; }
./${BOOTLPC} ${BOOTLPC_ARG} || \
{ echo "'${BOOTLPC} ${BOOTLPC_ARG}' Failed"; }
# Then program the FLASH
#${FLASHUTIL} ${WIRE} -p${TARGET} -flash-load="${NUTTX}/nuttx.axf"
${FLASHUTIL} -p${TARGET} -flash-load="${NUTTX}/nuttx.axf"
./${FLASHUTIL} ${WIRE} -p${TARGET} -flash-load-exec="${NUTTXPATH}"