Add LPCXpression SD card support
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3508 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
8fe277d601
commit
89727f2075
@ -1,14 +1,14 @@
|
|||||||
README
|
README
|
||||||
^^^^^^
|
^^^^^^
|
||||||
|
|
||||||
README for NuttX port to the Embedded Artists' LPCXpresso base board with
|
README for NuttX port to the Embedded Artists' base board with the NXP
|
||||||
the LPCXpresso daughter board.
|
the LPCXpresso daughter board.
|
||||||
|
|
||||||
Contents
|
Contents
|
||||||
^^^^^^^^
|
^^^^^^^^
|
||||||
|
|
||||||
LCPXpresso LPC1768 Board
|
LCPXpresso LPC1768 Board
|
||||||
Jumpers
|
Embedded Artist's Base Board
|
||||||
Development Environment
|
Development Environment
|
||||||
GNU Toolchain Options
|
GNU Toolchain Options
|
||||||
NuttX buildroot Toolchain
|
NuttX buildroot Toolchain
|
||||||
@ -98,13 +98,34 @@ LCPXpresso LPC1768 Board
|
|||||||
P4[28]/RX-MCLK/MAT2.0/TXD3 PAD15 N/A
|
P4[28]/RX-MCLK/MAT2.0/TXD3 PAD15 N/A
|
||||||
P4[29]/TX-MCLK/MAT2.1/RXD3 PAD16 N/A
|
P4[29]/TX-MCLK/MAT2.1/RXD3 PAD16 N/A
|
||||||
|
|
||||||
|
Embedded Artist's Base Board
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Jumpers
|
Jumpers
|
||||||
^^^^^^^
|
-------
|
||||||
|
|
||||||
There are many jumpers on the base board. A usable combination is the
|
There are many jumpers on the base board. A usable combination is the
|
||||||
default jumper settings WITH the two J54 jumpers both removed. Those
|
default jumper settings WITH the two J54 jumpers both removed. Those
|
||||||
jumpers are for ISP support and will cause the board to reset.
|
jumpers are for ISP support and will cause the board to reset.
|
||||||
|
|
||||||
|
To use the SD, J55 must be set to provide chip select PIO1_11 signal as
|
||||||
|
the SD slot chip select.
|
||||||
|
|
||||||
|
SD Slot
|
||||||
|
-------
|
||||||
|
|
||||||
|
Base-board J4/J6 LPC1768
|
||||||
|
SD Signal Pin Pin
|
||||||
|
--- ----------- ----- --------
|
||||||
|
CS PIO1_11* 55 P2.2
|
||||||
|
DIN PIO0_9-MOSI 5 P0.9 MOSI1
|
||||||
|
DOUT PIO0_8-MISO 6 P0.8 MISO1
|
||||||
|
CLK PIO2_11-SCK 7 P0.9 SCK1
|
||||||
|
CD PIO2_10 52 P2.11
|
||||||
|
|
||||||
|
*J55 must be set to provide chip select PIO1_11 signal as the SD slot
|
||||||
|
chip select.
|
||||||
|
|
||||||
Development Environment
|
Development Environment
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ CONFIG_LPC17_CAN1=n
|
|||||||
CONFIG_LPC17_CAN2=n
|
CONFIG_LPC17_CAN2=n
|
||||||
CONFIG_LPC17_SPI=n
|
CONFIG_LPC17_SPI=n
|
||||||
CONFIG_LPC17_SSP0=n
|
CONFIG_LPC17_SSP0=n
|
||||||
CONFIG_LPC17_SSP1=n
|
CONFIG_LPC17_SSP1=y
|
||||||
CONFIG_LPC17_I2C0=n
|
CONFIG_LPC17_I2C0=n
|
||||||
CONFIG_LPC17_I2C1=n
|
CONFIG_LPC17_I2C1=n
|
||||||
CONFIG_LPC17_I2S=n
|
CONFIG_LPC17_I2S=n
|
||||||
@ -332,7 +332,6 @@ CONFIG_HAVE_LIBM=n
|
|||||||
CONFIG_DEBUG=n
|
CONFIG_DEBUG=n
|
||||||
CONFIG_DEBUG_VERBOSE=n
|
CONFIG_DEBUG_VERBOSE=n
|
||||||
CONFIG_DEBUG_SYMBOLS=n
|
CONFIG_DEBUG_SYMBOLS=n
|
||||||
CONFIG_DEBUG_USB=n
|
|
||||||
CONFIG_MM_REGIONS=2
|
CONFIG_MM_REGIONS=2
|
||||||
CONFIG_ARCH_LOWPUTC=y
|
CONFIG_ARCH_LOWPUTC=y
|
||||||
CONFIG_RR_INTERVAL=200
|
CONFIG_RR_INTERVAL=200
|
||||||
@ -836,7 +835,7 @@ CONFIG_NSH_FATMOUNTPT=/tmp
|
|||||||
#
|
#
|
||||||
# Architecture-specific NSH options
|
# Architecture-specific NSH options
|
||||||
#
|
#
|
||||||
CONFIG_NSH_MMCSDSPIPORTNO=0
|
CONFIG_NSH_MMCSDSPIPORTNO=1
|
||||||
CONFIG_NSH_MMCSDSLOTNO=0
|
CONFIG_NSH_MMCSDSLOTNO=0
|
||||||
CONFIG_NSH_MMCSDMINOR=0
|
CONFIG_NSH_MMCSDMINOR=0
|
||||||
|
|
||||||
|
@ -780,7 +780,7 @@ CONFIG_NSH_FATMOUNTPT=/tmp
|
|||||||
#
|
#
|
||||||
# Architecture-specific NSH options
|
# Architecture-specific NSH options
|
||||||
#
|
#
|
||||||
CONFIG_NSH_MMCSDSPIPORTNO=0
|
CONFIG_NSH_MMCSDSPIPORTNO=1
|
||||||
CONFIG_NSH_MMCSDSLOTNO=0
|
CONFIG_NSH_MMCSDSLOTNO=0
|
||||||
CONFIG_NSH_MMCSDMINOR=0
|
CONFIG_NSH_MMCSDMINOR=0
|
||||||
|
|
||||||
|
@ -39,9 +39,11 @@ CFLAGS += -I$(TOPDIR)/sched
|
|||||||
|
|
||||||
ASRCS =
|
ASRCS =
|
||||||
CSRCS = up_boot.c up_leds.c up_ssp.c
|
CSRCS = up_boot.c up_leds.c up_ssp.c
|
||||||
|
|
||||||
ifeq ($(CONFIG_NSH_ARCHINIT),y)
|
ifeq ($(CONFIG_NSH_ARCHINIT),y)
|
||||||
CSRCS += up_nsh.c
|
CSRCS += up_nsh.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_USBSTRG),y)
|
ifeq ($(CONFIG_USBSTRG),y)
|
||||||
CSRCS += up_usbstrg.c
|
CSRCS += up_usbstrg.c
|
||||||
endif
|
endif
|
||||||
|
@ -134,6 +134,25 @@
|
|||||||
* P4[28]/RX-MCLK/MAT2.0/TXD3 PAD15 N/A
|
* P4[28]/RX-MCLK/MAT2.0/TXD3 PAD15 N/A
|
||||||
* P4[29]/TX-MCLK/MAT2.1/RXD3 PAD16 N/A
|
* P4[29]/TX-MCLK/MAT2.1/RXD3 PAD16 N/A
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* SD Slot
|
||||||
|
*
|
||||||
|
* Base-board J4/J6 LPC1768
|
||||||
|
* SD Signal Pin Pin
|
||||||
|
* --- ----------- ----- --------
|
||||||
|
* CS PIO1_11* 55 P2.2 (See GPIO_SD_CS)
|
||||||
|
* DIN PIO0_9-MOSI 5 P0.9 MOSI1 (See GPIO_SSP1_MOSI in lpc17_internal.h)
|
||||||
|
* DOUT PIO0_8-MISO 6 P0.8 MISO1 (See GPIO_SSP1_MISO in lpc17_internal.h)
|
||||||
|
* CLK PIO2_11-SCK 7 P0.9 SCK1 (See GPIO_SSP1_SCK in board.h)
|
||||||
|
* CD PIO2_10 52 P2.11 (See GPIO_SD_CD)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define GPIO_SD_CS (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT2 | GPIO_PIN2)
|
||||||
|
#ifdef CONFIG_GPIO_IRQ
|
||||||
|
# define GPIO_SD_CD (GPIO_INTBOTH | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN11)
|
||||||
|
#else
|
||||||
|
# define GPIO_SD_CD (GPIO_INPUT | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN11)
|
||||||
|
#endif
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Public Types
|
* Public Types
|
||||||
|
@ -57,8 +57,8 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_ARCH_BOARD_LPCXPRESSO
|
#ifdef CONFIG_ARCH_BOARD_LPCXPRESSO
|
||||||
# define CONFIG_NSH_HAVEUSBDEV 1
|
# define CONFIG_NSH_HAVEUSBDEV 1
|
||||||
# ifdef CONFIG_LPC17_SSP0
|
# ifdef CONFIG_LPC17_SSP1
|
||||||
# define CONFIG_NSH_HAVEMMCSD 1
|
# define CONFIG_NSH_HAVEMMCSD 1
|
||||||
# else
|
# else
|
||||||
# undef CONFIG_NSH_HAVEMMCSD
|
# undef CONFIG_NSH_HAVEMMCSD
|
||||||
# endif
|
# endif
|
||||||
@ -71,13 +71,13 @@
|
|||||||
/* Do we have SPI support for MMC/SD? */
|
/* Do we have SPI support for MMC/SD? */
|
||||||
|
|
||||||
#ifdef CONFIG_NSH_HAVEMMCSD
|
#ifdef CONFIG_NSH_HAVEMMCSD
|
||||||
# if !defined(CONFIG_NSH_MMCSDSPIPORTNO) || CONFIG_NSH_MMCSDSPIPORTNO != 0
|
# if !defined(CONFIG_NSH_MMCSDSPIPORTNO) || CONFIG_NSH_MMCSDSPIPORTNO != 1
|
||||||
# error "The LPCXpresso MMC/SD is on SSP0"
|
# error "The LPCXpresso MMC/SD is on SSP1"
|
||||||
# undef CONFIG_NSH_MMCSDSPIPORTNO
|
# undef CONFIG_NSH_MMCSDSPIPORTNO
|
||||||
# define CONFIG_NSH_MMCSDSPIPORTNO 0
|
# define CONFIG_NSH_MMCSDSPIPORTNO 1
|
||||||
# endif
|
# endif
|
||||||
# if !defined(CONFIG_NSH_MMCSDSLOTNO) || CONFIG_NSH_MMCSDSLOTNO != 0
|
# if !defined(CONFIG_NSH_MMCSDSLOTNO) || CONFIG_NSH_MMCSDSLOTNO != 0
|
||||||
# error "The LPCXpresso MMC/SD is only one slot (0)"
|
# error "The LPCXpresso MMC/SD has only one slot (0)"
|
||||||
# undef CONFIG_NSH_MMCSDSLOTNO
|
# undef CONFIG_NSH_MMCSDSLOTNO
|
||||||
# define CONFIG_NSH_MMCSDSLOTNO 0
|
# define CONFIG_NSH_MMCSDSLOTNO 0
|
||||||
# endif
|
# endif
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* configs/lpcxpresso-lpc1768/src/up_ssp.c
|
* configs/lpcxpresso-lpc1768/src/up_ssp.c
|
||||||
* arch/arm/src/board/up_ssp.c
|
* arch/arm/src/board/up_ssp.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -107,7 +107,16 @@ void weak_function lpc17_sspinitialize(void)
|
|||||||
/* Configure the SPI-based microSD CS GPIO */
|
/* Configure the SPI-based microSD CS GPIO */
|
||||||
|
|
||||||
ssp_dumpgpio("lpc17_sspinitialize() Entry)");
|
ssp_dumpgpio("lpc17_sspinitialize() Entry)");
|
||||||
#warning "Configure chip selects here"
|
|
||||||
|
/* Configure card detect and chip select for the SD slot. NOTE: Jumper J55 must
|
||||||
|
* be set correctly for the SD slot chip select.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef CONFIG_LPC17_SSP1
|
||||||
|
(void)lpc17_configgpio(GPIO_SD_CS);
|
||||||
|
(void)lpc17_configgpio(GPIO_SD_CD);
|
||||||
|
#endif
|
||||||
|
|
||||||
ssp_dumpgpio("lpc17_sspinitialize() Exit");
|
ssp_dumpgpio("lpc17_sspinitialize() Exit");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,11 +149,11 @@ void weak_function lpc17_sspinitialize(void)
|
|||||||
void lpc17_ssp0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
void lpc17_ssp0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
||||||
{
|
{
|
||||||
sspdbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
sspdbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||||
ssp_dumpgpio("lpc17_spiselect() Entry");
|
ssp_dumpgpio("lpc17_spi0select() Entry");
|
||||||
|
|
||||||
#warning "Assert CS here (false)"
|
#warning "Assert CS here (false)"
|
||||||
|
|
||||||
ssp_dumpgpio("lpc17_spiselect() Exit");
|
ssp_dumpgpio("lpc17_spi0select() Exit");
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t lpc17_ssp0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
uint8_t lpc17_ssp0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||||
@ -155,7 +164,37 @@ uint8_t lpc17_ssp0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_LPC17_SSP1
|
#ifdef CONFIG_LPC17_SSP1
|
||||||
# warning "SSP1 chip selects not known"
|
void lpc17_ssp1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
||||||
|
{
|
||||||
|
sspdbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||||
|
ssp_dumpgpio("lpc17_spi1select() Entry");
|
||||||
|
|
||||||
|
if (devid == SPIDEV_MMCSD)
|
||||||
|
{
|
||||||
|
/* Assert/de-assert the CS pin to the card */
|
||||||
|
|
||||||
|
(void)lpc17_gpiowrite(GPIO_SD_CS, !selected);
|
||||||
|
}
|
||||||
|
|
||||||
|
ssp_dumpgpio("lpc17_spi1select() Exit");
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t lpc17_ssp1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||||
|
{
|
||||||
|
if (devid == SPIDEV_MMCSD)
|
||||||
|
{
|
||||||
|
/* Read the state of the card-detect bit */
|
||||||
|
|
||||||
|
if (lpc17_gpioread(GPIO_SD_CD) == 0)
|
||||||
|
{
|
||||||
|
sspdbg("Returning SPI_STATUS_PRESENT\n");
|
||||||
|
return SPI_STATUS_PRESENT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sspdbg("Returning zero\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* CONFIG_LPC17_SSP0 || CONFIG_LPC17_SSP1 */
|
#endif /* CONFIG_LPC17_SSP0 || CONFIG_LPC17_SSP1 */
|
||||||
|
Loading…
Reference in New Issue
Block a user