pHAT DAC vs ws28128-rpi


#1

There is impossible to configure pHAT DAC HAT with other PWM Leds library because both uses the same GPIO PWM port (Physically 12 PIN). When play sound the led sequence STOP and then I am get error trying to play sound again.
¿How I can configure additional PWM port in Raspberry PI ZERO when use pHAT DAC?
Than you.


#2

The library works out most of the details for you, you should be able to just change the pin, as defined here, to a PWM supporting alternative: https://github.com/pimoroni/unicorn-hat/blob/master/library/UnicornHat/unicornhat.py#L9


#3

Yes I know but when change to anoher PWM pin obtain error when execute script
It is no possible to set or output pwm.


#4

you must use a PWM capable pin, obviously, as per commentary in the referenced line @gadgetoid posted. In practice, you should use bcm13 and PWM channel 1 (on line 13).


#5

It is not possible:

from neopixel import *

LED strip configuration:

LED_COUNT = 20 # Number of LED pixels.
LED_PIN = 13 # GPIO pin connected to the pixels (must support PWM!).

then:

sudo python strandtest.py
Gpio 13 is illegal for LED channel 0
Traceback (most recent call last):
File “strandtest.py”, line 83, in
strip.begin()
File “build/bdist.linux-armv6l/egg/neopixel.py”, line 115, in begin
RuntimeError: ws2811_init failed with code -11 (Selected GPIO not possible)
ioctl_set_msg failed
: Inappropriate ioctl for device
ioctl_set_msg failed
: Inappropriate ioctl for device


#6

please read the commentaries in the code and responses within this topic carefully… as mentioned you want channel 1, not 0. It works, I tried it when we decided to include a contributor’s pull request adding support for it.


#7

Yes.
I need two PWM output because One for Phat Dac and other for Led Strip.
The idea is led’s and sound works together in the same raspberry pi ZERO.


#8

yes, that is the whole point of addressing the WS28xx via an alternative pin… the DAC will pipe sounds out through the I2S interface as normal while you will be driving the neopixels over PWM ch 1, as indicated.