Issue: PhatDac on Pi Zero with pigpio and moode 6.3

Hi there,

I own several pi zeros with PhatDac module, great combination with moode audio 6.3!

One Pi Zero should control some IR devices, and because I always have problems with lirc, I switched over to pigpio, which is great for this purpose.
But this combination leads to problems:
Without the pigpiod the sound is fine and everything works, but as soon as I start the daemon, there are two cases:
(1) pigpiod start without options: The sound gets very slow and deep, that’s very bad. It seems this is a conflict with the used PCM, therefore I tried the next. (IR works in this case)
(2) pigpiod start with option “-t 0”: This way it uses PWM and the sound’s still fine. But as soon as I send something via IR using the pigpio functionality it sounds like I can hear the transmission and the sound get’s a bit crazy then, unrepairable. Also IR doesn’t really work.

So in summary it seems like there’s a conflict with raspberry sources in both cases.
I currently assume it’s a resource conflict between pigpio and the PHATDAC module.

Do you maybe have an idea which resources this might be and how to workaround this problem?
Could someone help me to find all resources used by the phatdac module? (DMA? anything else?)
And is there a possibility to configure the usage of other resources? This could give me the possibility to test…

Thanks for all input!

Best regards,

The pHat DAC pinout is here if that helps

Thanks, I already checked this.
Doesn’t seem to include any relevant info regarding used internal resources.

Ok, where your at is above my skill level. Linux wise anyway.

What a pitty, hoped to get more info here.
Until now I just know that PCM is used for sound, not sooo helpful ;-)
And it seems I can’t use pigpio while playing sound, but no detailed info.

Anyone from pimoroni with more information about the PHATDAC?

Phil @gadgetoid or Sandy @sandyjmacdonald may have the info your looking for.

EDIT: Isn’t i2s for sound?

As far as I understand it, the I2s GPIOs are used to transmit the PCM data instead of using the PCM GPIOs. Could someone confirm?
So it seems PCM is somehow used and that interferes with pigpio …
I hope that Phil @gadgetoid or Sandy @sandyjmacdonald can give more details?

What module are you using for the IR?

Ok, I think I’m finally starting to wrap my head around what’s going on.
The pHat DAC is using i2s, but on the GPIO pins usually used for PCM.
So when you enable PCM that messes up the pHat DAC?

Hi, I used some IR Led that I had and an appropriate resistor. Nothing special

I’m confused now. I thought it’s using the I2s pins for pcm data?
When using pigpio with PCM the sound is all the time slowed down and very deep. But IR works well.
When using pigpio with PWM the sound is fine first but gets very crazy (I think mixed with IR transmission data) as soon as I send IR commands. IR also doesn’t work well.
Both methods somehow influence the sound…

What pin is the LED connected to?

BCM14 was the receiver for learning codes and BCM15 is the transmitting IR LED.

I got some feedback of the pigpio maintainer:

If you are using waves to generate the IR signal you will not be able
to use either of PWM or PCM for sound.…nt_working
You will have to find an IR alternative. Perhaps LIRC or look at one
of the other libraries such as wiringPi or bcm2835.

The question for me is now if there’s another way for the usage of the PhatDac than PCM? I suppose not and therefor need to switch back from pigpio to lirc (I don’t know the other two or if I run into similar problems using the PhatDac. Any experiences?

But regarding the problems with lirc I had before switching to pigpio it could have been a similar resource issue… I remember I programmed the lirc control using python and never ran into issues during my tests but as soon as I started to play music and used lirc it got always stuck after some commands.
It currently feels like the PhatDac is not the right module for my use-case :-(

Don’t take this the wrong way, but one could argue that maybe you should use something other than PIGPIO (if thats possible) or a different IR solution.
I’m thinking the use of any DAC for sound is going to have the same problem, they all use i2s, as far as I know anyway.
I used an older version of this with my Pirate Radio / pHat Beat (DAC).

I should mention that although I did get it working, it would sometimes just stop working. I never did sort out why? More than likely an error in my code.