Overflow error with greater than 900 apa102 leds

Hello All,

Just soldered up a level shifter on a hat for the raspberry pi 4 running the latest build. I have BiblioPixel up and working after a bit of banging my head but I can run different color animations, change speed and brightness. The problem I have is running into an overflow error when using more than 900 or so leds. I have increased the spi buffer with spidev.bufsiz=65536 and verified it has taken with cat /sys/module/spidev/parameters/bufsiz when ever I try to run 1150 leds I get (output appended at end.)
per the pipixel documentation the buffer increase should get me to some where around 8000 leds but this looks like a hard coded python/spi problem. any suggestions?

Michael
yaml that I am runing
driver:
typename: SPI
interface: PYDEV
c_order: bgr
ledtype: APA102
num: 900
# shape: 60

animation:
typename: BiblioPixelAnimations.strip.Rainbows.RainbowCycle
run:
fps: 1
layout:
typename: strip
brightness: 10

Error dump.

(venv) pi@raspberrypiled:~/biblio $ bp init.yaml
INFO - interfaces - py-spidev dev /dev/spidev0.0 speed @ 1.00 MHz
Traceback (most recent call last):
File “/home/pi/biblio/venv/lib/python3.7/site-packages/bibliopixel/animation/animation.py”, line 150, in generate_frames
self._run_one_frame()
File “/home/pi/biblio/venv/lib/python3.7/site-packages/bibliopixel/animation/animation.py”, line 170, in _run_one_frame
self.layout.push_to_driver()
File “/home/pi/biblio/venv/lib/python3.7/site-packages/bibliopixel/layout/layout.py”, line 169, in push_to_driver
self.threading.push_to_driver()
File “/home/pi/biblio/venv/lib/python3.7/site-packages/bibliopixel/layout/update_threading.py”, line 92, in push_to_driver
self.update_colors()
File “/home/pi/biblio/venv/lib/python3.7/site-packages/bibliopixel/layout/update_threading.py”, line 82, in update_colors
d.update_colors()
File “/home/pi/biblio/venv/lib/python3.7/site-packages/bibliopixel/drivers/driver_base.py”, line 171, in update_colors
self._send_packet()
File “/home/pi/biblio/venv/lib/python3.7/site-packages/bibliopixel/drivers/SPI/base.py”, line 40, in _send_packet
self._interface.send_packet(self._packet)
File “/home/pi/biblio/venv/lib/python3.7/site-packages/bibliopixel/drivers/SPI/interfaces.py”, line 117, in send_packet
self._spi.xfer2(list(data))
OverflowError: Argument list size exceeds 4096 bytes.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/pi/biblio/venv/lib/python3.7/site-packages/bibliopixel/util/exception.py”, line 22, in report
function(*args, **kwds)
File “/home/pi/biblio/venv/lib/python3.7/site-packages/bibliopixel/layout/layout.py”, line 169, in push_to_driver
self.threading.push_to_driver()
File “/home/pi/biblio/venv/lib/python3.7/site-packages/bibliopixel/layout/update_threading.py”, line 92, in push_to_driver
self.update_colors()
File “/home/pi/biblio/venv/lib/python3.7/site-packages/bibliopixel/layout/update_threading.py”, line 82, in update_colors
d.update_colors()
File “/home/pi/biblio/venv/lib/python3.7/site-packages/bibliopixel/drivers/driver_base.py”, line 171, in update_colors
self._send_packet()
File “/home/pi/biblio/venv/lib/python3.7/site-packages/bibliopixel/drivers/SPI/base.py”, line 40, in _send_packet
self._interface.send_packet(self._packet)
File “/home/pi/biblio/venv/lib/python3.7/site-packages/bibliopixel/drivers/SPI/interfaces.py”, line 117, in send_packet
self._spi.xfer2(list(data))
OverflowError: Argument list size exceeds 4096 bytes.
Traceback (most recent call last):
File “/home/pi/biblio/venv/bin/bp”, line 16, in
main.main()
File “/home/pi/biblio/venv/lib/python3.7/site-packages/bibliopixel/main/main.py”, line 31, in main
module.run(args)
File “/home/pi/biblio/venv/lib/python3.7/site-packages/bibliopixel/commands/run.py”, line 12, in run
project_runner.run(args)
File “/home/pi/biblio/venv/lib/python3.7/site-packages/bibliopixel/project/project_runner.py”, line 57, in run
project.run()
File “/home/pi/biblio/venv/lib/python3.7/site-packages/bibliopixel/project/project.py”, line 150, in run
self.start()
File “/home/pi/biblio/venv/lib/python3.7/site-packages/bibliopixel/project/project.py”, line 112, in start
self.animation.start()
File “/home/pi/biblio/venv/lib/python3.7/site-packages/bibliopixel/animation/animation.py”, line 133, in start
self.threading.start()
File “/home/pi/biblio/venv/lib/python3.7/site-packages/bibliopixel/animation/animation_threading.py”, line 76, in start
self.target()
File “/home/pi/biblio/venv/lib/python3.7/site-packages/bibliopixel/animation/animation_threading.py”, line 36, in target
self.run()
File “/home/pi/biblio/venv/lib/python3.7/site-packages/bibliopixel/animation/animation.py”, line 142, in run_all_frames
for i in self.generate_frames():
File “/home/pi/biblio/venv/lib/python3.7/site-packages/bibliopixel/animation/animation.py”, line 150, in generate_frames
self._run_one_frame()
File “/home/pi/biblio/venv/lib/python3.7/site-packages/bibliopixel/animation/animation.py”, line 170, in _run_one_frame
self.layout.push_to_driver()
File “/home/pi/biblio/venv/lib/python3.7/site-packages/bibliopixel/layout/layout.py”, line 169, in push_to_driver
self.threading.push_to_driver()
File “/home/pi/biblio/venv/lib/python3.7/site-packages/bibliopixel/layout/update_threading.py”, line 92, in push_to_driver
self.update_colors()
File “/home/pi/biblio/venv/lib/python3.7/site-packages/bibliopixel/layout/update_threading.py”, line 82, in update_colors
d.update_colors()
File “/home/pi/biblio/venv/lib/python3.7/site-packages/bibliopixel/drivers/driver_base.py”, line 171, in update_colors
self._send_packet()
File “/home/pi/biblio/venv/lib/python3.7/site-packages/bibliopixel/drivers/SPI/base.py”, line 40, in _send_packet
self._interface.send_packet(self._packet)
File “/home/pi/biblio/venv/lib/python3.7/site-packages/bibliopixel/drivers/SPI/interfaces.py”, line 117, in send_packet
self._spi.xfer2(list(data))
OverflowError: Argument list size exceeds 4096 bytes.

That’s a limit to the PYDEV interface and cannot be changed - install python-periphery and change the interface to PERIPHERY

That worked well Thanks for the quick reply.

With 4000 APA102 type LED they are actually the most recent APA107 with a much faster refresh rate. The rainbow animations really slow at 225ms is this the limit ?

M

The driver uses a fixed SPI bus speed (Whatever the default is on the Pi - I think 12MHz) and unless you actively change it your faster APA107 won’t matter at all. In your config add spi_speed: 20 and try again. I’ve never used the APA107 so don’t know what the limits are - you may just have to try different values until it works well.

Thanks again. I had tried quite a few spi_speed settings and they all seem to produce anomalous behaviour Ill keep trying,

M

Sometimes there’s just a max limit before you have too much interference. Unfortunately I don’t have any APA107 on hand to try.