Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 6960

Beginners • Raspberry Pi 5 - "out of memory error"

$
0
0
I’m using a Raspberry Pi 5 to control an 8x8 WS2812B LED matrix. The matrix is powered directly from the Raspberry Pi 5 (not from an external 5V power supply), and the data line is connected directly to a GPIO pin. The grounds are properly connected.

I'm fairly new to this so any help would be greatly appreciated!!

To control the matrix, I initially tried using the 'glowbit' library, but I ran into the following error:

Simple code I tried to run:

Code:

import glowbitmatrix = glowbit.matrix4x4(brightness = 255, rateLimitFPS = 5)

Code:

RuntimeError: ws2811_init failed with code -2 (out of memory)

Other things I’ve Tried:
1. Installed the latest version of rpi_ws281x:


pip install --break-system-packages rpi-ws281x
Still got the same hardware revision error.

2. Tried an alternative fork that supposedly supports Raspberry Pi 5:

pip install --break-system-packages rpi-ws281x-rpip5
No change; the error persists.

3. Manually modified rpihw.c to add an entry for Raspberry Pi 5, then recompiled using scons:

Even after rebuilding, the error remains.

4. Tried the solution from this GitHub issue:
https://github.com/jgarff/rpi_ws281x/issues/483

Gives a hardware revision error.

5. Tried using Adafruit’s neopixel library (adafruit-circuitpython-neopixel), with SPI (GPIO10) instead of PWM:

import board
import neopixel
pixels = neopixel.NeoPixel(board.D10, 64)
This resulted in a "ModuleNotFoundError: No module named 'neopixel'", despite installing the required CircuitPython libraries.

6. Checked GPIO and SPI settings:

- Enabled I2C and SPI via sudo raspi-config.
- Ran script as root (sudo python3 script.py).
- Verified power connections—everything seems fine.

Statistics: Posted by Hasitha — Mon Mar 24, 2025 12:50 am — Replies 0 — Views 28



Viewing all articles
Browse latest Browse all 6960

Trending Articles