Tiny Core Linux

Tiny Core Base => Raspberry Pi => Topic started by: jgrulich on September 23, 2015, 08:13:02 AM

Title: fbtft TFT driver
Post by: jgrulich on September 23, 2015, 08:13:02 AM
I'm trying to bring working the 3.5' TFT Touchscreen. It's using the fbtft module with the following setup:

Code: (bash) [Select]
flexfb  width=320  height=480  regwidth=16 init=-1,0xb0,0x0,-1,0x11,-2,250,-1,0x3A,0x55,-1,0xC2,0x44,-1,0xC5,0x00,0x00,0x00,0x00,-1,0xE0,0x0F,0x1F,0x1C,0x0C,0x0F,0x08,0x48,0x98,0x37,0x0A,0x13,0x04,0x11,0x0D,0x00,-1,0xE1,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0xE2,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0x36,0x28,-1,0x11,-1,0x29,-3
fbtft_device debug=3 rotate=90 name=flexfb speed=16000000 gpios=reset:25,dc:24

I have the kernel modules for flexfb, it's in the staging directory. But it gives error message "Unknown parameter".

Has anybody experience with this driver, or any idea what to modify to bring this module working?
Title: Re: fbtft TFT driver
Post by: jgrulich on September 23, 2015, 09:23:20 AM
I've found that the LCD is supported by the generic tinylcd35 overlay. Unfortunately there are still some errors when loaded:
Code: (bash) [Select]
[    8.847700] fbtft: module is from the staging directory, the quality is unknown, you have been warned.
[    8.848245] fbtft: Unknown symbol fb_sys_write (err 0)
[    8.848278] fbtft: Unknown symbol sys_imageblit (err 0)
[    8.848316] fbtft: Unknown symbol sys_fillrect (err 0)
[    8.848588] fbtft: Unknown symbol sys_copyarea (err 0)
[    8.848701] fbtft: Unknown symbol fb_sys_read (err 0)
[    8.907968] ads7846: Unknown symbol hwmon_device_unregister (err 0)
[    8.908017] ads7846: Unknown symbol hwmon_device_register_with_groups (err 0)

Any idea what's wrong?
Title: Re: fbtft TFT driver
Post by: bmarkus on September 23, 2015, 09:27:45 AM
Jan

which piCore version and which kernel are you using?
Title: Re: fbtft TFT driver
Post by: jgrulich on September 24, 2015, 06:11:25 AM
piCore-7.0alpha2, kernel 4.1.6. Tested on Rasbian with the same kernel and it works.
I'd like to test on the latest TC version, but I don't have the kernel source files to make the modules.
Title: Re: fbtft TFT driver
Post by: bmarkus on September 24, 2015, 07:18:01 AM
Please update to the latest alpha release with 4.1.7 kernel. You can download all kernel modules from

http://tinycorelinux.net/7.x/armv6/releases/RPi/src/kernel/
http://tinycorelinux.net/7.x/armv7/releases/RPi2/src/kernel/
Title: Re: fbtft TFT driver
Post by: jgrulich on September 25, 2015, 05:46:45 AM
Hi Béla,

still the same error message:
Code: (bash) [Select]
modprobe: can't load module fbtft (kernel/drivers/staging/fbtft/fbtft.ko): unknown symbol in module, or unknown parameter

The same for the touchscreen controller:
Code: (bash) [Select]
modprobe: can't load module ads7846 (kernel/drivers/input/touchscreen/ads7846.ko): unknown symbol in module, or unknown parameter
Title: Re: fbtft TFT driver
Post by: jgrulich on September 25, 2015, 06:19:45 AM
This is the dmesg:
Code: (bash) [Select]
[    4.930700] fbtft: module is from the staging directory, the quality is unknown, you have been warned.
[    4.931069] fbtft: Unknown symbol fb_sys_write (err 0)
[    4.931091] fbtft: Unknown symbol sys_imageblit (err 0)
[    4.931112] fbtft: Unknown symbol sys_fillrect (err 0)
[    4.931223] fbtft: Unknown symbol sys_copyarea (err 0)
[    4.931300] fbtft: Unknown symbol fb_sys_read (err 0)

[   21.831099] ads7846: Unknown symbol hwmon_device_unregister (err 0)
[   21.831135] ads7846: Unknown symbol hwmon_device_register_with_groups (err 0)
Title: Re: fbtft TFT driver
Post by: bmarkus on September 25, 2015, 06:21:12 AM
Check module dependencies with modinfo, probably you must load additional modules.
Title: Re: fbtft TFT driver
Post by: jgrulich on September 25, 2015, 07:08:39 AM
Yes, you're right. It needs the video driver loaded first.
To switch to TFT I need con2fbmap. Please add to the repo.
Title: Re: fbtft TFT driver
Post by: bmarkus on September 25, 2015, 08:31:25 AM
Yes, you're right. It needs the video driver loaded first.
To switch to TFT I need con2fbmap. Please add to the repo.

