question

stnz avatar image
stnz asked

Venus 2.85, Raspberry Pi, 3.5" TFT and framebuffer assignment

Hello,

Short question, is the Venus OS GUI somehow hardcoded to run on specific framebuffer device number and how to change that? Or any other idea what I'm doing wrong with RB3+, a 3.5" SPIO TFT display and Venus 2.85?

In every other article and blog the TFT seems to show up as /dev/fb1, but I'm getting this:

root@raspberrypi2:~# cat /proc/fb
0 simple
1 BCM2708 FB
2 fb_ili9486

So, the TFT seems to be sitting at /dev/fb2 and in theory works fine there, but the GUI doesn't work.

After a lot of experimenting I have the screen running ok for console and calibration, basically with the settings below but the GUI never shows up. I see the console boot messages and a root prompt on the screen, but nothing else. Removing the headless file doesn't change anything, so I assume it's just trying to draw on wrong fb device.

config.txt:

[all]
dtparam=spi=on
hdmi_force_hotplug=1
dtoverlay=tft35a, rotate=270
display_default_lcd=1

cmdline.txt:

dwc_otg.lpm_enable=0 fbcon=map:2 console=tty1 consoleblank=300
Venus OSRaspberry Pi
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

4 Answers
Kevin Windrem avatar image
Kevin Windrem answered ·

There is code in /opt/victronenergy/gui/start-gui.sh that looks for fb0 and uses that. You might play around with that and see if you can move the GUi to fb2. I don't know if that will work however.

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

stnz avatar image
stnz answered ·

Oo, thanks. Will take a look and report back. :)

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

stnz avatar image
stnz answered ·

Meh, no. Actually that code only seems to check the resolution from fb0 and set that to a variable, not actually start the GUI on it. So it's hardcoded somewhere else.

I assume the solution would be to get the framebuffer device order correct, but I cannot figure out how..

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

kivanov avatar image
kivanov answered ·

I have the same screen - cheap 3.5 inch LCD SPI screen based on xpt2046.

Seems that /dev/fb0 is hardcoded in the binary: /opt/victronenergy/gui/gui

I managed to get this working with a very dirty hack:

If you have set all driver and console stuff and have the screen showing the serial console, you can try the following:


First check the actual framebuffer device created by the driver:

root@raspberrypi2:~# dmesg | grep graph
[    3.157670] graphics fb2: fb_ili9486 frame buffer, 480x320, 300 KiB video memory, 32 KiB buffer memory, fps=33, spi0.0 at 16 MHz

root@raspberrypi2:~# ls -alh /dev/fb*
fb   fb0  fb1  fb2  
root@raspberrypi2:~# cat /proc/fb
0 simple
1 BCM2708 FB
2 fb_ili9486    #this one is the display set by the driver, so we need to output console to it and also to force the GUI to output there as well

Then, did the bellow:

mv /dev/fb0 /dev/fb9
ln -s /dev/fb2 /dev/fb0
export TSLIB_TSEVENTTYPE=INPUT
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_TSDEVICE=/dev/input/touchscreen0
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONFFILE=/etc/ts.conf
export TSLIB_PLUGINDIR=/usr/lib/ts
export QWS_MOUSE_PROTO=tslib:/dev/input/touchscreen0

Then, run

/opt/victronenergy/gui/gui

and check whether the Victron GUI will show up on the screen.


Then you can proceed the actual calibration process, etc. (that the variables above are for). I finally added the above lines to /opt/victronenergy/gui/start-gui.sh.

The more elegant solution would be using udev, but I did not manage to set it up.

5 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

jeroen avatar image jeroen ♦ commented ·

Can you try just adding '-display Linuxfb:/dev/fb2' as an argument for the gui in start-gui.sh?

I am not sure that tslib is needed at all. What happens if the touchscreen0 is used directly (which is the default if it exists)?

0 Likes 0 ·
Show more comments