Run sudo raspi-config and in the “Overclock” options set the core frequency to 350 MHz or less. Reboot and see if the image is stable. There seems to be an issue when toggling GPIO too quickly.
Also see the “Driving Matrices” page for notes about dialing back the GPIO speed.
If you’re interfacing to any 1-wire devices, and if you’ve enabled 1-wire via raspi-config, you’ll need to use something other than the default pin 4. Pins 19 or 25 make good choices. Look for the line in /boot/config.txt where 1-wire is enabled and tell it which pin to use: