summaryrefslogtreecommitdiff
path: root/nuttx/configs/pic32mx7mmb/src/up_nsh.c
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/configs/pic32mx7mmb/src/up_nsh.c')
-rw-r--r--nuttx/configs/pic32mx7mmb/src/up_nsh.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/nuttx/configs/pic32mx7mmb/src/up_nsh.c b/nuttx/configs/pic32mx7mmb/src/up_nsh.c
index 0d022531f..a9d26b6be 100644
--- a/nuttx/configs/pic32mx7mmb/src/up_nsh.c
+++ b/nuttx/configs/pic32mx7mmb/src/up_nsh.c
@@ -229,13 +229,13 @@ static int nsh_waiter(int argc, char *argv[])
#ifdef CONFIG_NSH_HAVEMMCSD
static int nsh_sdinitialize(void)
{
- FAR struct spi_dev_s *ssp;
+ FAR struct spi_dev_s *spi;
int ret;
/* Get the SPI port */
- ssp = up_spiinitialize(CONFIG_NSH_MMCSDSPIPORTNO);
- if (!ssp)
+ spi = up_spiinitialize(CONFIG_NSH_MMCSDSPIPORTNO);
+ if (!spi)
{
message("nsh_archinitialize: Failed to initialize SPI port %d\n",
CONFIG_NSH_MMCSDSPIPORTNO);
@@ -246,10 +246,19 @@ static int nsh_sdinitialize(void)
message("Successfully initialized SPI port %d\n",
CONFIG_NSH_MMCSDSPIPORTNO);
+ /* The SPI should be in 8-bit (default) and mode2: CKP=1, CKE=0.
+ * The MMC/SD driver will control the SPI frequency. WARNING:
+ * this is not the right way to do this... this should be done
+ * the MMC/SD driver: Other device on SPI1 may need other mode
+ * settings.
+ */
+
+ SPI_SETMODE(spi, SPIDEV_MODE2);
+
/* Bind the SPI port to the slot */
ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR,
- CONFIG_NSH_MMCSDSLOTNO, ssp);
+ CONFIG_NSH_MMCSDSLOTNO, spi);
if (ret < 0)
{
message("nsh_sdinitialize: "