AnsweredAssumed Answered

IMX6 Using ECSPI1 master to communicate with VK3234 slave

Question asked by wenjing wang on Oct 9, 2014
Latest reply on Oct 9, 2014 by wenjing wang
Branched to a new discussion

I configured the ECSPI1 channel by the follow modify:

--- a/arch/arm/mach-mx6/board-mx6dl_sabresd.h

+++ b/arch/arm/mach-mx6/board-mx6dl_sabresd.h

@@ -32,10 +32,28 @@ static iomux_v3_cfg_t mx6dl_sabresd_pads[] = {

        MX6DL_PAD_SD2_DAT0__AUDMUX_AUD4_RXD,

        MX6DL_PAD_SD2_DAT1__AUDMUX_AUD4_TXFS,

        MX6DL_PAD_SD2_DAT2__AUDMUX_AUD4_TXD,

-       /* CSPI */

+       /* ECSPI1 */

+       //WWJ changed for SPI1

+       MX6DL_PAD_EIM_D16__ECSPI1_SCLK,

+       MX6DL_PAD_EIM_D17__ECSPI1_MISO,

+       MX6DL_PAD_EIM_D18__ECSPI1_MOSI,

+       MX6DL_PAD_EIM_D19__GPIO_3_19,   /*CS1*/

+       MX6DL_PAD_EIM_D24__GPIO_3_24,   /*CS2*/

+       MX6DL_PAD_EIM_D25__GPIO_3_25,   /*CS3*/

+       MX6DL_PAD_GPIO_3__GPIO_1_3,             /*SPI_INT*/

+       //WWJ and end

 

--- a/arch/arm/mach-mx6/board-mx6q_sabresd.c

+++ b/arch/arm/mach-mx6/board-mx6q_sabresd.c

@@ -215,6 +215,12 @@

// Frank Lee #define SABRESD_ELAN_RST  IMX_GPIO_NR(3, 8)

// Frank Lee #define SABRESD_ELAN_INT  IMX_GPIO_NR(3, 28)

 

+//WWJ changed for SPI1

+#define VK3234_ECSPI1_CS0 IMX_GPIO_NR(3, 19)

+#define VK3234_ECSPI1_CS1 IMX_GPIO_NR(3, 24)

+#define VK3234_ECSPI1_CS2 IMX_GPIO_NR(3, 25)

+

+

--- a/arch/arm/mach-mx6/board-mx6q_sabresd.c

+++ b/arch/arm/mach-mx6/board-mx6q_sabresd.c

@@ -215,6 +215,12 @@

// Frank Lee #define SABRESD_ELAN_RST  IMX_GPIO_NR(3, 8)

// Frank Lee #define SABRESD_ELAN_INT  IMX_GPIO_NR(3, 28)

 

+//WWJ changed for SPI1

+#define VK3234_ECSPI1_CS0 IMX_GPIO_NR(3, 19)

+#define VK3234_ECSPI1_CS1 IMX_GPIO_NR(3, 24)

+#define VK3234_ECSPI1_CS2 IMX_GPIO_NR(3, 25)

+

+

static const struct spi_imx_master mx6q_sabresd_spi_data __initconst = {

@@ -375,6 +384,26 @@ static struct spi_board_info imx6_sabresd_spi_nor_device[] __initdata = {

                .platform_data = &imx6_sabresd__spi_flash_data,

        },

#endif

+       //WWJ changed for SPI1

+       /*

+       {

+                .modalias = "vk3234",

+                .max_speed_hz = 20000000, // max spi clock (SCK) speed in HZ

+                .bus_num = 1,

+                .chip_select = 0,

+                .platform_data = NULL,

+               .mode = SPI_MODE_0,

+        },*/

+

+       {

+                .modalias = "vk3234",

+                .max_speed_hz = 200000, /* max spi clock (SCK) speed in HZ */

+                .bus_num = 1,

+                .chip_select = 1,

+                .platform_data = NULL,

+               .mode = SPI_MODE_0,

+        },

+

};

+       imx6q_add_ecspi(1, &mx6q_sabresd_spi_data);

+       spi_device_init();

 

and when i using the SPI (CS1) to read/write the VK3234, CS1 is pulled down, but the SCLK is always hight( have no clk signal), has anyone can help me ?

Outcomes