# Configuring SPI Speed for Jetson Orin Nano Developer Kit

**URL:** <https://forums.developer.nvidia.com/t/configuring-spi-speed-for-jetson-orin-nano-developer-kit/300344>\
**Category:** Jetson Orin Nano\
**Tags:** spi\
**Created:** [July 19, 2024, 1:10am UTC](https://forums.developer.nvidia.com/t/configuring-spi-speed-for-jetson-orin-nano-developer-kit/300344 "2024-07-19T01:10:36Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![thirdxero1](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@thirdxero1](https://forums.developer.nvidia.com/u/thirdxero1)\
**Post date:** [July 19, 2024, 1:10am UTC](https://forums.developer.nvidia.com/t/configuring-spi-speed-for-jetson-orin-nano-developer-kit/300344/1 "2024-07-19T01:10:36Z")

</div>

Hello,

I am using the Jetson Orin Nano Developer Kit to communicate with the Pmod AD1 via SPI, but the communication speed is slow.

I tested it with Arduino and Raspberry Pi in the same environment, and they were 20 times faster.

I can’t understand why the Jetson Orin Nano, which has better performance, is slower.

I checked the spi-max-frequency and it is confirmed to be 65000000.

 ![KakaoTalk_20240717_142352270](https://global.discourse-cdn.com/nvidia/original/4X/1/c/5/1c593e3c31429884e6a467f6cc01e40521b2ad90.png)

Below is the Python code.

Changing the sampling\_rate value up or down doesn’t make a difference.

```auto
import spidev
import struct
import time

# Define constants
sample_queue_size = 2000
device = "/dev/spidev0.0"
sampling_rate = 65000000 # (SPI maximum speed)

# Set up SPI
spi = spidev.SpiDev()
spi.open(0, 0) # Open SPI device
spi.max_speed_hz = sampling_rate

# Output file path
output_path = "output.out"

# Data collection
samples = []

start_time = time.time()

for _ in range(sample_queue_size):
    # Read data via SPI
    response = spi.xfer2([0x00, 0x00]) # Read data via SPI (modify according to actual command)
    value = ((response[0] & 0x0F) << 8) | response[1] # Convert to 12-bit data
    samples.append(value)

end_time = time.time()

# Measure and print time
elapsed_time = end_time - start_time
print(f"time elapsed: {elapsed_time:.6f} seconds")

# Save data to file
with open(output_path, "wb") as f:
    for value in samples:
        f.write(struct.pack('<H', value)) # Save 16-bit values in binary format (use lower 12 bits)

# Close SPI
spi.close()

```

---

<div class="post-metadata">

**Author:** ![KevinFFF](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/kevinfff/32/15508_2.png) [@KevinFFF](https://forums.developer.nvidia.com/u/KevinFFF)\
**Post date:** [July 19, 2024, 5:21am UTC](https://forums.developer.nvidia.com/t/configuring-spi-speed-for-jetson-orin-nano-developer-kit/300344/3 "2024-07-19T05:21:27Z")

</div>

Hi thirdxero1,

What’s your Jetpack version in use?

> [@thirdxero1](#):
>
> I checked the spi-max-frequency and it is confirmed to be 65000000.

It is relating to the parent clock for SPI interface.  
What’s your requirement for the SPI frequency?

---

<div class="post-metadata">

**Author:** ![thirdxero1](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@thirdxero1](https://forums.developer.nvidia.com/u/thirdxero1)\
**Post date:** [July 21, 2024, 1:15pm UTC](https://forums.developer.nvidia.com/t/configuring-spi-speed-for-jetson-orin-nano-developer-kit/300344/4 "2024-07-21T13:15:15Z")

</div>

Jetpack version is 5.1.3

and

PMOD AD1 uses an ADC chip called AD7476A

According to the AD7476A’s data sheet, the chip supports SPI radios up to 20MHz.

in the Python code

Changing the sampling\_rate value 20000000 doesn’t make a difference.

I confirmed that the communication speed was fast and that the speed changed when

the sampling\_rate (SPI speed) was adjusted during SPI testing on the Jetson Xavier NX.

However, on the Jetson Orin Nano Developer Kit, the speed does not change.

I upgraded the Jetpack version 6.0, but the speed remains the same.

---

<div class="post-metadata">

**Author:** ![thirdxero1](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@thirdxero1](https://forums.developer.nvidia.com/u/thirdxero1)\
**Post date:** [July 23, 2024, 2:04am UTC](https://forums.developer.nvidia.com/t/configuring-spi-speed-for-jetson-orin-nano-developer-kit/300344/6 "2024-07-23T02:04:46Z")

</div>

Jetpack version is 5.1.3

and

PMOD AD1 uses an ADC chip called AD7476A

According to the AD7476A’s data sheet, the chip supports SPI radios up to 20MHz.

in the Python code

Changing the sampling\_rate value 20000000 doesn’t make a difference.

I confirmed that the communication speed was fast and that the speed changed when

the sampling\_rate (SPI speed) was adjusted during SPI testing on the Jetson Xavier NX.

However, on the Jetson Orin Nano Developer Kit, the speed does not change.

I upgraded the Jetpack version 6.0, but the speed remains the same.

---

<div class="post-metadata">

**Author:** ![KevinFFF](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/kevinfff/32/15508_2.png) [@KevinFFF](https://forums.developer.nvidia.com/u/KevinFFF)\
**Post date:** [July 23, 2024, 5:57am UTC](https://forums.developer.nvidia.com/t/configuring-spi-speed-for-jetson-orin-nano-developer-kit/300344/7 "2024-07-23T05:57:36Z")

</div>

> [@thirdxero1](#):
>
> I confirmed that the communication speed was fast and that the speed changed when
> 
> the sampling\_rate (SPI speed) was adjusted during SPI testing on the Jetson Xavier NX.
> 
> However, on the Jetson Orin Nano Developer Kit, the speed does not change.

Do you mean that the issue is specific to Orin Nano? (i.e. it is working on Xavier NX)

Please share your device tree and dmesg for further check.

---

<div class="post-metadata">

**Author:** ![thirdxero1](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@thirdxero1](https://forums.developer.nvidia.com/u/thirdxero1)\
**Post date:** [July 24, 2024, 12:35am UTC](https://forums.developer.nvidia.com/t/configuring-spi-speed-for-jetson-orin-nano-developer-kit/300344/8 "2024-07-24T00:35:28Z")

</div>

> [@KevinFFF](#):
>
> the issue is specific to Orin Nano

yes the issue is specific to Orin Nano

share my device tree and dmesg  
[dmesg.txt](https://forums.developer.nvidia.com/uploads/short-url/ew5hWrh0Ovd4wGiSxGOPJ2jGyyL.txt) (58.7 KB)  
[kernel\_tegra234-p3768-0000+p3767-0005-nv.zip](https://forums.developer.nvidia.com/uploads/short-url/Qgye9ftsjD42HwIOwPGkypnXCf.zip) (36.7 KB)

---

<div class="post-metadata">

**Author:** ![KevinFFF](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/kevinfff/32/15508_2.png) [@KevinFFF](https://forums.developer.nvidia.com/u/KevinFFF)\
**Post date:** [July 27, 2024, 1:55am UTC](https://forums.developer.nvidia.com/t/configuring-spi-speed-for-jetson-orin-nano-developer-kit/300344/9 "2024-07-27T01:55:24Z")

</div>

> [@thirdxero1](#):
>
> yes the issue is specific to Orin Nano

Are you using Jetpack 5.1.3 for both Orin Nano and Xavier NX?

```auto
		spi@3210000 {
			compatible = "nvidia,tegra210-spi";
			..
			spi@0 {
				compatible = "tegra-spidev";
				reg = <0x00>;
				spi-max-frequency = <0x2faf080>;

```

Could you help to check if you have the same **spi-max-frequency** configuration as above for Xavier NX?

---

<div class="post-metadata">

**Author:** ![thirdxero1](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@thirdxero1](https://forums.developer.nvidia.com/u/thirdxero1)\
**Post date:** [July 29, 2024, 6:23am UTC](https://forums.developer.nvidia.com/t/configuring-spi-speed-for-jetson-orin-nano-developer-kit/300344/10 "2024-07-29T06:23:25Z")

</div>

Orin Nano 5.1.3 and Xavier NX 4.4.1

Xavier NX also has the same spi-max-frequency

share my Xavier NX device tree

[xavier\_nx\_device\_tree.txt](https://forums.developer.nvidia.com/uploads/short-url/vnn1FT9tQY6EfVNjESb6XzaEHvj.txt) (1.1 KB)

---

<div class="post-metadata">

**Author:** ![KevinFFF](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/kevinfff/32/15508_2.png) [@KevinFFF](https://forums.developer.nvidia.com/u/KevinFFF)\
**Post date:** [July 30, 2024, 8:29am UTC](https://forums.developer.nvidia.com/t/configuring-spi-speed-for-jetson-orin-nano-developer-kit/300344/11 "2024-07-30T08:29:28Z")

</div>

> [@thirdxero1](#):
>
> [xavier\_nx\_device\_tree.txt](https://forums.developer.nvidia.com/uploads/short-url/vnn1FT9tQY6EfVNjESb6XzaEHvj.txt) (1.1 KB)

From the device tree you shared, it seems using 65M as SPI max frequency on Xavier NX.  
(it is 50M(0x2faf080) for Orin Nano)

```auto
spi@3210000 {
    compatible = "nvidia,tegra186-spi";
    reg = <0x0 0x3210000 0x0 0x10000>;
    ..
    spi-max-frequency = <0x3dfd240>;

```

> [@thirdxero1](#):
>
> Orin Nano 5.1.3 and Xavier NX 4.4.1

Could you update Xavier NX to JP5.1.3 to clarify if it is relating to the Jetpack release or the module?

---

<div class="post-metadata">

**Author:** ![thirdxero1](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@thirdxero1](https://forums.developer.nvidia.com/u/thirdxero1)\
**Post date:** [July 31, 2024, 6:26am UTC](https://forums.developer.nvidia.com/t/configuring-spi-speed-for-jetson-orin-nano-developer-kit/300344/12 "2024-07-31T06:26:59Z")

</div>

Jetpack of Xavier NX cannot be updated. I think it is a kernel driver or module issue that does not solve the problem even if you update Orin Nano’s Jetpack version.

---

<div class="post-metadata">

**Author:** ![KevinFFF](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/kevinfff/32/15508_2.png) [@KevinFFF](https://forums.developer.nvidia.com/u/KevinFFF)\
**Post date:** [July 31, 2024, 3:27pm UTC](https://forums.developer.nvidia.com/t/configuring-spi-speed-for-jetson-orin-nano-developer-kit/300344/13 "2024-07-31T15:27:12Z")

</div>

> [@thirdxero1](#):
>
> Jetpack of Xavier NX cannot be updated.

Xavier NX should be available to be updated to JP5.1.3.

JP4.4.1 uses K4.9 and JP5.1.3 uses K5.10 so that the driver between them should be different.  
We want to clarify if the issue is caused from the driver or the module.

---

<div class="post-metadata">

**Author:** ![thirdxero1](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@thirdxero1](https://forums.developer.nvidia.com/u/thirdxero1)\
**Post date:** [August 8, 2024, 1:14am UTC](https://forums.developer.nvidia.com/t/configuring-spi-speed-for-jetson-orin-nano-developer-kit/300344/14 "2024-08-08T01:14:52Z")

</div>

I updated Xavier NX to JP5.1.3

The same symptoms as Jetson Orin Nano have been identified

Checked with the oscilloscope, the clock speed got faster

But the clock cycle has not accelerated

---

<div class="post-metadata">

**Author:** ![KevinFFF](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/kevinfff/32/15508_2.png) [@KevinFFF](https://forums.developer.nvidia.com/u/KevinFFF)\
**Post date:** [August 12, 2024, 5:17am UTC](https://forums.developer.nvidia.com/t/configuring-spi-speed-for-jetson-orin-nano-developer-kit/300344/15 "2024-08-12T05:17:25Z")

</div>

**There is no update from you for a period, assuming this is not an issue any more.  
Hence we are closing this topic. If need further support, please open a new one.  
Thanks**

So, it seems the issue is relating to the kernel driver.

> [@thirdxero1](#):
>
> But the clock cycle has not accelerated

How did you check the clock cycle?

---

<div class="post-metadata">

**Author:** ![kayccc](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/kayccc/32/14043_2.png) [@kayccc](https://forums.developer.nvidia.com/u/kayccc)\
**Post date:** [August 28, 2024, 1:56am UTC](https://forums.developer.nvidia.com/t/configuring-spi-speed-for-jetson-orin-nano-developer-kit/300344/17 "2024-08-28T01:56:05Z")

</div>


