# Pi Zero + DAC pHAT + Neopixels

**URL:** <https://forums.pimoroni.com/t/pi-zero-dac-phat-neopixels/2555>\
**Category:** Support\
**Created:** [June 23, 2016, 3:28pm UTC](https://forums.pimoroni.com/t/pi-zero-dac-phat-neopixels/2555 "2016-06-23T15:28:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![saulcozens](https://avatars.discourse-cdn.com/v4/letter/s/3e96dc/32.png) [@saulcozens](https://forums.pimoroni.com/u/saulcozens)\
**Post date:** [June 23, 2016, 3:28pm UTC](https://forums.pimoroni.com/t/pi-zero-dac-phat-neopixels/2555/1 "2016-06-23T15:28:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![RogueM](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/roguem/32/311_2.png) [@RogueM](https://forums.pimoroni.com/u/RogueM)\
**Post date:** [June 23, 2016, 6:34pm UTC](https://forums.pimoroni.com/t/pi-zero-dac-phat-neopixels/2555/2 "2016-06-23T18:34:48Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![saulcozens](https://avatars.discourse-cdn.com/v4/letter/s/3e96dc/32.png) [@saulcozens](https://forums.pimoroni.com/u/saulcozens)\
**Post date:** [June 23, 2016, 10:12pm UTC](https://forums.pimoroni.com/t/pi-zero-dac-phat-neopixels/2555/3 "2016-06-23T22:12:53Z")

</div>

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
