We are using rel_imx_4.1.15_2.1.0_ga version kernel.
And enable ecspi3/4 with spidev.
&ecspi3 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi3>;
cs-gpios = <&gpio1 20 GPIO_ACTIVE_HIGH>;
status = "okay";
fsl,spi-num-chipselects = <1>;
spi_dev0: spi@0 {
compatible = "spidev";
spi-max-frequency = <20000000>;
reg = <0>;
status = "okay";
};
};
&ecspi4 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi4>;
cs-gpios = <&gpio2 15 GPIO_ACTIVE_LOW>;
status = "okay";
fsl,spi-num-chipselects = <1>;
spi_dev1: spi@0 {
compatible = "spidev";
spi-max-frequency = <20000000>;
reg = <0>;
status = "okay";
};
};
Then tested with latest spidev_test linux/spidev_test.c at master · torvalds/linux · GitHub
with following command line,which start spi transfer on two thread.
#!/bin/bash
./spidev_test -D /dev/spidev3.0 -s 20000000 -S 4000 -I 3000 &
./spidev_test -D /dev/spidev2.0 -s 20000000 -S 4000 -I 3000 &
Then we get something like
rate: tx 5721.6kbps, rx 5721.6kbps
rate: tx 5728.0kbps, rx 5728.0kbps
This is kind of low compare what is claimed in datasheet 52Mbit/s.
Is this normal?
And also I noticed the DMA is using
IMX_DMATYPE_CSPI 7
from what I found
RE: Issues with i.MX SPI DMA transfers — Linux SPI
IMX_DMATYPE_CSPI_SP 8
which will be faster.
Then I tried to use 8
but then there will be DMA errors
[ 34.144603] spi_master spi3: I/O Error in DMA TX:fa0
can't send spi message: Connectio[ 34.150855] spi_master spi3: failed to transfer one message from queue
n timed out
[ 36.344630] spi_master spi2: I/O Error in DMA RX:fa0
can't send spi message: Connection timed out
[ 36.354338] spi_master spi2: failed to transfer one message from queue
So I have two questions:
1. Is 5.x Mbit/s speed normal?
2. Can I use IMX_DMATYPE_CSPI_SP?
thanks.
Solved! Go to Solution.
Hi Bob
>1. Is 5.x Mbit/s speed normal?
obtaining lower speeds than described in datasheet is normal
in operating system applications. One can expect faster speeds
in baremetal tests not using operating system.
>2. Can I use IMX_DMATYPE_CSPI_SP?
one can test it and if it works fine, use in own applications.
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Bob
>1. Is 5.x Mbit/s speed normal?
obtaining lower speeds than described in datasheet is normal
in operating system applications. One can expect faster speeds
in baremetal tests not using operating system.
>2. Can I use IMX_DMATYPE_CSPI_SP?
one can test it and if it works fine, use in own applications.
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
OK, thanks Igor.