53-11
Posts: 4
Joined: Thu Nov 12, 2015 3:22 pm

Low Definition fbtft SPI Display?

Thu Nov 12, 2015 5:31 pm

The question: Is it possible to make a custom fbtft_device that can format the SPI video packet as needed?

The setup:
I have 10m of the RGB LED strips (APA102 based -- https://www.adafruit.com/images/product ... PA102C.pdf). So I build up a very low definition screen -- 23 x 13 pixels. (I ordered a few more to make it a nice even 32x18)

I started with an Arduino and was able to get it to play videos from an SD card. This took a fair amount of pre-processing to decode the video, downscale, apply gamma correction, add the global/alpha byte, swap the B & R bytes, reverse every other line... to generate a raw byte stream that the Arduino can keep up with. After all that I was only able to get ~15fps out of it, and it was a pain to play a different video.

I switched to a RPi 2B (clean install of Raspbian via NOOBS) with the hopes of being able to stream videos directly from a file or even Youtube. Getting the SPI hardware working and streaming the pre-processed files was straight forward enough and it is MUCH faster than the bit-banged Arduino approach.

Now I'm having trouble getting video from the framebuffer. My first attempt was to make a copy of the fb0, process it, and send it out SPI. For the most part this worked except for it appears that omxplayer and other GPU programs don't use fb0.

It looks like the fbtft driver my be the right answer. Is it possible to make a custom fbtft_device that can format the SPI packet as needed? All I'm seeing in the documentation is the init packet and a few other minor tweaks.

I'm more of a hardware designer and all my previous real time video experience has been in FPGAs & verilog so I'm a little new to the Linux way of things. Any help pointing me in the right direction is greatly appreciated!

tvjon
Posts: 742
Joined: Mon Jan 07, 2013 9:11 am

Re: Low Definition fbtft SPI Display?

Fri Nov 13, 2015 12:43 pm

I imagine you could make a cheap moving message display using those.

The sense hat (Astro Pi sub forum) creates a

/dev/fb1

device,

https://github.com/RPi-Distro/python-sense-hat

which may help.

AndyD has some great source examples for dispmanx etc., which may give you some ideas.

https://github.com/AndrewFromMelbourne

53-11
Posts: 4
Joined: Thu Nov 12, 2015 3:22 pm

Re: Low Definition fbtft SPI Display?

Thu Nov 19, 2015 4:04 am

My plan is a little more abstract than a moving message display. I find myself doing a fair amount of music discovery via YouTube, and I feel like the music video affects my opinion of the song (good & bad). However, the video helps set the mood of the song. The attempt is to build a method of playing music videos where the mood it preserved but the distractions are lost. (and I had a bunch of LEDs from my Halloween costume I didn't want to put in a drawer).

Either way I think I found a solution. tasanakorn's rpi-fbcp (https://github.com/tasanakorn/rpi-fbcp) manages to pull off duplicating the primary display to a small LCD that is setup of fb1 as a background service. This is the same method as AndyD's raspi2fb uses.

It looks like grabbing the GPU output can be done with vc_dispmanx_snapshot & vc_dispmanx_resource_read_data. From here I can manipulate the data as needed and then send it out SPI. The plan is to set this up as a service and then anything that shows up on the primary display will be scaled and replicated on the low-def display.

Time to get back to soldering...

Return to “Other projects”