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 494 forks source link

ST7781R support #59

Closed ClaudiuC closed 10 years ago

ClaudiuC commented 10 years ago

Hey,

First of all, thanks for the awesome work you're doing on this. This is more of a feature request - any chance you could add drivers for ST7781R? I know it's not great for a Pi and takes 12 GPIO pins, but Radioshack sells them as Arduino shields and some people (me included) would like to use it with a Pi.

See one of the threads I found here: http://www.raspberrypi.org/forum/viewtopic.php?uid=94435&f=45&t=56214&start=0

Even directions on where to start to write it myself would be very helpful.

Thanks

notro commented 10 years ago

Looking at the datasheet, I see that registers R20h, R21h, R22h is used to set which part of the GRAM area to update (set_addr_win() in FBTFT). This means you should be able to use the flexfb driver.

I have converted the initialization sequence from TFT::init() in the Arduino code to a init= sequence that can be used with FBTFT. Pick GPIO numbers for db00-db07,cs,wr,dc and reset.

# Load driver
sudo modprobe flexfb regwidth=16 width=240 height=320 init=-1,0x0001,0x0100,-1,0x0002,0x0700,-1,0x0003,0x1030,-1,0x0004,0x0000,-1,0x0008,0x0302,-1,0x000A,0x0000,-1,0x000C,0x0000,-1,0x000D,0x0000,-1,0x000F,0x0000,-2,100,-1,0x0030,0x0000,-1,0x0031,0x0405,-1,0x0032,0x0203,-1,0x0035,0x0004,-1,0x0036,0x0B07,-1,0x0037,0x0000,-1,0x0038,0x0405,-1,0x0039,0x0203,-1,0x003c,0x0004,-1,0x003d,0x0B07,-1,0x0020,0x0000,-1,0x0021,0x0000,-1,0x0050,0x0000,-1,0x0051,0x00ef,-1,0x0052,0x0000,-1,0x0053,0x013f,-2,100,-1,0x0060,0xa700,-1,0x0061,0x0001,-1,0x0090,0x003A,-1,0x0095,0x021E,-1,0x0080,0x0000,-1,0x0081,0x0000,-1,0x0082,0x0000,-1,0x0083,0x0000,-1,0x0084,0x0000,-1,0x0085,0x0000,-1,0x00FF,0x0001,-1,0x00B0,0x140D,-1,0x00FF,0x0000,-2,100,-1,0x0007,0x0133,-2,50,-3

# Load device
# dc is the same as RS on the display, substitute XX with GPIO number
sudo modprobe fbtft_device custom name=flexpfb buswidth=8 gpios=db00:XX,db01:XX,...,db07:XX,cs:XX,wr:XX,dc:XX,reset:XX

I haven't tried the commands, so there can be typos and other errors here.

Links: https://github.com/notro/fbtft/wiki/flexfb https://github.com/notro/fbtft/wiki/fbtft_device https://github.com/notro/fbtft/wiki/Troubleshooting

ClaudiuC commented 10 years ago

Thanks, I'll give it a shot and see what results I get!

notro commented 10 years ago

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

strigoi8183 commented 10 years ago

Has anyone had any luck with this setup. I have had the tft shield for quite a while and would like to use it for a weekend project with rock band drums and raspi with hydrogen sequencer for effects mixing.

munsie commented 9 years ago

I'll follow up on this. I was able to get this board working with some slight changes to the commands above. One thing that was missing was the commands to bring the display out of standby mode. Without that, the display would remain white. I added those to the init string and then hit another snag. The display wasn't updating at all until I specified ili9320 as the chip. Once I did that, the display worked in portrait orientation.

I also setup an init string for putting the display in landscape orientation, which might be handy for some people as well. I'm including them both below.

