Help with NeoPio (NeoPixel using PIO on Raspberry Pi)

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
ShawnHymel
 
Posts: 10
Joined: Thu Sep 20, 2012 10:39 pm

Help with NeoPio (NeoPixel using PIO on Raspberry Pi)

Post by ShawnHymel »

I cannot seem to get the demo code working from the NeoPIO guide: https://learn.adafruit.com/neopio-drive ... o/overview. I did not make any modifications to the code, and I'm using CircuitPython v7.0.0.

I connected my logic analyzer (Analog Discovery 2) to the 74HC595 shift register. It appears that the SER, SRCLK, and RCLK lines are toggling, but the outputs all remain at logic high. I would expect these lines to toggle to control the serial data going to the NeoPixels.
neopio-la-01.png
neopio-la-01.png (82.45 KiB) Viewed 419 times
To make sure that my 74HC595 is working, I ran the demo code found on this tutorial: https://learn.adafruit.com/74hc595/overview. The only change I made was to support the Pico pin names:

Code: Select all

latch_pin = digitalio.DigitalInOut(board.GP1)
spi = busio.SPI(board.GP2, MOSI=board.GP3)
sr = adafruit_74hc595.ShiftRegister74HC595(spi, latch_pin)
Note: I did need to move my SER, SRCLK, and RCLK wires from GP0, GP1, GP2 (NeoPIO guide) to GP3, GP2, GP1 (shift register guide).

This seemed to at least confirm my shift register is working:
shift-reg-spi-01.png
shift-reg-spi-01.png (74.14 KiB) Viewed 419 times
Any help to debug the NeoPIO circuit/code would be appreciated!

User avatar
tannewt
 
Posts: 3305
Joined: Thu Oct 06, 2016 8:48 pm

Re: Help with NeoPio (NeoPixel using PIO on Raspberry Pi)

Post by tannewt »

Please try 7.1.0 beta and 6.3.0 to see if an issue was fixed or introduced around 7.0.0. I'd be surprised that we introduced a PIO bug since we use it for neopixel internally.

User avatar
ShawnHymel
 
Posts: 10
Joined: Thu Sep 20, 2012 10:39 pm

Re: Help with NeoPio (NeoPixel using PIO on Raspberry Pi)

Post by ShawnHymel »

Thanks @tannewt!

7.1.0-beta0 gives me the same behavior.

I downgraded to 6.3.0 and copied the contents of the "CircuitPython 6.x" from the NeoPIO downloaded code to my Pico. I'm now getting this error in REPL:

Code: Select all

code.py output:
Traceback (most recent call last):
  File "code.py", line 2, in <module>
  File "adafruit_led_animation/animation/rainbowcomet.py", line 29, in <module>
  File "adafruit_led_animation/animation/comet.py", line 30, in <module>
  File "adafruit_led_animation/color.py", line 27, in <module>
ImportError: no module named 'rainbowio'
"color.py" is actually a pre-compiled "color.mpy" file, so I can't really see how to change the incorrect import name in that library.

User avatar
tannewt
 
Posts: 3305
Joined: Thu Oct 06, 2016 8:48 pm

Re: Help with NeoPio (NeoPixel using PIO on Raspberry Pi)

Post by tannewt »

rainbowio didn't exist in 6.3 so that's why. What does a logic probe on the lines running to the shift register look like?

User avatar
ShawnHymel
 
Posts: 10
Joined: Thu Sep 20, 2012 10:39 pm

Re: Help with NeoPio (NeoPixel using PIO on Raspberry Pi)

Post by ShawnHymel »

They're in the first picture I added--it's the SER, SRCLK, and RCLK lines (first 3 signals) in the logic analyzer capture.

User avatar
tannewt
 
Posts: 3305
Joined: Thu Oct 06, 2016 8:48 pm

Re: Help with NeoPio (NeoPixel using PIO on Raspberry Pi)

Post by tannewt »

Ah, I haven't worked with a shift register recently enough to know. I'll ask someone else to take a look.

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

Re: Help with NeoPio (NeoPixel using PIO on Raspberry Pi)

