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.85k stars 494 forks source link

itdb28fb problem #48

Closed koxuipang closed 10 years ago

koxuipang commented 10 years ago

Dear notro: Thank you for taking time to read my problem.I try to use this lib to driver itdb28fb.I input command in terminal: sudo modprobe fbtft_device name=itdb28fb gpios=reset:17,dc:1,wr:0,cs:21,db00:9,db01:11,db02:18,db03:23,db04:24,db05:25,db06:8,db07:7,led:4 And then: dmesg The terminal display like this: [ 304.294308] fbtft_device: SPI devices registered: [ 304.294344] fbtft_device: 'fb' Platform devices registered: [ 304.294369] fbtft_device: bcm2708_fb id=-1 pdata? no [ 304.298182] fbtft_device: GPIOS used by 'itdb28fb': [ 304.298214] fbtft_device: 'reset' = GPIO17 [ 304.298224] fbtft_device: 'dc' = GPIO1 [ 304.298232] fbtft_device: 'wr' = GPIO0 [ 304.298241] fbtft_device: 'cs' = GPIO21 [ 304.298248] fbtft_device: 'db00' = GPIO9 [ 304.298257] fbtft_device: 'db01' = GPIO11 [ 304.298265] fbtft_device: 'db02' = GPIO18 [ 304.298273] fbtft_device: 'db03' = GPIO23 [ 304.298281] fbtft_device: 'db04' = GPIO24 [ 304.298293] fbtft_device: 'db05' = GPIO25 [ 304.298301] fbtft_device: 'db06' = GPIO8 [ 304.298309] fbtft_device: 'db07' = GPIO7 [ 304.298317] fbtft_device: 'led' = GPIO4 [ 304.298325] fbtft_device: 'fb' Platform devices registered: [ 304.298345] fbtft_device: bcm2708_fb id=-1 pdata? no [ 304.298378] fbtft_device: itdb28fb id=0 pdata? yes But i don't recieve message like this: graphics fb1: fb_ili9320 frame buffer, 320x240, 150 KiB video memory, 4 KiB DMA buffer memory, fps=20, spi0.0 at 32 MHz I try to input command in terminal: FRAMEBUFFER=/dev/fb0 startx con2fbmap 1 0 The itdb28fb don't work. Thanks again.

notro commented 10 years ago

Have you used rpi-update or the fbtft image to get the drivers? The image is older and doesn't have autoload of fbtft drivers, and you have to manually load the driver: sudo modprobe itdb28fb

If you use rpi-update, what's the output of lsmod?

koxuipang commented 10 years ago

First i download the image source:2013-05-25-wheezy-raspbian-2013-07-07-fbtft.zip and install to raspberry. Then load the driver like this: sudo modprobe fbtft_device name=itdb28fb gpios=reset:17,dc:1,wr:0,cs:21,db00:9,db01:11,db02:18,db03:23,db04:24,db05:25,db06:8,db07:7,led:4 Last: I input dmesg in terminal. The terminal will display like this:

[ 304.294308] fbtft_device: SPI devices registered: [ 304.294344] fbtft_device: 'fb' Platform devices registered: [ 304.294369] fbtft_device: bcm2708_fb id=-1 pdata? no [ 304.298182] fbtft_device: GPIOS used by 'itdb28fb': [ 304.298214] fbtft_device: 'reset' = GPIO17 [ 304.298224] fbtft_device: 'dc' = GPIO1 [ 304.298232] fbtft_device: 'wr' = GPIO0 [ 304.298241] fbtft_device: 'cs' = GPIO21 [ 304.298248] fbtft_device: 'db00' = GPIO9 [ 304.298257] fbtft_device: 'db01' = GPIO11 [ 304.298265] fbtft_device: 'db02' = GPIO18 [ 304.298273] fbtft_device: 'db03' = GPIO23 [ 304.298281] fbtft_device: 'db04' = GPIO24 [ 304.298293] fbtft_device: 'db05' = GPIO25 [ 304.298301] fbtft_device: 'db06' = GPIO8 [ 304.298309] fbtft_device: 'db07' = GPIO7 [ 304.298317] fbtft_device: 'led' = GPIO4 [ 304.298325] fbtft_device: 'fb' Platform devices registered: [ 304.298345] fbtft_device: bcm2708_fb id=-1 pdata? no [ 304.298378] fbtft_device: itdb28fb id=0 pdata? yes

koxuipang commented 10 years ago

I can only find /dev/fb0 but i can't find /dev/fb1.

notro commented 10 years ago

First i download the image source:2013-05-25-wheezy-raspbian-2013-07-07-fbtft.zip and install to raspberry. Then load the driver like this: sudo modprobe fbtft_device name=itdb28fb gpios=reset:17,dc:1,wr:0,cs:21,db00:9,db01:11,db02:18,db03:23,db04:24,db05:25,db06:8,db07:7,led:4

That command only tells Linux that a fbtft device is present. This device needs a driver to make something happen. With the latest drivers, the driver will load automatically. But with that image, this will not happen automatically, so you have to load the driver manually.

# Register device
sudo modprobe fbtft_device name=itdb28fb gpios=reset:17,dc:1,wr:0,cs:21,db00:9,db01:11,db02:18,db03:23,db04:24,db05:25,db06:8,db07:7,led:4

# Load driver
sudo modprobe itdb28fb
koxuipang commented 10 years ago

First:I use itead driver to drive 2.8 lcd module and it display successfully:http://blog.iteadstudio.com/raspberry-pi-with-tft-lcd-demo/ Second: # Register device sudo modprobe fbtft_device name=itdb28fb gpios=reset:17,dc:1,wr:0,cs:21,db00:9,db01:11,db02:18,db03:23,db04:24,db05:25,db06:8,db07:7,led:4 Third:# Load driver sudo modprobe itdb28fb

Last i try to input:FRAMEBUFFER=/dev/fb1 startx. Result:both HDMI and 2.8 lcd module don't display.

I try to like this:sudo con2fbmap 1 1 Result:both HDMI and 2.8 lcd module don't display.

koxuipang commented 10 years ago

Dmesg display successfully: [ 1196.024682] fbtft_device: SPI devices registered: [ 1196.024725] fbtft_device: 'fb' Platform devices registered: [ 1196.024751] fbtft_device: bcm2708_fb id=-1 pdata? no [ 1196.027885] fbtft_device: GPIOS used by 'itdb28fb': [ 1196.027920] fbtft_device: 'reset' = GPIO17 [ 1196.027931] fbtft_device: 'dc' = GPIO1 [ 1196.027940] fbtft_device: 'wr' = GPIO0 [ 1196.027948] fbtft_device: 'cs' = GPIO21 [ 1196.027959] fbtft_device: 'db00' = GPIO9 [ 1196.027967] fbtft_device: 'db01' = GPIO11 [ 1196.027975] fbtft_device: 'db02' = GPIO18 [ 1196.027983] fbtft_device: 'db03' = GPIO23 [ 1196.027991] fbtft_device: 'db04' = GPIO24 [ 1196.027999] fbtft_device: 'db05' = GPIO25 [ 1196.028007] fbtft_device: 'db06' = GPIO8 [ 1196.028015] fbtft_device: 'db07' = GPIO7 [ 1196.028023] fbtft_device: 'led' = GPIO4 [ 1196.028030] fbtft_device: 'fb' Platform devices registered: [ 1196.028049] fbtft_device: bcm2708_fb id=-1 pdata? no [ 1196.028084] fbtft_device: itdb28fb id=0 pdata? yes [ 1196.671387] graphics fb1: itdb28fb frame buffer, 240x320, 150 KiB video memory, 4 KiB buffer memory, fps=20

notro commented 10 years ago

Do you have a Rev. 1 or 2 board?

koxuipang commented 10 years ago

I use Rev.2 raspberry. I use this module:http://imall.iteadstudio.com/itdb02-2-8.html and this demo :http://blog.iteadstudio.com/raspberry-pi-with-tft-lcd-demo/. I don't change demo and it display normal.

notro commented 10 years ago

GPIO 0, 1 and 21 isn't used on Rev. 2.

GPIO changes: 0 -> 2 1 -> 3 21 -> 27

See this page: http://elinux.org/RPi_Low-level_peripherals#General_Purpose_Input.2FOutput_.28GPIO.29 From wiringpi: http://wiringpi.com/pins/

koxuipang commented 10 years ago