Do not find con2fbmap source code.
Title: Re: fbtft TFT driver
Post by: Rich on September 25, 2015, 10:28:42 AM
Hi bmarkus
Is this of any use:
http://www.linuxquestions.org/questions/slackware-installation-40/how-to-get-displaylink-usb-to-show-text-console-4175527644/#post5290289
Title: Re: fbtft TFT driver
Post by: jgrulich on September 25, 2015, 01:49:52 PM
Good link. I'm using similar way now, two boot options of cmdline.txt. One with fbcon=map:10 and other without.
But this is not smart way to do so, if I need to switch it very often.
May be that there is some other way how to switch between fb0 and fb1 device output.
Title: Re: fbtft TFT driver
Post by: Rich on September 25, 2015, 01:53:25 PM
Hi jgrulich
Actually I posted the link because it listed where to find the source for con2fbmap.
Title: Re: fbtft TFT driver
Post by: jgrulich on September 25, 2015, 02:26:45 PM
Hi Rich,

I've tried several tricks in this link and several other, but still no lucky. I've tried to use this link:
Code: (bash) [Select]
https://github.com/notro/fbtft/wiki/Framebuffer-use

and tried to make the mirroring:

Code: (bash) [Select]
sudo apt-get install cmake
git clone https://github.com/tasanakorn/rpi-fbcp
cd rpi-fbcp/
mkdir build
cd build/
cmake ..
make
sudo install fbcp /usr/local/bin/fbcp

Cmake works well, but make gives error that bcm_host.h can't be found and stops working.
I've tried to locate this file in the Rasbian source, but still no lucky.
Please help with compilation to bring the mirroring  working.
Title: Re: fbtft TFT driver
Post by: Rich on September 25, 2015, 03:22:34 PM
Hi jgrulich
I'm not running a Raspberry Pi myself, but this doesn't look right:
Code: [Select]
sudo apt-get install cmakePi has a complete tool set for building called  compile-essentials.tcz,  and  cmake.tcz  is in the repository. You might also
need one of the Linux headers extensions installed.
Title: Re: fbtft TFT driver
Post by: szymtro on September 25, 2015, 05:23:57 PM
Been there, done that.

bcm_host.h is part of videocore. Find out one from 5.x - this will be good enought.
rpi-videocore and rpi-videocore-dev

If I remember corectly Markus said one thay that He will add videocore for 6.1 during a weekend.
Title: Re: fbtft TFT driver
Post by: jgrulich on September 26, 2015, 04:27:26 AM
Hi Rich,

sure, the tutorial is for Rasbian. I've used traditional TC setup to do so.
I've skipped the installation, because I've already installed all the stuff for the compilation including compile-essentials, linux api headers, pkg-config, binutils, etc.

There is only missing library for video core compilation.
Title: Re: fbtft TFT driver
Post by: bmarkus on September 26, 2015, 05:19:42 AM
For VideoCore files see

https://github.com/raspberrypi/firmware/tree/master/opt/vc

I will make a tcz later
Title: Re: fbtft TFT driver
Post by: jgrulich on September 26, 2015, 05:47:59 AM
I've used combination of old 5ver tcz and updated with the github source files and after some wrong files links correction it compiled and it works.
for those who like to use it, I share the file. The only disadvantage of this simple application is that there is no possibility to use different resolution for each display. It is only duplicator of fb0 to fb1, means that only VGA resolution may be used for HDMI display to have it reasonably visible on the small TFT. It need to have rpi-videocore.tcz to be installed.
Title: Re: fbtft TFT driver
Post by: andyj on September 26, 2015, 08:24:33 AM
Having used both GPIO and USB 2.8 inch screens successfully I can tell you that compiling in the modules makes life much easier. As for setting fbcon:map I don't know of another way other than to change it manually and reboot. An autodetect feature in the PI firmware would be needed, so I don't see that happening anytime soon.
Title: Re: fbtft TFT driver
Post by: jgrulich on September 26, 2015, 05:56:38 PM
The only way how to switch it is con2fbmap which switch the fbcon output to fb0, fb1 ...
I've tried the Rasbian one, but it's not working even with the videoroce installed. Still investigating what more it need to have installed.