How to enable and test SPI in i.MX6SoloLite using kernel 3.10.17?

cancel
Showing results for 
Search instead for 
Did you mean: 

How to enable and test SPI in i.MX6SoloLite using kernel 3.10.17?

Jump to solution
2,791 Views
carlosgallegos
Contributor III

Hi,


I have already modified the imx6sl-evk.dts file and I added the following code:


&ecspi2 {

  fsl,spi-num-chipselects = <2>;

  cs-gpios = <0>,<&gpio3 31 0>;

  pinctrl-names = "default";

  pinctrl-0 = <&pinctrl_ecspi2_1>;

  status = "okay";

   spidev@0x00 {

   compatible = "spidev";

   spi-max-frequency = <20000000>;

   reg = <0>;

   };

   spidev@0x01 {

   compatible = "spidev";

   spi-max-frequency = <20000000>;

   reg = <1>;

   };

};

&iomuxc {

...

...

   ecspi2 {

   pinctrl_ecspi2_1: ecspi2grp-1 {

   fsl,pins = <

   MX6SL_PAD_ECSPI2_MISO__ECSPI2_MISO 0x100b1

   MX6SL_PAD_ECSPI2_MOSI__ECSPI2_MOSI 0x100b1

   MX6SL_PAD_ECSPI2_SCLK__ECSPI2_SCLK 0x100b1

   MX6SL_PAD_ECSPI2_SS0__ECSPI2_SS0 0x100b1

   MX6SL_PAD_KEY_ROW3__GPIO3_IO31 0x100b1

   >;

   };

   };



And I can see /dev/spidev32765. 0 and /dev/spidev32765.1. With this I hope I can use the ECSPI2 that is in the LCD port (I have an adapter for this), but I cannot even see the clock when something is sent (or at least I assume that). The test I am doing is based on a program from the kernel files and you can find it in spidev_test.c - The Linux Kernel Archives .

Labels (4)
1 Solution
432 Views
CommunityBot
Community Manager
This an automatic process.

We are marking this post as solved, due to the either low activity or any reply marked as correct.

If you have additional questions, please create a new post and reference to this closed post.

NXP Community!

View solution in original post

0 Kudos
10 Replies
433 Views
CommunityBot
Community Manager
This an automatic process.

We are marking this post as solved, due to the either low activity or any reply marked as correct.

If you have additional questions, please create a new post and reference to this closed post.

NXP Community!

View solution in original post

0 Kudos
434 Views
alejandrolozan1
NXP Employee
NXP Employee

Hi  Carlos,

Your dts seems to be almost ok. It seems that you want to use 2 chip selects and register different busses, correct? If so, you are only setting only one chip select at gpio3_31


cs-gpios = <0>,<&gpio3 31 0>;


In your dts you should have something like this:


  cs-gpios = <&gpio4 9 0>, <&gpio5 9 0>; /*Just as example*/


to use 2 different chip selects. Your dts generates 2 spidev buses but only one chip select is configured.

Please try something like that and let me know how it goes. Remember to configure the pinctrl for the extra ping.


Best Regards,

Alejandro

0 Kudos
434 Views
carlosgallegos
Contributor III

Hi Alejandro,

I tried what you told me and didn't work, do you have some example code to make it work, maybe only with one CS, it's frustrating that this thing doesn't work and in other platforms is so easy. I can't even make work the GPIOs, well only the one connected to the debug LED, but when I try others they do not work.

Best Regards.

JC

0 Kudos
434 Views
alejandrolozan1
NXP Employee
NXP Employee

Hi Carlos,

I am now generating a new image for the imx6slevk. It will take a while, but checking the schematics I noticed that the ECSPI2 pins are shared by the max8903 charger. The driver for the charger configures those pins as gpio. Either you can try in the meantime to disable the charger driver or try with other port.

Please try that and let me know how it goes.

Best Regards,

Alejandro

0 Kudos
434 Views
carlosgallegos
Contributor III

Hi Alejandro,

Thank you very much for that information, actually I have a custom adapter in the LCD port, and I didn't do it so I will contact with the person responsible for this task to see if he can change the pins for the SPI. In the meantime, I will try to disable the harder driver, if you can provide me the place where I can do that, it would be great. Another question I saw that LCD_DAT8 trough 11 can be used for ECSPI2, is there any problem if I use those?

Best regards,

JC

0 Kudos
434 Views
alejandrolozan1
NXP Employee
NXP Employee

You should no have any problem if you use those pins, of course  you will have to change the dts to choose and "configure" those pins.

But if you want to disable the charger driver you will have to do it in menuconfig under

Device Drivers -> Power Supply Class Support-> Sabresd Battery

Generate the uImage and use that one.

0 Kudos
434 Views
carlosgallegos
Contributor III

Hi Alejandro,

Well, that did not give me a different result, I get the spidev32765.0 and spidev32765.1, but when using the spidev_test.c I can't even see a signal in the SCLK pin, much less capture any input or output. I really appreciate your help, If you could provide me with a working example, even with only one CS, I would be really grateful.

Best regards.

JC

0 Kudos
434 Views
alejandrolozan1
NXP Employee
NXP Employee

Hi Carlos,

Attached you can find the dts and the dtsi files I used.

The general steps are:

1.- Enable spidev support in the kernel with menuconfig.

2.-change the dts and dti to generate the correct dtb file.

I the attached files I just removed the  LCD pins that were used in other modules.

After this, I could see an output from modules using the spidev_test.c

Best Regards,

Alejandro

434 Views
alejandrolozan1
NXP Employee
NXP Employee

Let me try to get a working example. I will get back to you as soon as possible.

434 Views
igorpadykov
NXP TechSupport
NXP TechSupport

Hi Jose

probably you can try mxc_spi_test in  imx-test-3.10.17

(recipes-bsp/imx-test/imx-test_3.10.17-1.0.0.bb)

test procedure described below

i.MX6 ESPI slave mode support patch based on rel_imx_3.0.35_4.1.0

Best regards

igor

0 Kudos