notro / fbtft

Linux Framebuffer drivers for small TFT LCD display modules. Development has moved to https://git.kernel.org/cgit/linux/kernel/git/gregkh/staging.git/tree/drivers/staging/fbtft?h=staging-testing
1.86k stars 495 forks source link

fbtft for Waveshare 2.2inch 320x240 Touch LCD (μPD161704A) #77

Closed ppiwowar closed 9 years ago

notro commented 10 years ago

Please provide some more info.

ppiwowar commented 10 years ago

Right away! Sorry, my text somehow dissapeard.

I would like to use this display with fbtft: -LCD  controler μPD161704A (or hitachi BD663474 ), display LTM022A69B -TouchScr controler XPT2046 (hope to be able to do it throught pure configuration)

This display works for me nicely with domo program attached on RPi. http://www.wvshare.com/product/2.2inch-320x240-Touch-LCD-A.htm Regards, Pawel

17:22 wtorek, 2014-2-4, notro notifications@github.com napisał(a):

Please provide some more info. — Reply to this email directly or view it on GitHub.

notro commented 10 years ago

http://www.waveshare.net/datasheet/LCD_en_PDF/UPD161704A.pdf That controller is not supported. It uses registers 0x0006 and 0x0007 to set the GRAM update starting point (setaddrwin() in FBTFT). None of the FBTFT drivers uses these registers.

Depending on your skills, you can try and make a driver for this controller. Use the regular FBTFT image and follow this guide: https://github.com/notro/fbtft/wiki/Development

ppiwowar commented 10 years ago

Thanks a lot. I do not think, I could make such a driver in a reasonable timeframe.  In the meantime I have bought HY28B display, I want to play with. FBTFT is great !

21:21 piątek, 2014-2-7, notro notifications@github.com napisał(a):

http://www.waveshare.net/datasheet/LCD_en_PDF/UPD161704A.pdf That controller is not supported. It uses registers 0x0006 and 0x0007 to set the GRAM update starting point (setaddrwin() in FBTFT). None of the FBTFT drivers uses these registers. Depending on your skills, you can try and make a driver for this controller. Use the regular FBTFT image and follow this guide: https://github.com/notro/fbtft/wiki/Development — Reply to this email directly or view it on GitHub.

DRAgon734465502 commented 10 years ago

Hi ! I also have the Waveshare 2.2inch ,

I have made the lcd show raspbian Successfully (the show just though copying from framebuffer, It means the lcd'll show ererything whatever the hdmi show , if the hdmi show nothing ,lcd also show nothing )

it can play Video through mplay(the spi speed at 125MHZ) but I can't add the touch function,

and i can't find a complete tutorial about how to add the ADS7843 / XPT2046 drive, then touch driver, last touch lcd ok to move the mouse

who can tell me how to do that??

DRAgon734465502 commented 10 years ago

who can add the the touch function and give me some suggestions! Thanks

DRAgon734465502 commented 10 years ago

the Video that the Waveshare LCD2.2 320 240 run raspbian and play video http://v.youku.com/v_show/id_XNjkzNTg4NDky.html

notro commented 10 years ago

i can't find a complete tutorial about how to add the ADS7843 / XPT2046 drive

You need kernel support for ADS7846

$ zgrep ADS7846 /proc/config.gz
CONFIG_TOUCHSCREEN_ADS7846=m

and you need a way to add a device for that driver. This is usually done in the platform/board file, but I have made ads7846_device so it can be runtime configurable. Source: https://github.com/notro/fbtft_tools/blob/master/ads7846_device/ads7846_device.c Wiki: https://github.com/notro/fbtft_tools/wiki/ads7846_device

The FBTFT kernel has both these modules.

More info: https://github.com/notro/fbtft/wiki/Touchpanel

DRAgon734465502 commented 10 years ago

Hi,notro I've tried follow what you send to me

firstly $ zgrep ADS7846 /proc/config.gz $ CONFIG_TOUCHSCREEN_ADS7846=m It's OK

But I 'have some problem when I try $ modprobe ads7846_device or $ modprobe ads7846 It come from this error message: FATAL: Module ads7846 not found.

1. so, I think i should use the FBTFT kernel to 'modprobe ads7846' Yesterday, I've seen the FBTFT kernel : 2014-01-07-wheezy-raspbian-2014-03-12-fbtft-master-firmware.zip (FBTFT drivers as loadable modules. See 'Step-by-step' for loading drivers.)

I try to wite it to my SD card ,and try $ modprobe ads7846_device or $ modprobe ads7846 it can be successfully.
I was excited and think I will be able to drive this touch screen successfully soon.

but,I find that the FBTFT image can't enable the startx to hdim with config the rasp-config, after the rasp-config to enable the startx ,the hdmi output nothing,just with cursor blink

this is my code ,the lcd will show though copy fb0(the hdmi) FILE *infile=fopen("/dev/fb0","rb");

and the FBTFT kernel seems that use fb1 to output signal,and FBTFT will occupy the spi, it's too bad, it's Troubles me, for making lcd show ,I have to enable fb0(HDMI) output , and i don't know how to reactivated the hdmi in the FBTFT kernel

2. after the the failure though using FBTFT kernel Yesterday, I'also try other methods I down the rpi-3.6.y from https://github.com/raspberrypi/linux/tree/rpi-3.6.y and compile raspbian kernel by myself
and add the ads7846 drive into the raspbian kernel thogh the web: http://lallafa.de/blog/2013/03/adding-touch-support-for-the-mi0283qt-displays/ https://github.com/dronus/linux/commit/24666a13e8dfac1dfeaf55fa3c6e413b64af1a42#diff-8e1c70a88b7ad83e68f570ba0a7d9af3R582 after a series of operations ,I can't get the eventX below /dev/input/ , but Instead of get the dev be named 'mice' though $ cat /dev/input/mice I can get the binary data showed In the terminal when I touch the lcd then, I no idea about how to correct the dev named 'mice' to eventX or touchsreen or ads7846 and don't know what to do the next step

I have fought for 4 days, Only 6 hours of sleep every day in order to solve the problem of touch screen driver with the lcd Sincerely hope to get your help, Finally I wish to share my work If I can drive the touch Successfully Looking forward to your reply

notro commented 10 years ago

2014-01-07-wheezy-raspbian-2014-03-12-fbtft-master-firmware.zip

If you use this image and want output on /dev/fb0: use /dev/fb0 in /usr/share/X11/xorg.conf.d/99-fbturbo.conf

You can also install the FBTFT kernel on a regular Raspian image: https://github.com/notro/fbtft/wiki#install

DRAgon734465502 commented 10 years ago

Hi,notro I have add the touch drive ,and it runSuccessfully without showing when I run touch and show together the show can't work . I think it isn't a good choice to display by copying from fb0,the spi speed must be very high when the display can work fine. when I add the touch ,the display will be Interruptted ,and can't work fine

DRAgon734465502 commented 10 years ago

Hi, Dear notro I have changed a lcd with integrated SSD1289 controller, and it run Successfully with touching But The X and Y axis get reversed on the touch panel .

HOW can I solve the problem with the X and Y axis reversed of touching ??? I use the 2014-01-07-wheezy-raspbian-2014-03-12-fbtft-master-firmware.img

Looking forward to your reply! think you

2014-04-03 18:12 GMT+08:00 notro notifications@github.com:

2014-01-07-wheezy-raspbian-2014-03-12-fbtft-master-firmware.zip

If you use this image and want output on /dev/fb0: use /dev/fb0 in /usr/share/X11/xorg.conf.d/99-fbturbo.conf

You can also install the FBTFT kernel on a regular Raspian image: https://github.com/notro/fbtft/wiki#install

Reply to this email directly or view it on GitHubhttps://github.com/notro/fbtft/issues/77#issuecomment-39434808 .

notro commented 10 years ago

See the touch part in How do I change the display rotation?: https://github.com/notro/fbtft-spindle/wiki/FBTFT-image#qa

DRAgon734465502 commented 10 years ago

Hi Dear notro thanks for your replay, I execute the command: $ fbtft_device.rotate (0,90,180,270) But get the erro: bash: syntax error near unexpected token `0,90,180,270'

2014-04-10 19:38 GMT+08:00 notro notifications@github.com:

See the touch part in How do I change the display rotation?: https://github.com/notro/fbtft-spindle/wiki/FBTFT-image#qa

Reply to this email directly or view it on GitHubhttps://github.com/notro/fbtft/issues/77#issuecomment-40068296 .

notro commented 10 years ago

With touch part I meant the file: /etc/X11/xorg.conf.d/99-calibration.conf

DRAgon734465502 commented 10 years ago

Dear notro thank you very much , I have got a correct touch with the X and Y axis .

But there are still problems with the touching . I must touch the touchpanel with a great pressure when the touchpanel can work

Have any method to reduced to the required pressure on touch screen ?

2014-04-11 0:20 GMT+08:00 notro notifications@github.com:

With touch part I meant the file: /etc/X11/xorg.conf.d/99-calibration.conf

Reply to this email directly or view it on GitHubhttps://github.com/notro/fbtft/issues/77#issuecomment-40106160 .

notro commented 10 years ago

Lower the _x_plateohms value: https://github.com/notro/fbtft_tools/wiki/ads7846_device

DRAgon734465502 commented 10 years ago

I execute the following command $ modprobe ads7846 x_plate_ohms=200 then $ startx

and change nothing

Have I missed some code that should be executd?

2014-04-11 1:33 GMT+08:00 notro notifications@github.com:

Lower the _x_plateohms value: https://github.com/notro/fbtft_tools/wiki/ads7846_device

Reply to this email directly or view it on GitHubhttps://github.com/notro/fbtft/issues/77#issuecomment-40114141 .

notro commented 10 years ago

$ modprobe ads7846 x_plate_ohms=200

You mean ads7846_device, right?

On the Sainsmart 3.2" display I have used 60 ohms: https://github.com/notro/fbtft/wiki/Touchpanel#sainsmart-32

DRAgon734465502 commented 10 years ago

No I use modprobe ads7846_device x_plate_ohms=200

But get the erro FATAL: Module ads7846_device not found.

and "modprobe ads7846 " is ok

2014-04-11 3:47 GMT+08:00 notro notifications@github.com:

$ modprobe ads7846 x_plate_ohms=200

You mean ads7846_device, right?

On the Sainsmart 3.2" display I have used 60 ohms: https://github.com/notro/fbtft/wiki/Touchpanel#sainsmart-32

Reply to this email directly or view it on GitHubhttps://github.com/notro/fbtft/issues/77#issuecomment-40129834 .

notro commented 10 years ago

Read this so you understand the relationship between a driver and a device: https://github.com/notro/fbtft/wiki/fbtft_device

To be able to configure the touch driver at runtime, I have written this kernel module: https://github.com/notro/fbtft_tools/tree/master/ads7846_device

DRAgon734465502 commented 10 years ago

Hi,notro Thank you for your help, I start to study Waveshare 2.2inch 320x240 Touch LCD Again,

I have successlly let the lcd show and touch with raspbian .the display is though copying from fb0 in accordance with the method I used before, I use other spi control Touch panel

In order to eliminate the interference between display and touch.

But ,I have the a final problem with touching ,

when I add the touch driver into the linu kernel ,It work successlly, but I can't get a calibrate .

I according to the following operation:

$ TSLIB_FBDEVICE=/dev/fb0 TSLIB_TSDEVICE=/dev/input/event2 ts_calibrate

$ TSLIB_FBDEVICE=/dev/fb0 TSLIB_TSDEVICE=/dev/input/event2 ts_test

the "ts_calibrate" work and it will have an influence on "ts_test" but "ts_calibrate" can't have an influence on my raspbian after I end the "ts_test"

I don't use fbtft and X Calibration can,t work with the erro "can,t connect to X service "

How can I make an influence on my raspbian touch though "ts_calibrate" or can you recommend a other method??

Thank you and look forward to your reply

2014-04-11 22:31 GMT+08:00 notro notifications@github.com:

Read this so you understand the relationship between a driver and a device: https://github.com/notro/fbtft/wiki/fbtft_device

To be able to configure the touch driver at runtime, I have written this kernel module: https://github.com/notro/fbtft_tools/tree/master/ads7846_device

— Reply to this email directly or view it on GitHubhttps://github.com/notro/fbtft/issues/77#issuecomment-40209664 .

notro commented 10 years ago

It's best to calibrate on TSLIB_FBDEVICE=/dev/fb1, this gives the best accuracy. fbcp does scaling when copying from /dev/fb0

ts_calibrate writes the calibration info to /etc/pointercal. Do you run with sudo or as root? ts_calibrate is for programs that use tslib, like pygame for instance.

xinput_calibrator is for calibrating X windows. If you start it outside of X, you have to specify the display: DISPLAY=:0 xinput_calibrator

DRAgon734465502 commented 10 years ago

I run as root Execute the command: $ FRAMEBUFFER=/dev/fb0 startx DISPLAY=:0 xinput_calibrator

But get the ERR: FATAL: Module g2d_23 not found. xinit: Unable to run program "/usr/bin/xterm": No such file or directory Specify a program on the command line or make sure that /usr/bin is in your path. xinit: connection to X server lost

Have some methods to calibrate when copying from /dev/fb0 ??

Thank you and look forward to your reply

2014-04-22 18:02 GMT+08:00 notro notifications@github.com:

It's best to calibrate on TSLIB_FBDEVICE=/dev/fb1, this gives the best accuracy. fbcp does scaling when copying from /dev/fb0

ts_calibrate writes the calibration info to /etc/pointercal. Do you run with sudo or as root? ts_calibrate is for programs that use tslib, like pygame for instance.

xinput_calibrator is for calibrating X windows. If you start it outside of X, you have to specify the display: DISPLAY=:0 xinput_calibrator

— Reply to this email directly or view it on GitHubhttps://github.com/notro/fbtft/issues/77#issuecomment-41022759 .

notro commented 10 years ago

First start X windows

$ FRAMEBUFFER=/dev/fb0 startx

Then start xinput_calibrator from inside the X windows session

or start it from a SSH session

$ DISPLAY=:0 xinput_calibrator
DRAgon734465502 commented 10 years ago

Hi, swkim01 I'm interested in your study .

it seems to be a difficult study .

2014-05-07 10:49 GMT+08:00 swkim01 notifications@github.com:

Hello, I just made a fbtft driver (fb_upd161704.c) for waveshare 2.2 in lcd. But I failed to test the driver according to your guide on wiki/Development. The dmesg is as follows: [ 821.713364] fb_upd161704: disagrees about version of symbol fbtft_remove_common [ 821.713408] fb_upd161704: Unknown symbol fbtft_remove_common (err -22) [ 821.713452] fb_upd161704: disagrees about version of symbol fbtft_probe_common [ 821.713468] fb_upd161704: Unknown symbol fbtft_probe_common (err -22)

Could you fix the problem? I found the symbols' addresses on fb_upd161704.mod.c are differ from the ones copied by rpi-firmware. My linux kernel source is a branch of 3.10.y (3.10.38) at github.com/raspberrypi/linux.git , but the fbtft kernel is 3.10.34+.

— Reply to this email directly or view it on GitHubhttps://github.com/notro/fbtft/issues/77#issuecomment-42384362 .

swkim01 commented 10 years ago

Hello, Finally I made the fbtft driver for BD663474 (actually It was not the uPD161704 controller chip). Also I make one for uPD161704, but not tested. I will upload them to the github repository soon. Temporarily you can download modules from the following links.

fbtft_device.ko( https://drive.google.com/file/d/0BxKwOKzWyMG6eWNya2FQMjRQbEE/edit?usp=sharing ) fb_bd663474.ko( https://drive.google.com/file/d/0BxKwOKzWyMG6eHZ5S1haWkhaX28/edit?usp=sharing )

BTW, you cannot use DVK511 interface board in order to operate both tft lcd and touchscreen because the ce1 pin in the board was connected to the rs(dc) pin of the lcd shield, not the ce pin of the touchscreen. Thus, instead I used the following connections. rs(dc) -> gpio25, reset -> gpio24, t_cs -> ce1, t_irq -> gpio23

Anyways, here is my script. sudo modprobe fbtft sudo insmod fb_bd663474.ko sudo insmod fbtft_device.ko name=bd663474 rotate=270 debug=3

sudo modprobe ads7846_device pressure_max=255 y_min=300 y_max=3768 swap_xy=1 gpio_pendown=23 x_min=144 x_max=3650 x_plate_ohms=60

FRAMEBUFFER=/dev/fb1 startx DISPLAY=:0 xinput --set-prop 'ADS7846 Touchscreen' 'Evdev Axis Inversion' 0 1

2014-05-08 1:09 GMT+09:00 DRAgon734465502 notifications@github.com:

Hi, swkim01 I'm interested in your study .

it seems to be a difficult study .

2014-05-07 10:49 GMT+08:00 swkim01 notifications@github.com:

Hello, I just made a fbtft driver (fb_upd161704.c) for waveshare 2.2 in lcd. But I failed to test the driver according to your guide on wiki/Development. The dmesg is as follows: [ 821.713364] fb_upd161704: disagrees about version of symbol fbtft_remove_common [ 821.713408] fb_upd161704: Unknown symbol fbtft_remove_common (err -22) [ 821.713452] fb_upd161704: disagrees about version of symbol fbtft_probe_common [ 821.713468] fb_upd161704: Unknown symbol fbtft_probe_common (err -22)

Could you fix the problem? I found the symbols' addresses on fb_upd161704.mod.c are differ from the ones copied by rpi-firmware. My linux kernel source is a branch of 3.10.y (3.10.38) at github.com/raspberrypi/linux.git , but the fbtft kernel is 3.10.34+.

— Reply to this email directly or view it on GitHub< https://github.com/notro/fbtft/issues/77#issuecomment-42384362> .

— Reply to this email directly or view it on GitHubhttps://github.com/notro/fbtft/issues/77#issuecomment-42447372 .

DRAgon734465502 commented 10 years ago

Your research is very exciting.I'LL try to accord to your method to drive Screen

DRAgon734465502 commented 10 years ago

Hi,swkim01 Thank you for sharing. Do you have any Tutorials about how to add the waveshare touch screen driver? the fbft_device.ko is based on what linux kernel Version ? 3.6 or 3.10? Where is download address of your drive's source codes?

2014-05-14 6:57 GMT+08:00 swkim01 notifications@github.com:

Hello, Finally I made the fbtft driver for BD663474 (actually It was not the uPD161704 controller chip). Also I make one for uPD161704, but not tested. I will upload them to the github repository soon. Temporarily you can download modules from the following links.

fbtft_device.ko(

https://drive.google.com/file/d/0BxKwOKzWyMG6eWNya2FQMjRQbEE/edit?usp=sharing ) fb_bd663474.ko(

https://drive.google.com/file/d/0BxKwOKzWyMG6eHZ5S1haWkhaX28/edit?usp=sharing )

BTW, you cannot use DVK511 interface board in order to operate both tft lcd and touchscreen because the ce1 pin in the board was connected to the rs(dc) pin of the lcd shield, not the ce pin of the touchscreen. Thus, instead I used the following connections. rs(dc) -> gpio25, reset -> gpio24, t_cs -> ce1, t_irq -> gpio23

Anyways, here is my script. sudo modprobe fbtft sudo insmod fb_bd663474.ko sudo insmod fbtft_device.ko name=bd663474 rotate=270 debug=3

sudo modprobe ads7846_device pressure_max=255 y_min=300 y_max=3768 swap_xy=1 gpio_pendown=23 x_min=144 x_max=3650 x_plate_ohms=60

FRAMEBUFFER=/dev/fb1 startx DISPLAY=:0 xinput --set-prop 'ADS7846 Touchscreen' 'Evdev Axis Inversion' 0 1

2014-05-08 1:09 GMT+09:00 DRAgon734465502 notifications@github.com:

Hi, swkim01 I'm interested in your study .

it seems to be a difficult study .

2014-05-07 10:49 GMT+08:00 swkim01 notifications@github.com:

Hello, I just made a fbtft driver (fb_upd161704.c) for waveshare 2.2 in lcd. But I failed to test the driver according to your guide on wiki/Development. The dmesg is as follows: [ 821.713364] fb_upd161704: disagrees about version of symbol fbtft_remove_common [ 821.713408] fb_upd161704: Unknown symbol fbtft_remove_common (err -22) [ 821.713452] fb_upd161704: disagrees about version of symbol fbtft_probe_common [ 821.713468] fb_upd161704: Unknown symbol fbtft_probe_common (err -22)

Could you fix the problem? I found the symbols' addresses on fb_upd161704.mod.c are differ from the ones copied by rpi-firmware. My linux kernel source is a branch of 3.10.y (3.10.38) at github.com/raspberrypi/linux.git , but the fbtft kernel is 3.10.34+.

— Reply to this email directly or view it on GitHub< https://github.com/notro/fbtft/issues/77#issuecomment-42384362> .

— Reply to this email directly or view it on GitHub< https://github.com/notro/fbtft/issues/77#issuecomment-42447372> .

— Reply to this email directly or view it on GitHubhttps://github.com/notro/fbtft/issues/77#issuecomment-43023670 .

swkim01 commented 10 years ago

Maybe I used the rpi kernel source with 3.10 version. The source code is at the branch of waveshare2_2 in https://github.com/swkim01/fbtft/. The best guide to install the driver is the fbtft wiki page(https://github.com/notro/fbtft/wiki). Anyway, I wrote total instructions to install the driver below. If you have any problem to follow, please let me know. Have Good Luck!

The pin connections of the waveshare 2.2in LCD module are as follows.

1 2 GND = GND 3 4 VCC = 3,3V 5 6 V0 = GND … … 19 20 T_IRQ = GPIO23 21 22 23 24 T_CS = CE1 25 26 T_DCLK = CLK 27 28 T_DIN = MOSI 29 30 T_DOUT = MISO 31 32 RST = GPIO24 33 34 SCI = MOSI 35 36 SCK = CLK 37 38 CS = CE0 39 40 RS = GPIO25

At first, as to fbtft wiki page(https://github.com/notro/fbtft/wiki), you have to update raspberrypi firmware in order to use notro’s kernel with fbtft drivers.

$ sudo apt-get update $ sudo wget https://raw.github.com/Hexxeh/rpi-update/master/rpi-update -O /usr/bin/rpi-update && sudo chmod +x /usr/bin/rpi-update $ sudo rpi-update $ sudo shutdown -r now

After rebooting, remove the spi blacklist and update rpi firmware with option SKIP_REPODELETE=1.

remove or comment out the spi blacklist line

$ sudo nano /etc/modprobe.d/raspi-blacklist.conf $ sudo REPO_URI=https://github.com/notro/rpi-firmware SKIP_REPODELETE=1 rpi-update $ sudo shutdown -r now

According to fbtft wiki’s Development page(https://github.com/notro/fbtft/wiki/Development), you have to build fbtft modules. First install dependencies.

$ sudo apt-get -y install libncurses5-dev

Update gcc to 4.7 version. $ gcc --version | grep gcc gcc (Debian 4.6.3-14+rpi1) 4.6.3 $ sudo apt-get install gcc-4.7 g++-4.7 $ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.7

Choose 4.7. $ sudo update-alternatives --config gcc There are 2 choices for the alternative gcc (providing /usr/bin/gcc).

Selection Path Priority Status

Press enter to keep the current choice[*], or type selection number: 2 update-alternatives: using /usr/bin/gcc-4.7 to provide /usr/bin/gcc (gcc) in manual mode

Confirm gcc version $ gcc --version | grep gcc gcc (Debian 4.7.2-5+rpi1) 4.7.2

And then, download both kernel source from the git repository of raspberrypi kernel and fbtft source from my repository.

$ cd ~ $ git clone --depth 1 git://github.com/raspberrypi/linux.git $ cd ~/linux/drivers/video/

git clone git://github.com/notro/fbtft.git

$ git clone git://github.com/swkim01/fbtft.git -b waveshare2_2

Then, build all fbtft modules.

Let make/kbuild see the directory and config options.

$ echo "obj-y += fbtft/" >> Makefile $ sed -i 's/endmenu/source "drivers\/video\/fbtft\/Kconfig"\n\nendmenu/' Kconfig $ sudo cp /root/.rpi-firmware/extra/{.config,Module.symvers} ~/linux/ $ sudo chown pi:pi ~/linux/{.config,Module.symvers} $ cd ~/linux $ make prepare scripts $ make SUBDIRS=drivers/video/fbtft modules

Install the new fbtft modules to the module directory,

install the new driver

$ sudo cp ~/linux/drivers/video/fbtft/{fbtft_device.ko,fb_bd663474.ko} /lib/modules/$(uname -r)/kernel/drivers/video/fbtft/ $ sudo depmod

After then, you can insert module to the kernel by running the following command. $ sudo modprobe fbtft_device name=waveshare22 rotate=270 debug=3

For installing touchscreen driver, refer to the Touchpanel page (https://github.com/notro/fbtft/wiki/Touchpanel). Run the following command.

$ sudo modprobe ads7846_device pressure_max=255 y_min=300 y_max=3768 swap_xy=1 gpio_pendown=23 x_min=144 x_max=3650 x_plate_ohms=60

Finally run startx and xinput.

$ sudo apt-get -y install xinput evtest $ FRAMEBUFFER=/dev/fb1 startx $ DISPLAY=:1 xinput --set-prop 'ADS7846 Touchscreen' 'Evdev Axis Inversion' 0 1

If you want to do calibration, install xinput_calibrator or tslib. I used xinput_calibrator with following commands.

$ sudo apt-get install libx11-dev libxext-dev libxi-dev x11proto-input-dev $ wget http://github.com/downloads/tias/xinput_calibrator/xinput_calibrator-0.7.5.tar.gz $ cd xinput_calibrator-0.7.5/ $ ./configure $ make $ sudo make install $ DISPLAY=:1 xinput_calibrator

2014-05-18 12:52 GMT+09:00 DRAgon734465502 notifications@github.com:

Hi,swkim01 Thank you for sharing. Do you have any Tutorials about how to add the waveshare touch screen driver? the fbft_device.ko is based on what linux kernel Version ? 3.6 or 3.10? Where is download address of your drive's source codes?

2014-05-14 6:57 GMT+08:00 swkim01 notifications@github.com:

Hello, Finally I made the fbtft driver for BD663474 (actually It was not the uPD161704 controller chip). Also I make one for uPD161704, but not tested. I will upload them to the github repository soon. Temporarily you can download modules from the following links.

fbtft_device.ko(

https://drive.google.com/file/d/0BxKwOKzWyMG6eWNya2FQMjRQbEE/edit?usp=sharing ) fb_bd663474.ko(

https://drive.google.com/file/d/0BxKwOKzWyMG6eHZ5S1haWkhaX28/edit?usp=sharing )

BTW, you cannot use DVK511 interface board in order to operate both tft lcd and touchscreen because the ce1 pin in the board was connected to the rs(dc) pin of the lcd shield, not the ce pin of the touchscreen. Thus, instead I used the following connections. rs(dc) -> gpio25, reset -> gpio24, t_cs -> ce1, t_irq -> gpio23

Anyways, here is my script. sudo modprobe fbtft sudo insmod fb_bd663474.ko sudo insmod fbtft_device.ko name=bd663474 rotate=270 debug=3

sudo modprobe ads7846_device pressure_max=255 y_min=300 y_max=3768 swap_xy=1 gpio_pendown=23 x_min=144 x_max=3650 x_plate_ohms=60

FRAMEBUFFER=/dev/fb1 startx DISPLAY=:0 xinput --set-prop 'ADS7846 Touchscreen' 'Evdev Axis Inversion' 0 1

2014-05-08 1:09 GMT+09:00 DRAgon734465502 notifications@github.com:

Hi, swkim01 I'm interested in your study .

it seems to be a difficult study .

2014-05-07 10:49 GMT+08:00 swkim01 notifications@github.com:

Hello, I just made a fbtft driver (fb_upd161704.c) for waveshare 2.2 in lcd. But I failed to test the driver according to your guide on wiki/Development. The dmesg is as follows: [ 821.713364] fb_upd161704: disagrees about version of symbol fbtft_remove_common [ 821.713408] fb_upd161704: Unknown symbol fbtft_remove_common (err -22) [ 821.713452] fb_upd161704: disagrees about version of symbol fbtft_probe_common [ 821.713468] fb_upd161704: Unknown symbol fbtft_probe_common (err -22)

Could you fix the problem? I found the symbols' addresses on fb_upd161704.mod.c are differ from the ones copied by rpi-firmware. My linux kernel source is a branch of 3.10.y (3.10.38) at github.com/raspberrypi/linux.git , but the fbtft kernel is 3.10.34+.

— Reply to this email directly or view it on GitHub< https://github.com/notro/fbtft/issues/77#issuecomment-42384362> .

— Reply to this email directly or view it on GitHub< https://github.com/notro/fbtft/issues/77#issuecomment-42447372> .

— Reply to this email directly or view it on GitHub< https://github.com/notro/fbtft/issues/77#issuecomment-43023670> .

— Reply to this email directly or view it on GitHubhttps://github.com/notro/fbtft/issues/77#issuecomment-43430737 .

saul-jb commented 10 years ago

swkim01 I cannot seem to complete your instructions because first I do not have the Module.symvers file which i nicked of : wget https://github.com/raspberrypi/firmware/raw/master/extra/Module.symvers then when I go: sudo modprobe fbtft_device name=waveshare22 rotate=270 debug=3 I get this error: ERROR: could not insert 'fbtft_device': Exec format error

I have tried this about five times now always having this problem I have tried using a old version of raspberian a new one tried with hdmi connect or with ssh always not working can you please help?

swkim01 commented 10 years ago

Hello, You do not need to build the module from the source code because it has been already contained in the fbtft firmware. You have to update the rpi firmware with fbtft drivers as to https://github.com/notro/fbtft/wiki.

2014-06-22 14:35 GMT+09:00 nutmmm notifications@github.com:

swkim01 I cannot seem to complete your instructions because first I do not have the Module.symvers file which i nicked of : wget https://github.com/raspberrypi/firmware/raw/master/extra/Module.symvers then when I go: sudo modprobe fbtft_device name=waveshare22 rotate=270 debug=3 I get this error: ERROR: could not insert 'fbtft_device': Exec format error

I have tried this about five times now always having this problem I have tried using a old version of raspberian a new one tried with hdmi connect or with ssh always not working can you please help?

— Reply to this email directly or view it on GitHub https://github.com/notro/fbtft/issues/77#issuecomment-46773047.

swkim01 commented 10 years ago

That(no output) is normal. By executing the command 'lsmod', you can see the loaded modules, fbtft_device and fb_bd663474. Then, you can test by X window or console as to https://github.com/notro/fbtft/wiki#step-by-step-using-fbtft.

2014-06-23 18:03 GMT+09:00 nutmmm notifications@github.com:

Ok did that but when I run the modprobe command it has no output should there be output and my screen won't turn on?

— Reply to this email directly or view it on GitHub https://github.com/notro/fbtft/issues/77#issuecomment-46820763.

saul-jb commented 10 years ago

Thank you, just one thing the startx command won't work: FRAMEBUFFER=/dev/fb1 startx I get his error: FATAL: Module g2d_23 not found. The reason it wasn't working before was I didn't know to run con2fbmap 1 1 to get terminal working

saul-jb commented 10 years ago

Just found a fix: sudo nano /usr/share/X11/xorg.conf.d/99-fbturbo.conf and comment out this line: Option "fbdev" "/dev/fb0"

DRAgon734465502 commented 10 years ago

Hi Dear notro, I'm installing the fbtft driver with the 2014-01-07-wheezy-raspbian download from RPi Official Website; Depending on your tutorial as follows

  1. Initial Config of a New Raspberry Pi Installpi@raspberrypi ~ $ sudo raspi-config pi@raspberrypi ~ $ sudo apt-get install rpi-update pi@raspberrypi ~ $ sudo rpi-update pi@raspberrypi ~ $ sudo reboot
  2. Updatepi@raspberrypi ~ $ sudo apt-get update pi@raspberrypi ~ $ sudo apt-get upgrade pi@raspberrypi ~ $ sudo reboot
  3. Install Drivers pi@raspberrypi ~ $ sudo REPO_URI=https://github.com/notro/rpi-firmware rpi-update
  4. Enable SPIpi@raspberrypi ~ $ sudo nano /etc/modprobe.d/raspi-blacklist.conf
  5. modprobe the fbtft device

pi@raspberrypi ~ $ sudo modprobe fbtft_device debug=3 rotate=90 name=flexfb speed=8000000 gpios=reset:25,dc:24,led:22

But at step 5, I get the err: "No fbtft_device"

Do I have any err steps? or this is the fbtft bug with that

2014-04-22 18:02 GMT+08:00 notro notifications@github.com:

It's best to calibrate on TSLIB_FBDEVICE=/dev/fb1, this gives the best accuracy. fbcp does scaling when copying from /dev/fb0

ts_calibrate writes the calibration info to /etc/pointercal. Do you run with sudo or as root? ts_calibrate is for programs that use tslib, like pygame for instance.

xinput_calibrator is for calibrating X windows. If you start it outside of X, you have to specify the display: DISPLAY=:0 xinput_calibrator

— Reply to this email directly or view it on GitHub https://github.com/notro/fbtft/issues/77#issuecomment-41022759.

saul-jb commented 10 years ago

Hey just got it going myself, I had that error once forgot how I got it you should just be doing:

sudo REPO_URI=https://github.com/notro/rpi-firmware rpi-update (if you use raspian make sure spi isn't blacklisted in: /etc/modprobe.d/raspi-blacklist.conf) sudo reboot sudo modprobe fbtft_device name=waveshare22 rotate=270 debug=3 (or similar with your device)

This is the thread I posted my problems (and got them solved): http://www.raspberrypi.org/forums/viewtopic.php?f=29&t=79724&sid=a2e3c72fd212120990bf8a7721852346&p=569396 Hope that helps.

DRAgon734465502 commented 10 years ago

Dear nutmmm thanks your Reply very much,I'll try

2014-06-28 14:58 GMT+08:00 nutmmm notifications@github.com:

Hey just got it going myself, I had that error once forgot how I got it you should just be doing: sudo REPO_URI=https://github.com/notro/rpi-firmware rpi-update (if you use raspian make sure spi isn't blacklisted in: /etc/modprobe.d/raspi-blacklist.conf) sudo reboot sudo modprobe fbtft_device name=waveshare22 rotate=270 debug=3 (or similar with your device) This is the thread I posted my problems (and got them solved):

http://www.raspberrypi.org/forums/viewtopic.php?f=29&t=79724&sid=a2e3c72fd212120990bf8a7721852346&p=569396

— Reply to this email directly or view it on GitHub https://github.com/notro/fbtft/issues/77#issuecomment-47420259.

DRAgon734465502 commented 10 years ago

When I DO AS Follows: sudo modprobe fbtft_device name=waveshare22 rotate=270 debug=3 I also get this error: ERROR: could not insert 'fbtft_device': Exec format error

I ALSO try it many tmies but I failed , always get the error not insert 'fbtft_device'

you seems to have the same problem . as the follow Picture say [image: 内嵌图片 1]

How do you solve this problem ? thanks

2014-06-28 14:58 GMT+08:00 nutmmm notifications@github.com:

Hey just got it going myself, I had that error once forgot how I got it you should just be doing: sudo REPO_URI=https://github.com/notro/rpi-firmware rpi-update (if you use raspian make sure spi isn't blacklisted in: /etc/modprobe.d/raspi-blacklist.conf) sudo reboot sudo modprobe fbtft_device name=waveshare22 rotate=270 debug=3 (or similar with your device) This is the thread I posted my problems (and got them solved):

http://www.raspberrypi.org/forums/viewtopic.php?f=29&t=79724&sid=a2e3c72fd212120990bf8a7721852346&p=569396

— Reply to this email directly or view it on GitHub https://github.com/notro/fbtft/issues/77#issuecomment-47420259.

saul-jb commented 10 years ago

Cannot see your picture sorry, through I couldn't figure out the error until I downloaded a fresh install of raspberrian and tried again I could guess the error is from rebuilding the kernal or whatever the swkim guys instructions do.

DRAgon734465502 commented 10 years ago

I think that erro is Caused by kernel compatibility,

"a fresh install of raspberrian" can you tell me what Version you download?

2014-06-30 12:57 GMT+08:00 nutmmm notifications@github.com:

Cannot see your picture sorry, through I couldn't figure out the error until I downloaded a fresh install of raspberrian and tried again I could guess the error is from rebuilding the kernal or whatever the swkim guys instructions do.

— Reply to this email directly or view it on GitHub https://github.com/notro/fbtft/issues/77#issuecomment-47494838.

saul-jb commented 10 years ago

Just the latest: 07/01/14, I found I had to reinstall tho after that error I don't know any other way to fix it sorry.

DRAgon734465502 commented 10 years ago

thank you

2014-06-30 15:02 GMT+08:00 nutmmm notifications@github.com:

Just the latest: 07/01/14, I found I had to reinstall tho after that error I don't know any other way to fix it sorry.

— Reply to this email directly or view it on GitHub https://github.com/notro/fbtft/issues/77#issuecomment-47500389.

DRAgon734465502 commented 10 years ago

init: [image: 内嵌图片 1]

startx:(display erro with two strange desktop) [image: 内嵌图片 2]

linuxgnuru commented 10 years ago

I'm confused; I've gotten all the modules loaded just fine; dmesg shows this: [ 245.781979] fbtft_device: SPI devices registered: [ 245.782031] fbtft_device: spidev spi0.0 500kHz 8 bits mode=0x00 [ 245.782049] fbtft_device: spidev spi0.1 500kHz 8 bits mode=0x00 [ 245.782059] fbtft_device: 'fb' Platform devices registered: [ 245.782079] fbtft_device: bcm2708_fb id=-1 pdata? no [ 245.782144] fbtft_device: Deleting spi0.0 [ 245.785548] fbtft_device: GPIOS used by 'waveshare22': [ 245.785578] fbtft_device: 'reset' = GPIO24 [ 245.785589] fbtft_device: 'dc' = GPIO25 [ 245.785599] fbtft_device: SPI devices registered: [ 245.785613] fbtft_device: spidev spi0.1 500kHz 8 bits mode=0x00 [ 245.785626] fbtft_device: fb_bd663474 spi0.0 32000kHz 8 bits mode=0x03 [ 245.824153] fb_bd663474 spi0.0: fbtft_request_gpios: 'reset' = GPIO24 [ 245.824197] fb_bd663474 spi0.0: fbtft_request_gpios: 'dc' = GPIO25 [ 245.824214] fb_bd663474 spi0.0: fbtft_verify_gpios() [ 245.824228] fb_bd663474 spi0.0: init_display() [ 245.824243] fb_bd663474 spi0.0: fbtft_reset() [ 246.070808] fb_bd663474 spi0.0: set_var() [ 246.116310] fb_bd663474 spi0.0: Display update: 3308 kB/s (45.328 ms), fps=0 (0.000 ms) [ 246.117293] graphics fb1: fb_bd663474 frame buffer, 320x240, 150 KiB video memory, 4 KiB DMA buffer memory, fps=20, spi0.0 at 32 MHz [ 269.488686] ads7846_device: Deleting spi0.1 [ 269.530096] ads7846 spi0.1: touchscreen, irq 193 [ 269.531212] input: ADS7846 Touchscreen as /devices/platform/bcm2708_spi.0/spi_master/spi0/spi0.1/input/input3

but if I try FRAMEBUFFER=/fb1 startx or fbi -d /fb1 -T 1 -noverbose -a file.jpg

nothing appears on my touch screen and my main display is non-responsive.

Am I missing something? The only thing is; I have the LCD22 attached to a DVK511 board.

linuxgnuru commented 10 years ago

swkim01 you mentioned:

BTW, you cannot use DVK511 interface board in order to operate both tft lcd and touchscreen because the ce1 pin in the board was connected to the rs(dc) pin of the lcd shield, not the ce pin of the touchscreen. Thus, instead I used the following connections. rs(dc) -> gpio25, reset -> gpio24, t_cs -> ce1, t_irq -> gpio23

Could you take a picture of how you set this up so that I can attempt to get this working as well?

swkim01 commented 10 years ago

Please get the attached picture or the following link.

http://drive.google.com/file/d/0BxKwOKzWyMG6dkVNdFJneGdKbkk/edit?usp=sharing

2014-08-07 0:25 GMT+09:00 linuxgnuru notifications@github.com:

swkim01 you mentioned:

BTW, you cannot use DVK511 interface board in order to operate both tft lcd and touchscreen because the ce1 pin in the board was connected to the rs(dc) pin of the lcd shield, not the ce pin of the touchscreen. Thus, instead I used the following connections. rs(dc) -> gpio25, reset -> gpio24, t_cs -> ce1, t_irq -> gpio23

Could you take a picture of how you set this up so that I can attempt to get this working as well?

— Reply to this email directly or view it on GitHub https://github.com/notro/fbtft/issues/77#issuecomment-51350515.

hunanchenxingyu commented 10 years ago

Hello,all I also have the Waveshare 2.2inch and attached to a DVK511 board, But I use the Bananapi(allwinner A20 platform) not RPI, the Bananapi public source code Website :https://github.com/LeMaker/bananapi-bsp. when I compile fbtft, appeared the following error:

CC [M] drivers/video/fbtft/fbtft-core.o LD [M] drivers/gpu/drm/drm_kms_helper.o LD [M] drivers/gpu/drm/drm.o /extFlash1/bananapi-bsp/linux-bananapi/drivers/video/fbtft/fbtft-core.c: In function ‘fbtft_request_gpios’: /extFlash1/bananapi-bsp/linux-bananapi/drivers/video/fbtft/fbtft-core.c:144:5: error: implicit declaration of function ‘devm_gpio_request_one’ [-Werror=implicit-function-declaration] CC [M] drivers/video/fbtft/fbtft-sysfs.o cc1: some warnings being treated as errors make[5]: * [drivers/video/fbtft/fbtft-core.o] Error 1 make[5]: * Waiting for unfinished jobs.... CC drivers/video/console/bitblit.o make[4]: *\ [drivers/video/fbtft] Error 2

In the kernel source, I can't find the definition of the “devm_gpio_request_one”.

Looking forward to your reply!

notro commented 10 years ago

devm_gpio_request_one came in 3.5, are you using an older Linux version?

devm_gpio_request_one use was recently added to FBTFT: https://github.com/notro/fbtft/commit/9644cef2ccd50c727ccb4562b2209a10217c0447 You can checkout the commit before that and you should be fine.

hunanchenxingyu commented 10 years ago

yes, I am using linux-3.4 Thank you for your reply!