Unusual behaviour when using Unicorn HAT


I have two Raspberry Pi 3 boards, one of which has a Unicorn HAT that I bought in January.

A few months ago, I noticed that when starting or stopping a light show, the unit would start to hang for a few seconds.

This then turned into the unit hanging for several seconds followed by the forced unmounting of the microSD card.

More recently, the unit has been running a light show properly for a few seconds up to a minute, then gradually distorting before fading to red and staying on the display, even past shutting the unit down; removal of power is needed for the display to blank. Demonstrated in this video here.

I moved the HAT over to my other unit when it was freezing and unmounting, installed the Unicorn HAT software onto that unit, and the same behaviour happens over there, too.

I’ve ensured that audio is set to be over HDMI only.

Any thoughts on what could be causing this? Thanks!


I think this is related: [SOLVED] Problems with Unicorn pHAT Software

It’s clearly, despite my original hypothesis that it was power related, a software issue. Possibly also a solved one, too.


I was so excited for a moment. It looked like that actually had fixed the problem. I felt that the sample script ran for a bit longer than it previously had before changing the value from 5 to 10 (could be coincidental or simply all in my head), but it ended up doing the same thing as in my video: a few bright flashes, freezing over of the display, and fading to the reds, requiring the power to be physically cut from the Pi to have the Unicorn HAT to turn off.

The strange thing is that since it started doing the flash/freeze/fade, it seems to have stopped unmounting my microSD (I think some people have been instead saying that their microSD goes into read-only mode, but mine seems worse than that — not a single menu will work).

It’s acting like it had brain damage: it had difficulty thinking, then starts makes everything stop working altogether, then starts having seizures that it won’t really come out of.


Thank you for testing this- that’s extremely useful. It’s possible you could have another issue alongside the DMA channel one but it’s unfortunately not something I’ve seen before- so we might have a bit of debugging back and forth on our hands.

Does the fade-to-red-and-die happen on all of your Pi boards?


My pleasure. Whatever I can do to get things working again. And thank you for assisting me.

I only know that it used to unmount the microSD on both boards, but I haven’t tried moving the HAT back to my other one since the fade-to-red-and-die.

I’ll try on the other Pi in about eight hours when I’ll be near the other Pi.


Okay, well now I’m just totally confused.

I moved the HAT over to my other board and tried it out. I did not have the fade-to-red-and-die issue on the other board after leaving it running for about three minutes, but I did have it lag when quitting a script, and realised that it did put the microSD into read-only mode. I’ve seen several reports of that happening before, but it never happened to me before — instead, it would always force unmount the microSD and cause everything to stop functioning, and result in some mighty unhappy cards.

In terms of the difference between the boards, they’re both made in the UK, and both Raspberry Pi 3 Model B V1.2 with the 2015 copyright date on them; the only difference that I can see is that the USB ports on the fade-to-red-and-die board say GCT on the metal casing, but nothing is written in the same spot for the board that went into read-only mode.

Edit: I tried the sudo pip install unicornhat --upgrade for the board that had the fade-to-death-and-die problem, and it’s still happening.


Did you move the SD card over between Pi’s when moving the HAT? Just to try and eliminate the hardware being at fault.

I’m struggling to find a rational explanation for what’s going on here, but it must be a software problem. The way in which the Unicorn HAT software works is sufficiently complicated enough that it leaves plenty of room for weirdness.


I didn’t. I used the microSD that was already on the other Pi.


So, installing that update on the initial board didn’t fix anything, though after installing it on the second board, the read-only mode is solved and it has been running fine for hours.

I still have no idea why the two boards were experiencing different problems, and why only one was fixed by the update, but that’s what my experience is, so I’ve simply swapped the HAT onto my other board, and hopefully things will stay running smoothly.


So here’s another update. I’ll first note that these HATs aren’t used often; maybe once for a few minutes every month or two.

As the problem wasn’t present on another Raspberry Pi, I switched the two Pis around. The Unicorn HAT has remained working fine on that unit until a few days ago, when it started doing the fade-to-red-and-die problem on that unit, too.

So, now I’m at a complete loss. I have no idea how to explain what’s going on.

I’ll also note that I have Unicorn HAT HD units, too, and they have experienced no issues on any units, aside from some scripts like raspbicam.py simply not working.