Thanks for you reply. I have change the raspberry pin as your reply.This is my dmesg: [ 1001.467229] fbtft_device: 'fb' Platform devices registered: [ 1001.467254] fbtft_device: bcm2708_fb id=-1 pdata? no [ 1001.470179] fbtft_device: GPIOS used by 'itdb28fb': [ 1001.470215] fbtft_device: 'reset' = GPIO17 [ 1001.470227] fbtft_device: 'dc' = GPIO3 [ 1001.470235] fbtft_device: 'wr' = GPIO2 [ 1001.470245] fbtft_device: 'cs' = GPIO27 [ 1001.470252] fbtft_device: 'db00' = GPIO9 [ 1001.470261] fbtft_device: 'db01' = GPIO11 [ 1001.470268] fbtft_device: 'db02' = GPIO18 [ 1001.470276] fbtft_device: 'db03' = GPIO23 [ 1001.470285] fbtft_device: 'db04' = GPIO24 [ 1001.470293] fbtft_device: 'db05' = GPIO25 [ 1001.470301] fbtft_device: 'db06' = GPIO8 [ 1001.470308] fbtft_device: 'db07' = GPIO7 [ 1001.470316] fbtft_device: 'led' = GPIO4 [ 1001.470324] fbtft_device: 'fb' Platform devices registered: [ 1001.470346] fbtft_device: bcm2708_fb id=-1 pdata? no [ 1001.470379] fbtft_device: itdb28fb id=0 pdata? yes [ 1002.107963] graphics fb1: itdb28fb frame buffer, 240x320, 150 KiB video memory, 4 KiB buffer memory, fps=20 Last i input :FRAMEBUFFER=/dev/fb1 startx. Nothing display in both HDMI and itdb28 LCD.

notro commented 10 years ago

Everything looks fine to me. I see that you use the fbtft image from May, instead of the new rpi-update kernel, but that shouldn't matter.

In a situation like this, I would have tried to pull up/down the individual gpios manually, and measure with a led on the corresponding pin on the display to rule out a wiring problem.

I would use the gpio utility to do this: http://wiringpi.com/the-gpio-utility/.

Testing 'reset' = GPIO17

gpio -g mode 17 out
gpio -g write 17 0
gpio -g write 17 1
theodami commented 10 years ago

Hi,

The display works fine with this setup (LCD adapter kit) [ 14.337931] fbtft_device: GPIOS used by 'itdb28': [ 14.344079] fbtft_device: 'db0' = GPIO17 [ 14.349518] fbtft_device: 'db1' = GPIO18 [ 14.354838] fbtft_device: 'db2' = GPIO27 [ 14.377698] fbtft_device: 'db3' = GPIO22 [ 14.383081] fbtft_device: 'db4' = GPIO23 [ 14.397681] fbtft_device: 'db5' = GPIO24 [ 14.402851] fbtft_device: 'db6' = GPIO25 [ 14.417673] fbtft_device: 'db7' = GPIO4 [ 14.422648] fbtft_device: 'cs' = GPIO8 [ 14.427457] fbtft_device: 'dc' = GPIO2 [ 14.447670] fbtft_device: 'wr' = GPIO3 [ 14.452411] fbtft_device: 'reset' = GPIO7

but, I'm not able to work with the touchscreen !!!

notro commented 10 years ago

but, I'm not able to work with the touchscreen !!!

This adapter doesn't wire the SPI interface on the touch controller to the SPI interface on the Raspberry Pi. You have to either fix the adapter, or wire without it.

Links: LCD adapter wiring table: http://www.raspberrypi.org/phpBB3/viewtopic.php?p=350980#p350980 Raspberry Pi P1 header: http://elinux.org/RPi_Low-level_peripherals#General_Purpose_Input.2FOutput_.28GPIO.29

theodami commented 10 years ago

Hi notro,

Thanks for the quick response. My understanding is SPI interface for the touch controller use T_xxx signals (T_CLK, T_CS, T_DIN, T_DOUT and T_IRQ). The LCD adapter kit drive all this signals : http://imall.iteadstudio.com/im130425001.html

Regards.

notro commented 10 years ago

If you look closely, you will find that all the SPI signals mismatch: T_CLK should connect to SCLK, but is connected to MOSI T_CS should connect to CE0 or CE1, but is connected to MISO T_DIN should connect to MOSI (I think), but is connected to SCLK T_DOUT should connect to MISO (I think), but is connected to TXD

I have a note about it here: https://github.com/notro/fbtft/wiki/LCD-Shields#itead-raspberry-pi-lcd-adapter-kit

theodami commented 10 years ago

Hi notro,

Thanks a lot, I understand now.

Regards.

notro commented 10 years ago

Closing issue since there has been no activity for more than 2 months. Reopen if needed.