Adafruit CircuitPython on the Jetson Orin Nano

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Stvenmobile
 
Posts: 8
Joined: Thu Jun 01, 2023 5:28 pm

Adafruit CircuitPython on the Jetson Orin Nano

Post by Stvenmobile »

I am trying to get an Adafruit 1.5" SSD1351 OLED display working on a Jetson Orin Nano NX DevKit. I have followed the instructions for enabling CircuitPython on the Jetson Nano and that all went well (no errors encountered). However there are obviously some differences between the Jetson Nano and the Jetson Orin Nano NX...

When I try to access the display in python code I am getting the errors below indicating the device is not found, and it is true that when I execute 'ls' I see no SPI devces:

steve@orin:~$ ls /dev/i2c* /dev/spi*
ls: cannot access '/dev/spi*': No such file or directory
/dev/i2c-0 /dev/i2c-10 /dev/i2c-2 /dev/i2c-4 /dev/i2c-6 /dev/i2c-8
/dev/i2c-1 /dev/i2c-11 /dev/i2c-3 /dev/i2c-5 /dev/i2c-7 /dev/i2c-9

I did add myself to the gpio group and update the rules...
And the display is physically wired to pins 18, 19, 22, 23, 24...
Any ideas on what I might try next to get this working?

thanks,
Steve


File "/home/steve/.local/lib/python3.8/site-packages/adafruit_blinka/microcontroller/generic_linux/spi.py", line 25, in __init__
self._spi = spi.SPI(device=(portid, 0))
File "/home/steve/.local/lib/python3.8/site-packages/Adafruit_PureIO/spi.py", line 149, in __init__
raise IOError(f"{device} does not exist")
OSError: /dev/spidev0.0 does not exist
Exiting...
Cleaning up pins

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Adafruit CircuitPython on the Jetson Orin Nano

Post by mikeysklar »

Did you enable i2c and spi under raspi-config --> Interfacing Options?

User avatar
Stvenmobile
 
Posts: 8
Joined: Thu Jun 01, 2023 5:28 pm

Re: Adafruit CircuitPython on the Jetson Orin Nano

Post by Stvenmobile »

Since the platform is a Jetson Orin, the setup is a bit different. There is a configuration GUI to set the specific GPIO pins for SPI - I did run that.

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Adafruit CircuitPython on the Jetson Orin Nano

Post by mikeysklar »

The issue of getting valid SPI and I2C devices to show up at the OS level needs to be resolved. You will get better support over in the NVIDIA forums like this example.

User avatar
Stvenmobile
 
Posts: 8
Joined: Thu Jun 01, 2023 5:28 pm

Re: Adafruit CircuitPython on the Jetson Orin Nano

Post by Stvenmobile »

Thanks MikeySkylar. I was thinking the issue might be that the library code was checking for a specific device name, and the device name for Jetson Orin was not included in the code. Your point that the OLED display should still be displayed as being present at the os level is valid. I’ll see if the nvidia forum has any thoughts on this - not about using the adafruit library, but just the device not showing up.

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Adafruit CircuitPython on the Jetson Orin Nano

Post by mikeysklar »

Once the /dev/spi* and /dev/i2c* are available we should be able to assist with any library issues.

User avatar
Stvenmobile
 
Posts: 8
Joined: Thu Jun 01, 2023 5:28 pm

Re: Adafruit CircuitPython on the Jetson Orin Nano

Post by Stvenmobile »

I have learned a little bit more about the issues with I2C and the Jetson Orin Nano. The Jetson Orin Nano developers kit does support I2C, however the interface has been established using i2c bus number 7. I was able to get the i2c working with an SSD1306 oled display since the Adafruit_SSD1306 library supports an input parameter for the bus (and I was able to specify i2c_bus=7). This allowed me to use the i2c bus and display information on the OLED without errors.

I am having problems trying to get this to work on a PCA9685 board, since the same parameter for the i12c bus is not supported in any of the PCA9685 libraries as far as I can tell. Instead, the library tries to identify the hardware platform (like Raspberry Pi or Beaglebone) and then assign an appropriate bus.

Here is the i2cdetect command on the jetson Orin Nano showing the device occupying address 40 on i2c bus #7:

teve@orin:~/python/robot$ sudo i2cdetect -r -y 7
[sudo] password for steve:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: 40 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: 70 -- -- -- -- -- -- --

Do you know of any way I can get the adafruit-circuitpython-pca9685 library (or any of the servokit libraries) to work with devices on this bus?

thanks

User avatar
Stvenmobile
 
Posts: 8
Joined: Thu Jun 01, 2023 5:28 pm

Re: Adafruit CircuitPython on the Jetson Orin Nano

Post by Stvenmobile »

Also one more thing. While I do not have an SPI interface enabled, I am only trying to use I2C, so I don't see why an SPI device would be required.

steve@orin:~$ ls /dev/i2c* /dev/spi*
ls: cannot access '/dev/spi*': No such file or directory
/dev/i2c-0 /dev/i2c-10 /dev/i2c-2 /dev/i2c-4 /dev/i2c-6 /dev/i2c-8
/dev/i2c-1 /dev/i2c-11 /dev/i2c-3 /dev/i2c-5 /dev/i2c-7 /dev/i2c-9
steve@orin:~$

User avatar
Stvenmobile
 
Posts: 8
Joined: Thu Jun 01, 2023 5:28 pm

Re: Adafruit CircuitPython on the Jetson Orin Nano

Post by Stvenmobile »

Never got a response on this. Here's a short summary of the situation. The Jetson Orin Nano sets up its I2C on bus #7. Not sure why, but this is the only one available. I am able to use this bus properly with the Adafruit OLED libraries, since they include an input parameter allowing me to specify the bus to be used. I am not seeing that option in the Adafruit PCA9685 libraries for managing servos. Am I missing the right way to do this, or can an input parameter to specify the bus number be added to the adafruit-circuitpython-pca9685 library?

thanks,
Steve

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Adafruit CircuitPython on the Jetson Orin Nano

Post by mikeysklar »

You can set the i2c bus using the CircuitPython PCA9685 library initializer.

Code: Select all

classadafruit_pca9685.PCA9685(i2c_bus: I2C, *, address: int = 64, reference_clock_speed: int = 25000000)

Code: Select all

import board
import busio
import adafruit_pca9685
i2c = busio.I2C(board.SCL, board.SDA)
pca = adafruit_pca9685.PCA9685(i2c)
Change the I2C board.SCL and board.SDA to the ones your Jetson is connected to.

eg.

Code: Select all

i2c = busio.I2C(board.SCL_1, board.SDA_1)
If the above board definitions are off you can try using pins 3 (SDA) and 5 (SDL) which are your I2C bus #7 pins.

Code: Select all

i2c = busio.I2C(board.D5, board.D3)

User avatar
Stvenmobile
 
Posts: 8
Joined: Thu Jun 01, 2023 5:28 pm

Re: Adafruit CircuitPython on the Jetson Orin Nano

Post by Stvenmobile »

Many thanks. I'll give this a try.

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”