# portrait configuration
modprobe flexfb chip=ili9320 regwidth=16 width=240 height=320 init=-1,0x0001,0x0100,-1,0x0002,0x0700,-1,0x0003,0x1030,-1,0x0004,0x0000,-1,0x0008,0x0302,-1,0x000A,0x0000,-1,0x000C,0x0000,-1,0x000D,0x0000,-1,0x000F,0x0000,-2,100,-1,0x0030,0x0000,-1,0x0031,0x0405,-1,0x0032,0x0203,-1,0x0035,0x0004,-1,0x0036,0x0B07,-1,0x0037,0x0000,-1,0x0038,0x0405,-1,0x0039,0x0203,-1,0x003c,0x0004,-1,0x003d,0x0B07,-1,0x0020,0x0000,-1,0x0021,0x0000,-1,0x0050,0x0000,-1,0x0051,0x00ef,-1,0x0052,0x0000,-1,0x0053,0x013f,-2,100,-1,0x0060,0xa700,-1,0x0061,0x0001,-1,0x0090,0x003A,-1,0x0095,0x021E,-1,0x0080,0x0000,-1,0x0081,0x0000,-1,0x0082,0x0000,-1,0x0083,0x0000,-1,0x0084,0x0000,-1,0x0085,0x0000,-1,0x00FF,0x0001,-1,0x00B0,0x140D,-1,0x00FF, 0x0000,-2,100,-1,0x0007,0x0133,-2,50,-1,0x0010,0x14e0,-2,100,-1,0x0007,0x0133,-3

# landscape configuration
modprobe flexfb chip=ili9320 regwidth=16 width=320 height=240 init=-1,0x0001,0x0100,-1,0x0002,0x0700,-1,0x0003,0x1028,-1,0x0004,0x0000,-1,0x0008,0x0302,-1,0x000A,0x0000,-1,0x000C,0x0000,-1,0x000D,0x0000,-1,0x000F,0x0000,-2,100,-1,0x0030,0x0000,-1,0x0031,0x0405,-1,0x0032,0x0203,-1,0x0035,0x0004,-1,0x0036,0x0B07,-1,0x0037,0x0000,-1,0x0038,0x0405,-1,0x0039,0x0203,-1,0x003c,0x0004,-1,0x003d,0x0B07,-1,0x0020,0x0000,-1,0x0021,0x0000,-1,0x0050,0x0000,-1,0x0051,0x00ef,-1,0x0052,0x0000,-1,0x0053,0x013f,-2,100,-1,0x0060,0xa700,-1,0x0061,0x0001,-1,0x0090,0x003A,-1,0x0095,0x021E,-1,0x0080,0x0000,-1,0x0081,0x0000,-1,0x0082,0x0000,-1,0x0083,0x0000,-1,0x0084,0x0000,-1,0x0085,0x0000,-1,0x00FF,0x0001,-1,0x00B0,0x140D,-1,0x00FF,0x0000,-2,100,-1,0x0007,0x0133,-2,50,-1,0x0010,0x14e0,-2,100,-1,0x0007,0x0133,-3

Hope that's helpful to anyone trying to use this display with the Pi.

buzzdennis commented 9 years ago

munsie,

Can you provide a pinout of your specific setup with the board? I'm having trouble with which pins to use.

strigoi8183 commented 9 years ago

Basically the setup consists of raspi b 512Mb edition with rock band drum kit attached via usb and running on 32"flat screen through hdmi. I would send you a pic, but I no longer use this setup. Should be pretty much plug n play once the software is installed and you configure the drum application to input via the usb drum kit. If you have any trouble with this setup I am available to help as much as I can... I should still have the script I used to config the drums, I could pass along if you like... On May 24, 2015 2:34 AM, "buzzdennis" notifications@github.com wrote:

munsie,

Can you provide a pinout of your specific setup with the board? I'm having trouble with which pins to use.

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

buzzdennis commented 9 years ago

strigoi8183,

Sorry. I meant the pinout of the SeeedStudio tft shield to the pi GPIO. Your setup sounds cool though. Thanks for your willingness to share.

solvable commented 9 years ago

Any luck with the pinout?