Post by pburgess »

Can verify that the project does work with CircuitPython 7.0.0. Have blinkenlights blinken.

Are you using a 75HC595 specifically? There’s like a billion* 595 variants (HC, HCT and so forth). Also never hurts to have a 0.1 uF cap across the chip’s + and ground. The guide omits it and this one’s running OK on my desk right now, but you never know, it’s a best-practice thing.

* Not literally a billion, but a variety. Testing with a Fairchild MM74HC595N here.

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

Re: Help with NeoPio (NeoPixel using PIO on Raspberry Pi)

Post by pburgess »

Also verify SRCLR (pin 10) to + and OE (13) to ground.

User avatar
ShawnHymel
 
Posts: 10
Joined: Thu Sep 20, 2012 10:39 pm

Re: Help with NeoPio (NeoPixel using PIO on Raspberry Pi)

Post by ShawnHymel »

Thanks, @pburgess!

I see the same behavior (all Q outputs on the '595 are high) with CircuitPython 7.0.0 and 7.1.0-beta0. I get the error listed above with v6.3.0.

Verified that pin10 and pin13 are 5V and GND, respectively. I'm using a TI 74HC595N.

It does seem to work in using the code found in the 74HC595 Shift Register tutorial, as I showed in the second image.

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

Re: Help with NeoPio (NeoPixel using PIO on Raspberry Pi)

Post by pburgess »

Swapped out for same TI part here, still getting correct blinkenlights. Same hardware/software throughout now.

I notice your ’595 code mentions GP1-3, while the NeoPIO code by default uses GP0-2. Whichever you’re using, just make sure the two are in sync.

Might be post-a-photograph-of-your-circuit time. But first…is it one of those breadboards with split power rails that only run half the length?

User avatar
ShawnHymel
 
Posts: 10
Joined: Thu Sep 20, 2012 10:39 pm

Re: Help with NeoPio (NeoPixel using PIO on Raspberry Pi)

Post by ShawnHymel »

Here's my circuit. I just tried again: flash CircuitPython 7.0.0 to the device and then copy over the NeoPIO files to the CIRCUITPY drive. Still no luck...the output lines on the shift register stay high.
IMG-1437.jpg
IMG-1437.jpg (504.57 KiB) Viewed 372 times
Could it be a Windows thing? I know that the caching sometimes plays havoc with the drive. I've tried flushing/ejecting just to make sure, and I steer clear of Notepad++.

The '595 code I mentioned was from the Shift Register tutorial, which uses the SPI lines (instead of PIO). I swapped the SER/SRCLK to the SPI TX/SCK lines so it would work. For the NeoPIO code, I kept the the same GP0-2 pins (i.e. I did not modify the code).

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

Re: Help with NeoPio (NeoPixel using PIO on Raspberry Pi)

Post by pburgess »

Move the + rail (that powers the ’595) from VSYS (Pico pin 39) to 3.3V (pin 36). Any change? I’m speculating here that the USB supply voltage might be a bit higher than normal, and 3.3V logic from the Pico, combined with the short latch pulse in the PIO code, might be insufficient to register as a logic high.

If that doesn’t resolve it, I am Officially Stumped™. Have the same components, same circuit, same CircuitPython version and project code, and it works here. Only other idea I have then would be “do you have a second one of everything?”

User avatar
ShawnHymel
 
Posts: 10
Joined: Thu Sep 20, 2012 10:39 pm

Re: Help with NeoPio (NeoPixel using PIO on Raspberry Pi)

Post by ShawnHymel »

No luck :( I moved the rail pin to 3.3V out on the Pico. My scope shows the serial data (SER) going to the shift register (ch 1, yellow) and the first output pin on the shift register (QA) (ch 2, blue). There seems to be some weird artifacts in the SER data. Not sure if that affects things.
scope-shift.png
scope-shift.png (92.37 KiB) Viewed 352 times
I'll dig around for another shift register...I could have sworn I had a pack of them somewhere.

Failing that, I managed to get something working in C, but I was really hoping to use the Adafruit animations library. :)

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

Return to “Adafruit CircuitPython”