imx6sx - mrf24j40 - udooneo - devicetree

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

imx6sx - mrf24j40 - udooneo - devicetree

969 Views
carton
Contributor I

Hi,

I'm having trouble setting my device tree to use the MRF24J40 linux driver on my UDOO Neo Full board.

I'm using this kernel : GitHub - fmntf/linux_kernel: Kernel Linux Repository for UDOO  on branch 4.1.5_2.x-udoo

I have the following configuration in imx6sx-udoo-neo-externalpins.dtsi (Device Tree used : /boot/imx6sx-udoo-neo-full-lvds7.dtb)

//MX6SX_PAD_SD4_CLK__GPIO6_IO_12 0x80000000 // {{external-gpio-20}}
//MX6SX_PAD_SD4_CMD__GPIO6_IO_13 0x80000000 // {{external-gpio-21}}

//MX6SX_PAD_SD4_DATA1__GPIO6_IO_15 0x80000000 // {{external-gpio-38}}
//MX6SX_PAD_SD4_DATA0__GPIO6_IO_14 0x80000000 // {{external-gpio-39}}

/* ... */

pinctrl_ecspi2: ecspi2grp {
fsl,pins = <
MX6SX_PAD_SD4_CLK__ECSPI2_MISO 0x100b1
MX6SX_PAD_SD4_CMD__ECSPI2_MOSI 0x100b1
MX6SX_PAD_SD4_DATA1__ECSPI2_SCLK 0x100b1
/* CS SPI 1 */
MX6SX_PAD_SD4_DATA0__GPIO6_IO_14 0x0b0b1
>;
};

/* ... */

&ecspi2 {
   fsl,spi-num-chipselects = <1>;
   cs-gpios = <&gpio6 14 GPIO_ACTIVE_LOW>;
   pinctrl-names = "default";
   pinctrl-0 = <&pinctrl_ecspi2>;
   status = "okay";
   #address-cells = <1>;
   #size-cells = <0>;

   mrf24j40@0 {
      compatible = "mrf24j40";
      reg = <0>;
      spi-max-frequency = <1000000>;
      interrupt-parent = <&gpio1>;
      interrupts = <17 8>;

   };
};

The issue is that the SPI bus isn't fully working then. With an oscilloscope, I can see correct messages on the MOSI, CLK and CS wires, the IRQ is setted but I have nothing on the MISO wire.

The INT pin of the MRF24J40 is wired (hard) on GPIO_17 (29) of the Udoo Neo.

A friend developped in the past a custom driver for the mrf24j40 which worked with spidev. It was working. I tested today with this driver and his old device tree configuration and everything works. But we have to use this standard driver now as his driver is limited.

Does anyone know what I messed in my configuration ? It would save my life :smileyhappy:

Best regards

Jo

Labels (1)
0 Kudos
3 Replies

734 Views
igorpadykov
NXP Employee
NXP Employee

Hi Jo

in master mode MISO wire should be diven by MRF24J40, one can

check if it was correctly initialized. I.MX6SX eCSPI interface can be tested with

unit tests (../mxc_spi_test)

imx-test
www.nxp.com/lgfiles/NMG/MAD/YOCTO/imx-test-5.7.tar.gz

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

734 Views
carton
Contributor I

Hi Igor,

Thank you for your reply.

I checked the source code of the mxc_spi_test. It's meant to test SPI buses 'used with' spidev. Am I right ? So i can't use it if spidev is disabled in my devicetree ?

I forgot a part of my device tree. The mrf24j40 driver don't use spidev and you can see below my edited devicetree (modifications in bold) that I actually use :

//MX6SX_PAD_SD4_CLK__GPIO6_IO_12 0x80000000 // {{external-gpio-20}}
//MX6SX_PAD_SD4_CMD__GPIO6_IO_13 0x80000000 // {{external-gpio-21}}

//MX6SX_PAD_SD4_DATA1__GPIO6_IO_15 0x80000000 // {{external-gpio-38}}
//MX6SX_PAD_SD4_DATA0__GPIO6_IO_14 0x80000000 // {{external-gpio-39}}

 

/* ... */

 

pinctrl_ecspi2: ecspi2grp {
fsl,pins = <
MX6SX_PAD_SD4_CLK__ECSPI2_MISO 0x100b1
MX6SX_PAD_SD4_CMD__ECSPI2_MOSI 0x100b1
MX6SX_PAD_SD4_DATA1__ECSPI2_SCLK 0x100b1
/* CS SPI 1 */
MX6SX_PAD_SD4_DATA0__GPIO6_IO_14 0x0b0b1
>;
};

 

/* ... */

 

&ecspi2 {
   fsl,spi-num-chipselects = <1>;
   cs-gpios = <&gpio6 14 GPIO_ACTIVE_LOW>;
   pinctrl-names = "default";
   pinctrl-0 = <&pinctrl_ecspi2>;
   status = "okay";
   #address-cells = <1>;
   #size-cells = <0>;

   spidev0: spi@0 {
      status = "disabled";
    };

   mrf24j40@0 {
      compatible = "mrf24j40";
      reg = <0>;
      spi-max-frequency = <1000000>;
      interrupt-parent = <&gpio1>;
      interrupts = <17 8>;

   };
};

Sorry for my noob questions. I'm kinda lost here...

The mrf24j40 module is recognized and probe() is done. But the driver get stuck on "Timeout waiting for TX interrupt" (cf. https://bit.ly/2rwQ596 l.365) as soon as I try to configure it with wpan-tools and then do a 'ip link set wpan0 up').

0 Kudos

734 Views
carton
Contributor I

Hi,

I solved my problem. The issue did not come from the device tree. It was related to the mrf24j40 driver itself.

Thank you for the help

0 Kudos