Pi Zero + DAC pHAT + Neopixels


#1

Hi,

I seem to be having some trouble getting my Pi Zero to use a DAC pHAT at the same time as driving some NeoPixels.

I’m using GPIO 13 for the Neopixels via the AdaFruit python library. as far as I know, that doesn’t clash with the DAC pHAT (which uses GPIO 19). And both work independently, but as soon as I try getting them both working, the NeoPixel library locks up on a call to show().

Has anyone else ever had a similar problem?

saul


#2

Hum, the pHAT DAC is not electrically connected on GPIO13, let alone trying to use it.

I’d have to dig into the Neopixel library, which is likely where things go wrong… perhaps it polls a pin used by the pHAT DAC?


#3

hmm - the Neopixel library drops into C pretty quickly and my C coding is very rusty,

I did notice this code though:
/**
* Wait for any executing DMA operation to complete before returning.
*
* @param ws2811 ws2811 instance pointer.
*
* @returns 0 on success, -1 on DMA competion error
*/
int ws2811_wait(ws2811_t *ws2811)
{
volatile dma_t *dma = ws2811->device->dma;

    while ((dma->cs & RPI_DMA_CS_ACTIVE) &&
           !(dma->cs & RPI_DMA_CS_ERROR))
    {
        usleep(10);
    }

    if (dma->cs & RPI_DMA_CS_ERROR)
    {
        fprintf(stderr, "DMA Error: %08x\n", dma->debug);
        return -1;
    }

    return 0;
}

I’m wondering whether the DAC pHAT uses DMA trtansfers too - this may be the clash. I’m not sure how the DMA stuff works - can you have 2 simultaneous DMAs over GPIO?

indent preformatted text by 4 spaces