Modifying SPI buffer size

Hi all,
I’m trying to change the default buffer size of the Jetson Xavier NX using the following procedure.

$ sudo su
# cd /sys/module/spidev/parameters
# chmod 666 bufsiz
# echo 65534 > bufsiz

but I get the error

bash: echo: write error: Input/output error

also, I tried 2 methods:

First method:

$ sudo rmmod spidev
$ sudo modprobe spidev bufsize=20480

Second method:

$ sudo nano /etc/modprobe.d/spidev.conf
options spidev bufsiz=20480

when rebooting it does not change.

For my application, I need an SPI buffer of more than 20480 bytes.
However, I checked each time the parameters using this command:

$ cat /sys/module/spidev/parameters/bufsiz

bufsize remains 4096 bytes.

Any idea?

Thank you.

  1. Try to add the spidev.bufsiz=65534 to the /boot/extlinux/extlinux.conf at the end of bootargs to try.
  2. If first still not working just modify the spidev.c from 4096 to 65534

Do I have to pip install spidev?
I’m using the neopixel_spi library in my python script, and I’m not finding the spidev.c file.

It’s kernel driver.
You can reference to below document to get the kernel source and build the kernel Image

https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide%2Fkernel_custom.html%23

I’m using an addressable led with a python script on Jetson Nano. I have a problem when the LED turns ON. There exist 300 num pixels which just 168 of them turn ON. Do you have any suggestions ?

Too few information to know what going on.

I don’t have experience for this device to give suggestion. Maybe consult with vendor support should get help.

can you guide me how to access spidev.c file ?

Please check the kernel customize document.

https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide%2Fkernel_custom.html%23

/lib/modules/4.9.140-tegra/kernel/drivers/spi$ ls
spi-cadence.ko spi-pxa2xx-pci.ko spi-sc18is602.ko spi-xcomm.ko
spidev.ko spi-pxa2xx-platform.ko spi-tle62x0.ko spi-zynqmp-gqspi.ko

I do not find spidev.c

Did you follow the doc to download the kernel source??
After you download the kernel source it’s locate at below path.
…/kernel/kernel-4.9/drivers/spi/

yes.
Any other suggestions ?

I don’t understand your means. Do you mean you have download the kernel source but still can’t find the spidev.c?

I’ve changed spidev.c from 4096 to 65536 bytes.
When checking the number of bytes using :

 cat /sys/module/spidev/parameters/bufsiz

it remains 4096 bytes.
How do I need to build the new spidev to my system?
My script is still working on the previous spidev, and not the one which I’ve downloaded.

Follow the document to build the kernel Image and replace it at /boot/Image to apply customize kernel Image.