Hello, teacher:
The core board I am using is Orin nano 4gb (JetPack5.1.5). Under the guidance of my teacher (KevinFFF), I completed the SPI loop test.
Now I need to communicate with SPI and MCU, but I don’t know how to change the SPI clock frequency of the core board. I want to change the SPI clock frequency to 1.5 MHZ. I hope the teacher can help me further. Thank you very much.
Hi 403199668,
Please share the full device tree and the result of the following commands on your board for further check.
$ cat /etc/nv_tegra_release
$ cat /etc/nv_boot_control.conf
It would be great if you could provide me with some routines, similar to those for GPIO.
Please also provide the full device tree for further check.
There should be the related configuration in device tree.
Sorry. I didn’t reply to your message last week because I was on leave.
I am sending you the device tree now, and I hope you can continue to guide me.
dmesg.zip (129.9 KB)
You can update the spi-max-frequency property in SPI device node as following:
spi@3210000 {
iommus = <0x06 0x04>;
#address-cells = <0x01>;
dma-coherent;
clock-names = "spi\0pll_p\0clk_m";
nvidia,clk-parents = "pll_p\0clk_m";
resets = <0x02 0x5b>;
interrupts = <0x00 0x24 0x04>;
clocks = <0x02 0x87 0x02 0x66 0x02 0x0e>;
#size-cells = <0x00>;
spi-max-frequency = <0x3dfd240>;
..
spi@1 {
- spi-max-frequency = <0x2faf080>;
+ spi-max-frequency = <0x16e360>;
compatible = "tegra-spidev";
..
Or you can simply specify the SPI clock frequency from user space with -s option:
$ sudo spidev_test -D /dev/spidev0.0 -s 1500000
