Skip to content

NeoPixel library not working on the Jetson Nano 4gb #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Thesis123123 opened this issue Jan 25, 2024 · 7 comments
Open

NeoPixel library not working on the Jetson Nano 4gb #38

Thesis123123 opened this issue Jan 25, 2024 · 7 comments

Comments

@Thesis123123
Copy link

Followed this guide for installing blinka

https://learn.adafruit.com/circuitpython-libraries-on-linux-and-the-nvidia-jetson-nano/initial-setup

and this guide for the neopixel

https://learn.adafruit.com/circuitpython-libraries-on-linux-and-the-nvidia-jetson-nano/neopixels-with-spi

Ran the blinka test with no errors or warning

import board
import digitalio
import busio

print("Hello blinka!")

# Try to great a Digital input
pin = digitalio.DigitalInOut(board.D4)
print("Digital IO ok!")

# Try to create an I2C device
i2c = busio.I2C(board.SCL, board.SDA)
print("I2C 1 ok!")
i2c = busio.I2C(board.SCL_1, board.SDA_1)
print("I2C 2 ok!")

print("done!")
jetson@jetson-desktop:~/MasterAPP$ python3.7 Blinkatest.py
Hello blinka!
Digital IO ok!
I2C 1 ok!
I2C 2 ok!
done!
Exiting... 
Cleaning up pins
jetson@jetson-desktop:~/MasterAPP$ 

And running the example code again for the strips

import time
import board
import neopixel_spi as neopixel

NUM_PIXELS = 12
PIXEL_ORDER = neopixel.GRB
COLORS = (0xFF0000, 0x00FF00, 0x0000FF)
DELAY = 0.1

spi = board.SPI()

pixels = neopixel.NeoPixel_SPI(
    spi, NUM_PIXELS, pixel_order=PIXEL_ORDER, auto_write=False
)

while True:
    for color in COLORS:
        for i in range(NUM_PIXELS):
            pixels[i] = color
            pixels.show()
            time.sleep(DELAY)
            pixels.fill(0)

Again no errors thrown by the program. The error below is when i did the cancaled the program with ctrl + c.

jetson@jetson-desktop:~/MasterAPP$ python3.7 Backlight.py
^CTraceback (most recent call last):
  File "/home/jetson/MasterAPP/Backlight.py", line 55, in <module>
    time.sleep(DELAY)
KeyboardInterrupt
Exiting... 
Cleaning up pins

Data pin is on pin 19 of the carrier board. Can confirm 5v power on the actual leg of the SK6812. I probed pin 19 with an oscilloscope and no signal was present. confirmed that spi/dev is also present

jetson@jetson-desktop:~/MasterAPP$ ls /dev/i2c* /dev/spi*
/dev/i2c-0  /dev/i2c-1  /dev/i2c-2  /dev/i2c-3  /dev/i2c-4  /dev/i2c-5  /dev/i2c-6  /dev/spidev0.0  /dev/spidev0.1  /dev/spidev1.0  /dev/spidev1.1
jetson@jetson-desktop:~/MasterAPP$ 

Nvidia Jetson nano 4GB, Ubuntu 18.04, Jetpack 4.6.4

I can confirm that the strips are working fine becuase when i used an RPi Pico with the adafruit neopixel library, it had no problem lighting up all the colors

Am i doing something wrong here? I looked at previous issues and one was similar but #31 but it was closed without any other comments on how it was fixed.

Any ideas what might have gone wrong?

@caternuson
Copy link
Collaborator

The error below is when i did the cancaled the program with ctrl + c

That's not an error. It's the expected stack trace when exiting via . It throws a KeyboardInterrupt exception. The actual code line referenced is just where the code was when was hit.

I probed pin 19 with an oscilloscope and no signal was present.

Probably using the wrong pin then. Are you probing physical pin 19, i.e. SPI1_MOSI? Or the pin that is digital IO 19, i.e D19?

@Thesis123123
Copy link
Author

Probably using the wrong pin then. Are you probing physical pin 19, i.e. SPI1_MOSI? Or the pin that is digital IO 19, i.e D19?

Physical pin 19, the one where there is the number 19 written on the board

image

Which one should i be using?

@caternuson
Copy link
Collaborator

Hmm...that looks like the correct pin. @makermelissa any ideas? Does the Jetson require anything special for enabling SPI? Looks OK to me based on /dev entries. But don't have HW to test directly.

@makermelissa
Copy link
Collaborator

When I last checked it out, you did have to enable it. The guide explains here: https://learn.adafruit.com/circuitpython-libraries-on-linux-and-the-nvidia-jetson-nano/initial-setup#enable-uart-i2c-and-spi-3039597

It's possible things have changed since it's been a few years since I last updated the guide.

@Thesis123123
Copy link
Author

When I last checked it out, you did have to enable it. The guide explains here: https://learn.adafruit.com/circuitpython-libraries-on-linux-and-the-nvidia-jetson-nano/initial-setup#enable-uart-i2c-and-spi-3039597

It's possible things have changed since it's been a few years since I last updated the guide.

Yes have done these step, and i just rechecked it, SPI1 are still checked.

image

I tried using i2c-6 and didnt have any problems, SPI seems to be the only one not working.

I even tried doing a blink test on pin 19 (D10).

import time
import board
import neopixel_spi as neopixel
import digitalio

led = digitalio.DigitalInOut(board.D10)
led.direction = digitalio.Direction.OUTPUT
 
while True:
    led.value = True
    time.sleep(0.5)
    led.value = False
    time.sleep(0.5)

The signal was there when i probed it

@Laura-VFA
Copy link

Hi there, did anyone solve this? I am struggling with the same problem :(

@klsetzer
Copy link

Hi there, did anyone solve this? I am struggling with the same problem :(

My and one of my colleagues have spent the last two days going down this road. We've followed the same steps as @Thesis123123 . One of us managed to get some activity on the spi1 bus, but it looks like random TTL noise, and the neopixel strip lights the first 5 leds randomly. Sometimes running the script gives no results on the neopixel strip.

# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT

import time
import board
import neopixel_spi as neopixel

NUM_PIXELS = 20
PIXEL_ORDER = neopixel.GRB
COLORS = (0xFF0000, 0x00FF00, 0x0000FF)
DELAY = 1.1

spi = board.SPI()

pixels = neopixel.NeoPixel_SPI(
    spi, NUM_PIXELS, pixel_order=PIXEL_ORDER, auto_write=False
)

for i in range(NUM_PIXELS):
    pixels[i] = 0xFF0000
    pixels.show()
time.sleep(9999)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants