Hi,
I am new to this forum is it the first time I'm testing spi interface on an arm board. I have a VAR-SOM-MX6 custom board and I'm trying to test spi output on J28 connector. In the default kernel image provided by Variscite there isn't any spidev device configured to use that connector but only an ADS7846 spi on bus 2 (as you can see in attached file board_mx6q_var_som.c found in Yocto tree /arm/arch/mach-mx6, here renamed _orig.c to differ it from the one I modified) so I tried to modify board-mx6q_var_som.c to that aim. Following other freescale threads I have enabled "User mode SPI device driver support" on kernel (3.0.35) and I have added an spidev structure configured on bus 1 (as suggested me by Variscite support to use J28 connector) and I registered it using spi_register_board_info function as follows:
static struct spi_board_info mx6_var_som_spidev_device[] __initdata = {
{
.modalias = "spidev",
.max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
.bus_num = 1,
.chip_select = 0,
},
};
static void spi_device_init(void)
{
spi_register_board_info(mx6_var_som_spidev_device,
ARRAY_SIZE(mx6_var_som_spidev_device));
}
At this point, using a rebuilded kernel I obtain just a /dev/spidev2.0 so I found out that I need to enable ECSPI1 using imx6q_add_ecspi function. Am I wrong? I have added the following code, creating a spi_imx_master structure using GPIO4 [9] as indicated on data sheet for CSPI1_CS0:
#define VAR_SOM_ECSPI1_CS0 IMX_GPIO_NR(4, 9)
static int mx6q_var_som_spidev_cs[] = {
VAR_SOM_ECSPI1_CS0,
};
static const struct spi_imx_master mx6q_var_som_spidev_data __initconst = {
.chipselect = mx6q_var_som_spidev_cs,
.num_chipselect = ARRAY_SIZE(mx6q_var_som_spidev_cs),
};
imx6q_add_ecspi(1, &mx6q_var_som_spidev_data);
With the new kernel I obtain an /dev/spidev1.0 but testing with an oscilloscope on CSPI1_SCLK I can't register any signal. Is it correct? Does it suffice to indicate CSPI1_CS0 pin or have I to configure also CSPI1_SOMI, CSPI1_SIMO and CSPI1_SCLK in any way? Is the first parameter on imx6q_add_ecspi function the bus number? Could anyone tell me there is something wrong (modified board-mx6q_var_som.c is attached) or if there is something necessary that this procedure lacks?
(references http://armbedded.eu/node/318)
I hope someone could help me, thanks in advance
best regards
Andrea
Original Attachment has been moved to: board-mx6q_var_som_orig.c.txt.zip
Original Attachment has been moved to: board-mx6q_var_som.c.txt.zip
解決済! 解決策の投稿を見る。
Hi, I have solved that issue, now spidev is ok. I miss to modify IO_MUX correctly to enable ECSPI1 on board-mx6q_var_som.h
regards
Andrea
Hi, I have solved that issue, now spidev is ok. I miss to modify IO_MUX correctly to enable ECSPI1 on board-mx6q_var_som.h
regards
Andrea
Hi adc1
I think you can check below
How to enable spidev for all SPI (1-5) for MX6
in particular make sure that in ltib Freescale i.MX SPI controllers and User
mode SPI device driver support are checked:
Device Drivers Go to SPI Support
Best regards
igor
Hi Igor,
thank you for your reply. I have already checked i.MX Community threads concerning SPI but I can't found nothing that can help me. My board_mx6q_var_som.c file seems to be correct reading that threads but ECSPI1 continue to doesn't function. Using spidev interface and sending data on /dev/spidev1.0 should I register signal on CSPI1_CLK with an oscilloscope? (I am using code referenced to http://armbedded.eu/node/318). I continue to receive nothing....
Does someone never used ECSPI1 on J28 connector on a VAR-SOM-MX6 board? Does someone could check something lack in my board_mx6q_var_som.c file?
hoping for other suggestions,
best regards
Andrea
Hi adc1
I would suggest to post this on
variscite forum or try to reproduce issue on Freescale reference board.
~igor