[Solved] Change SPI buffer size

Hi all,
I’m trying to change the default buffer size of the Jetson Nano 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

For my application I need a SPI buffer of more than 20480 byte.

Any idea?

Thank you
Walter

I found a good solution that I want to share with the community.

There are two easy way to set the size of the SPI buffer, one temporary and one permanent:

Temporary

First of all remove the spidev module from the Kernel:

$ sudo rmmod spidev

then reload it with the required parameter

$ sudo modprobe spidev bufsize=20480

when you reboot the Jetson Nano the value of the size of the SPI buffer will be restored to the default value, i.e. 4096B

Permanent

To permanently set the value of the size of the SPI buffer you must create a configuration file for modprobe

$ sudo nano /etc/modprobe.d/spidev.conf

Enter the following line

options spidev bufsiz=20480

Save and reboot the Jetson Nano

Check the parameter

You can check that the parameter is correcly set using the command

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

that should output the value of the size of the buffer that you chose, i.e. 20480

2 Likes

Hello Myzhar;
I tried your solution;i found 2 questions;
1:in temporary solution;
this command may be failed;
$ sudo modprobe spidev bufsize=20480
it should be :
$ sudo modprobe spidev bufsiz=20480
2:i do not find /etc/modprobe.d/spidev.conf this node in my jetson nano;