IMX93 - LPSPI3 in slave mode - Linux

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

IMX93 - LPSPI3 in slave mode - Linux

1,038 次查看
il_ciancio
Contributor III

Hello NXP experts!

I am configuring an IMX93 processor with Yocto (https://github.com/nxp-imx/imx-manifest -b imx-linux-styhead -m imx-6.12.3-1.0.0.xml) for a custom board.

I have to configure the LPSPI3 peripheral in slave mode, based on kernel 6.12.3.

This is the DTS, I have followed this example linux-imx/arch/arm64/boot/dts/freescale/imx93-11x11-evk-i2c-spi-slave.dts at lf-6.12.y · nxp-imx/lin...:

/*slave spi*/
&lpspi3 {
fsl,spi-num-chipselects = <1>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_lpspi3>;
status = "okay";
 
spi-slave;
 
slave {
compatible = "lwn,bk4";:
spi-max-frequency = <10000000>;
};
};
 
pinctrl_lpspi3: lpspi3grp {
fsl,pins = <
MX93_PAD_GPIO_IO08__LPSPI3_PCS0 0x3fe
MX93_PAD_GPIO_IO09__LPSPI3_SIN 0x3fe
MX93_PAD_GPIO_IO10__LPSPI3_SOUT 0x3fe
MX93_PAD_GPIO_IO11__LPSPI3_SCK 0x3fe
>;
};

I am running this SPI example:

  • attached you can find the poc_spi_slave.c file.

 

Basically, the problem is that when I start the binary, I see a voltage drop on MOSI signal, with the same configuration there is not a drop on SCK signal.

In the image below you can see:

  • Yellow, MOSI from master side;
  • Violet, SIN from slave side (on a test point);
  • Blue, SIN on the pin GPION_09 SPI3_SIN;

il_ciancio_2-1747985586207.png

In the image below you can see:

  • Yellow, from master side;
  • Violet, SCK from slave side;
  • Blue, SCK on the pin GPION_09 SPI3_SIN;

il_ciancio_3-1747985849771.png

 

As you can see, there is a voltage drop on MOSI and there isn't a voltage drop on SCK.

 

I have configured the same pin, the same peripheral with M33 core and I don't see this voltage drop.

When I use the LPSPI 4 as master, instead, I have no issue.

Any suggestion?

 

Please help me.

 

Thanks,

Ciancio.

 

 

标记 (4)
6 回复数

663 次查看
pengyong_zhang
NXP Employee
NXP Employee

Hi @il_ciancio 

Here is the test method about slave and master of LPSPI on imx93.

1. Slave runs "spidev_test -D /dev/spidev0.0 -s 8000000 -v -p 12345678 &"
2. Master runs "spidev_test -D /dev/spidev1.0 -s 8000000 -v -p 12345678"
3. Check if the TX RX of the master and slave are equal

B.R

 

0 项奖励
回复

958 次查看
pengyong_zhang
NXP Employee
NXP Employee

HI 

You said when you use LPSPI4 as master, there is no problem, when use LPSPI3 as master, the problem occurred. right? 

Did you check if your HW connect is no problem when you use LPSPI3 as master?

B.R

0 项奖励
回复

861 次查看
il_ciancio
Contributor III

Hi,

I will update you about this. It is a little bit hard because on my board the LSPI3 SCK (GPIO_11) has only one direction (same for the SOUT from the master to the SIN of the LSPI3). 

Can you check the other response?

 

Thanks a lot.

B.R.,

Ciancio

0 项奖励
回复

988 次查看
pengyong_zhang
NXP Employee
NXP Employee

Hi @il_ciancio 

Did you run the spidev_test command test the spi master and slave device? Please run it see the test result.

B.R

981 次查看
il_ciancio
Contributor III

Hi @pengyong_zhang,

I have runned spidev_test on my spi_slave peripheral.

This is the command:

  • spidev_test -D /dev/spidev2.0 -I100 -S8 -v -s500000.

This is the output:

il_ciancio_0-1748337477892.png.

I am not receiving the data, below there is the Master (basically each seconds I am sendin in ASCII 1 to 9):

il_ciancio_1-1748337530395.png.

 

The strange things is that:

  • The image below is the oscilloscope on the MOSI LINE. The yellow signal is MOSI from the MASTER, the blu line is the SIN from the slave.
 

 

Image.jpg

  • It seems that spidev_test is sending data on the SIN line, while it should be sent on the SOUT line. When spidev_test is killed, there isn't overlapping.

     

Image (1).jpg.

Some question:

  1. Any Idea on this behaviour?
  2. How can I specify to spidev_test to work as slave?
  3. How can i specify to spidev_test to work in half-duplex mode?

 

Thanks for your time and your support.

 

BR,

Ciancio

 

 

 

 

 

 

 

 

0 项奖励
回复

972 次查看
il_ciancio
Contributor III
Another question:
Is there the possibility to receive only data on imx93 without sending anything?
0 项奖励
回复