freedom-k66f:Use SPI driver.
Initalize SPI1 on connector J6. No real use, as of yet.
This commit is contained in:
parent
fbea5abef0
commit
611612c6f2
|
@ -348,6 +348,24 @@
|
|||
#define PIN_I2C0_SCL PIN_I2C0_SCL_3
|
||||
#define PIN_I2C0_SDA PIN_I2C0_SDA_3
|
||||
|
||||
/* RF/WIFI
|
||||
*
|
||||
* J6 Pin Name K66 Name
|
||||
* ------ ----- ------ ---------
|
||||
* 1 GND
|
||||
* 2 P3V3
|
||||
* 3 CE PTB20 PTB20
|
||||
* 4 CS PTD4 SPI1_PCS0 (use as GPIO)
|
||||
* 5 SCK PTD5 SPI1_SCK
|
||||
* 6 MOSI PTD6 SPI1_MOSI
|
||||
* 7 MISO PTD7 SPI1_MISO
|
||||
* 8 IRQ PTC18 PTC18
|
||||
*/
|
||||
|
||||
#define PIN_SPI1_SCK PIN_SPI1_SCK_3
|
||||
#define PIN_SPI1_OUT PIN_SPI1_SOUT_3
|
||||
#define PIN_SPI1_SIN PIN_SPI1_SIN_3
|
||||
|
||||
/*
|
||||
* Ethernet MAC/KSZ8081 PHY
|
||||
* ------------------------
|
||||
|
|
|
@ -223,7 +223,7 @@ CONFIG_KINETIS_UART4=y
|
|||
# CONFIG_KINETIS_FLEXCAN0 is not set
|
||||
# CONFIG_KINETIS_FLEXCAN1 is not set
|
||||
# CONFIG_KINETIS_SPI0 is not set
|
||||
# CONFIG_KINETIS_SPI1 is not set
|
||||
CONFIG_KINETIS_SPI1=y
|
||||
# CONFIG_KINETIS_SPI2 is not set
|
||||
CONFIG_KINETIS_I2C0=y
|
||||
# CONFIG_KINETIS_I2C1 is not set
|
||||
|
@ -546,7 +546,15 @@ CONFIG_I2C_DRIVER=y
|
|||
# CONFIG_ARCH_HAVE_SPI_CRCGENERATION is not set
|
||||
# CONFIG_ARCH_HAVE_SPI_CS_CONTROL is not set
|
||||
# CONFIG_ARCH_HAVE_SPI_BITORDER is not set
|
||||
# CONFIG_SPI is not set
|
||||
CONFIG_SPI=y
|
||||
# CONFIG_SPI_SLAVE is not set
|
||||
CONFIG_SPI_EXCHANGE=y
|
||||
# CONFIG_SPI_CMDDATA is not set
|
||||
# CONFIG_SPI_CALLBACK is not set
|
||||
# CONFIG_SPI_HWFEATURES is not set
|
||||
CONFIG_SPI_CS_DELAY_CONTROL=y
|
||||
# CONFIG_SPI_DRIVER is not set
|
||||
# CONFIG_SPI_BITBANG is not set
|
||||
# CONFIG_I2S is not set
|
||||
|
||||
#
|
||||
|
@ -608,6 +616,7 @@ CONFIG_MMCSD_NSLOTS=1
|
|||
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
|
||||
CONFIG_MMCSD_MMCSUPPORT=y
|
||||
CONFIG_MMCSD_HAVECARDDETECT=y
|
||||
# CONFIG_MMCSD_SPI is not set
|
||||
CONFIG_ARCH_HAVE_SDIO=y
|
||||
# CONFIG_SDIO_DMA is not set
|
||||
# CONFIG_ARCH_HAVE_SDIOWAIT_WRCOMPLETE is not set
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
#define HAVE_PROC 1
|
||||
#define HAVE_MMCSD 1
|
||||
#define HAVE_AUTOMOUNTER 1
|
||||
#define HAVE_SPI 1
|
||||
#define HAVE_USBDEV 1
|
||||
|
||||
#if defined(CONFIG_KINETIS_RTC)
|
||||
|
@ -173,6 +174,11 @@
|
|||
# undef CONFIG_KINETIS_SPI2
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_KINETIS_SPI0) && !defined(CONFIG_KINETIS_SPI1) && \
|
||||
!defined(CONFIG_KINETIS_SPI3)
|
||||
# undef HAVE_SPI
|
||||
#endif
|
||||
|
||||
/* FREEDOM-K66F GPIOs ****************************************************************/
|
||||
/* A micro Secure Digital (SD) card slot is available on the FRDM-K66F connected to
|
||||
* the SD Host Controller (SDHC) signals of the MCU. This slot will accept micro
|
||||
|
@ -223,6 +229,11 @@
|
|||
#define GPIO_LED_G (GPIO_LOWDRIVE | GPIO_OUTPUT_ONE | PIN_PORTE | PIN6)
|
||||
#define GPIO_LED_B (GPIO_LOWDRIVE | GPIO_OUTPUT_ONE | PIN_PORTA | PIN11)
|
||||
|
||||
/* SPI1 on J6 */
|
||||
|
||||
#define PIN_CE (GPIO_LOWDRIVE | GPIO_OUTPUT_ONE | PIN_PORTB | PIN20)
|
||||
#define PIN_SPI1_PCS0 (GPIO_LOWDRIVE | GPIO_OUTPUT_ONE | PIN_PORTD | PIN4)
|
||||
|
||||
/************************************************************************************
|
||||
* Public data
|
||||
************************************************************************************/
|
||||
|
|
|
@ -47,8 +47,10 @@
|
|||
#include <debug.h>
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include <nuttx/spi/spi.h>
|
||||
#include <nuttx/input/buttons.h>
|
||||
|
||||
#include "kinetis_spi.h"
|
||||
#include "freedom-k66f.h"
|
||||
|
||||
#if defined(CONFIG_LIB_BOARDCTL) || defined(CONFIG_BOARD_INITIALIZE)
|
||||
|
@ -67,6 +69,9 @@
|
|||
|
||||
int k66_bringup(void)
|
||||
{
|
||||
#ifdef HAVE_SPI
|
||||
FAR struct spi_dev_s *spi1;
|
||||
#endif
|
||||
int ret;
|
||||
|
||||
#ifdef HAVE_PROC
|
||||
|
@ -151,8 +156,20 @@ int k66_bringup(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SPI
|
||||
|
||||
/* Verify we can initialize SPI bus 1 */
|
||||
|
||||
spi1 = kinetis_spibus_initialize(1);
|
||||
|
||||
if (!spi1)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR:FAILED to initialize SPI port 1\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
#endif
|
||||
|
||||
UNUSED(ret);
|
||||
return OK;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_LIB_BOARDCTL CONFIG_BOARD_INITIALIZE */
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
#include "freedom-k66f.h"
|
||||
|
||||
#if defined(CONFIG_KINETIS_SPI0) || defined(CONFIG_KINETIS_SPI1) || \
|
||||
defined(CONFIG_KINETIS_SPI2)
|
||||
defined(CONFIG_KINETIS_SPI2)
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
|
@ -69,7 +69,10 @@
|
|||
|
||||
void weak_function k66_spidev_initialize(void)
|
||||
{
|
||||
# warning "Missing logic"
|
||||
/* Initialize the CE CS pins on J6 RF/WIFI connector */
|
||||
|
||||
kinetis_pinconfig(PIN_CE);
|
||||
kinetis_pinconfig(PIN_SPI1_PCS0);
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
|
@ -118,7 +121,7 @@ uint8_t kinetis_spi0status(FAR struct spi_dev_s *dev, uint32_t devid)
|
|||
void kinetis_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
|
||||
{
|
||||
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||
# warning "Missing logic"
|
||||
kinetis_gpiowrite(PIN_SPI1_PCS0, !selected);
|
||||
}
|
||||
|
||||
uint8_t kinetis_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
|
||||
|
|
Loading…
Reference in New Issue