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

SSD1963 support? #58

Closed notro closed 9 years ago

notro commented 10 years ago

Copied from https://github.com/notro/fbtft/issues/45#issuecomment-31051060

Help me .. l

I have lcd tft 4.3 inchi but I can not use it because I can not make a driver for raspberries like you, can you can provide a driver for the SSD1963

http://www.emartee.com/product/42175/

Many Thanks

notro commented 10 years ago

Two days ago I ordered a display that seems to be very similar to yours: http://www.ebay.com/itm/New-5-0-800-480-TFT-LCD-Module-Display-Touch-Panel-SSD1963-For-51-AVR-STM32-/171198903887?

It will arive in 3-4 weeks. I will start working on the SSD1963 driver when it arrives.

goobiez commented 10 years ago

thanks you for help me..

many thanks

strancara commented 10 years ago

I have a simmilar driver for ssd1963 - tested on 480x272 4.3" and 5" display. You can contact me for source code.

goobiez commented 10 years ago

thank you so much,

2014/1/8 strancara notifications@github.com

I have a simmilar driver for ssd1963 - tested on 480x272 4.3" and 5" display. You can contact me for source code.

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

goobiez commented 10 years ago

can request source code,

2014/1/11 agus sanjaya goobiez11@gmail.com

thank you so much,

2014/1/8 strancara notifications@github.com

I have a simmilar driver for ssd1963 - tested on 480x272 4.3" and 5" display. You can contact me for source code.

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

notro commented 10 years ago

I have received my SSD1963 displays and started testing. I'm using the flexfb driver, but there are some problems that might be caused by an inadequate power supply. Console works fine, fullscreen movie gives periodic displacement of horizontal lines. In X windows items are displaced to the right, jumping back and forth as I move the mouse. Measuring the voltage at TP1 gives 4.67 volts which is below the required minimum of 4.75. These displays are also powered from the 3.3 v rail instead of the 5.0v rail. I have to try this later with a power supply that can give me a minimum of 4.75 with the display connected. Maybe I have to get a 3.3 regulator as well, since the docs say we can pull max. 50mA from the 3.3 rail.

Nevertheless, it is possible to use the flexfb driver with the SSD1963. I will make a dedicated driver when I have sorted out these problems.

5.0" - 800x480 Product page: http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=171198903887 Uses 0.34A @ 3.3V 3.3V rail voltage: 3.19V

sudo modprobe --first-time flexfb width=800 height=480 buswidth=16 init=-1,0xE2,0x23,0x02,0x04,-1,0xE0,0x01,-2,1,-1,0xE0,0x03,-2,5,-1,0x01,-2,5,-1,0xE6,0x03,0xff,0xff,-1,0xB0,0x27,0x00,0x03,0x1F,0x01,0xDF,0x00,-1,0xB4,0x03,0xA0,0x00,0x2E,0x30,0x00,0x0F,0x00,-1,0xB6,0x02,0x0D,0x00,0x10,0x10,0x00,0x08,-1,0xBA,0x0F,-1,0xB8,0x07,0x01,-1,0x36,0x00,-1,0xF0,0x03,-2,5,-1,0x29,-1,0xd0,0x0d,-3
sudo modprobe --first-time fbtft_device name=flexpfb debug=3 gpios=reset:29,dc:2,wr:31,db00:11,db01:9,db02:10,db03:22,db04:27,db05:17,db06:4,db07:3,db08:7,db09:8,db10:25,db11:24,db12:23,db13:18,db14:14,db15:15 rotate=0

FPS debug output
[32682.726095] flexfb flexpfb.0: Display update: 3839 kB/s (195.315 ms), fps=3 (250.118 ms)

4.3" - 480x272 Product page: http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=181283191283 Uses 0.50A @ 3.3V 3.3V rail voltage: 3.18V

sudo modprobe --first-time flexfb width=480 height=272 buswidth=16 init=-1,0xE2,0x2d,0x02,0x04,-1,0xE0,0x01,-2,1,-1,0xE0,0x03,-2,5,-1,0x01,-2,5,-1,0xE6,0x00,0xff,0xbe,-1,0xB0,0x20,0x00,0x01,0xDF,0x01,0x0F,0x00,-2,5,-1,0xB4,0x02,0x13,0x00,0x2B,0x0A,0x00,0x08,0x00,-1,0xB6,0x01,0x20,0x00,0x0C,0x0A,0x00,0x04,-1,0x36,0x00,-1,0xF0,0x03,-2,5,-1,0x29,-1,0xBE,0x06,0xf0,0x01,0xf0,0x00,0x00,-1,0xd0,0x0d,-1,0xB8,0x00,0x01,-1,0xBA,0x00,-3
sudo modprobe --first-time fbtft_device name=flexpfb debug=3 gpios=reset:29,dc:2,wr:31,db00:11,db01:9,db02:10,db03:22,db04:27,db05:17,db06:4,db07:3,db08:7,db09:8,db10:25,db11:24,db12:23,db13:18,db14:14,db15:15 rotate=0

FPS debug output
[34253.633864] flexfb flexpfb.0: Display update: 4079 kB/s (62.513 ms), fps=9 (109.970 ms)
strancara commented 10 years ago

RPi’s power supply is for sure not powerfull enough for a 4.3” pannel. I am using 3.3V LDO (from +5V) in my design. Even with this the module can not be hot-plugged onto RPi – it causes a voltage dip and a RPi restart... No problems if it is connected before plugging the power.

notro commented 10 years ago

RPi’s power supply is for sure not powerfull enough for a 4.3” pannel. I am using 3.3V LDO (from +5V) in my design.

Thanks, I'll order one.

How are you going to connect the display, parallel?

I will try both parallel (which I have done) and using my SPI interface circuit. The circuit didn't work well with DMA on my Sainsmart 3.2" display (SSD1289) though.

I don't use these displays, I just make them work with Linux and the Raspberry Pi. My kind of fun :-)

SSD1963 is (unlike ssd1289 and some others)sensitive to the waveform on control pins. Make sure you first drive the CS\ low before WR\ and WR\ back high before CS.

I have just wired /CS permanently low.

With a parallel bus connection, I drive the bus GPIOs directly through the hardware registers to get a bit of extra speed (~15% speedup). This worked fine on the 8-bit ITDB2.8 (ILI9325). The 16-bit Sainsmart 3.2" (SSD1289) didn't handle that well, so I had to use regular kernel functions to slow it down. The SSD1963 seem to handle the fast approach, but I won't be certain until I have tried it with enough power.

dawys commented 10 years ago

Hi everybody,

i have a 7" tft with an SSD1963. My wirering is: T_CLK => SCLK T_CS => CE0 T_DIN => MOSI T_DO => MISO RS => GPIO18 RESET => GPIO25

I start fbtft with: modprobe flexfb width=800 height=480 buswidth=8 init=-1,0xE2,0x23,0x02,0x04,-1,0xE0,0x01,-2,1,-1,0xE0,0x03,-2,5,-1,0x01,-2,5,-1,0xE6,0x03,0xff,0xff,-1,0xB0,0x27,0x00,0x03,0x1F,0x01,0xDF,0x00,-1,0xB4,0x03,0xA0,0x00,0x2E,0x30,0x00,0x0F,0x00,-1,0xB6,0x02,0x0D,0x00,0x10,0x10,0x00,0x08,-1,0xBA,0x0F,-1,0xB8,0x07,0x01,-1,0x36,0x00,-1,0xF0,0x03,-2,5,-1,0x29,-1,0xd0,0x0d,-3

modprobe fbtft_device name=flexfb cs=1 gpios=dc:18,reset:25 debug=3

the syslog output is: Feb 2 12:26:00 raspberrypi kernel: [ 115.425986] fbtft_device: GPIOS used by 'flexfb': Feb 2 12:26:00 raspberrypi kernel: [ 115.426000] fbtft_device: 'dc' = GPIO18 Feb 2 12:26:00 raspberrypi kernel: [ 115.426010] fbtft_device: 'reset' = GPIO25 Feb 2 12:26:00 raspberrypi kernel: [ 115.426019] fbtft_device: SPI devices registered: Feb 2 12:26:00 raspberrypi kernel: [ 115.426035] fbtft_device: spidev spi0.0 500kHz 8 bits mode=0x00 Feb 2 12:26:00 raspberrypi kernel: [ 115.426048] fbtft_device: flexfb spi0.1 32000kHz 8 bits mode=0x00 Feb 2 12:28:05 raspberrypi kernel: [ 240.697213] fbtft_device: SPI devices registered: Feb 2 12:28:05 raspberrypi kernel: [ 240.697267] fbtft_device: spidev spi0.0 500kHz 8 bits mode=0x00 Feb 2 12:28:05 raspberrypi kernel: [ 240.697280] fbtft_device: 'fb' Platform devices registered: Feb 2 12:28:05 raspberrypi kernel: [ 240.697301] fbtft_device: bcm2708_fb id=-1 pdata? no Feb 2 12:28:05 raspberrypi kernel: [ 240.701327] flexfb spi0.1: fbtft_request_gpios: 'dc' = GPIO18 Feb 2 12:28:05 raspberrypi kernel: [ 240.701367] flexfb spi0.1: fbtft_request_gpios: 'reset' = GPIO25 Feb 2 12:28:05 raspberrypi kernel: [ 240.701385] flexfb spi0.1: flexfb_verify_gpios_dc() Feb 2 12:28:05 raspberrypi kernel: [ 240.701404] flexfb spi0.1: fbtft_init_display() Feb 2 12:28:05 raspberrypi kernel: [ 240.701421] flexfb spi0.1: fbtft_reset() Feb 2 12:28:05 raspberrypi kernel: [ 240.836347] flexfb spi0.1: init: write(0xE2) 0x23 0x02 0x04 Feb 2 12:28:05 raspberrypi kernel: [ 240.836516] flexfb spi0.1: init: write(0xE0) 0x01 Feb 2 12:28:05 raspberrypi kernel: [ 240.836620] flexfb spi0.1: init: mdelay(1) Feb 2 12:28:05 raspberrypi kernel: [ 240.837644] flexfb spi0.1: init: write(0xE0) 0x03 Feb 2 12:28:05 raspberrypi kernel: [ 240.837751] flexfb spi0.1: init: mdelay(5) Feb 2 12:28:05 raspberrypi kernel: [ 240.842774] flexfb spi0.1: init: write(0x01) Feb 2 12:28:05 raspberrypi kernel: [ 240.842851] flexfb spi0.1: init: mdelay(5) Feb 2 12:28:05 raspberrypi kernel: [ 240.848308] flexfb spi0.1: init: write(0xE6) 0x03 0xFF 0xFF Feb 2 12:28:05 raspberrypi kernel: [ 240.848483] flexfb spi0.1: init: write(0xB0) 0x27 0x00 0x03 0x1F 0x01 0xDF 0x00 Feb 2 12:28:05 raspberrypi kernel: [ 240.848614] flexfb spi0.1: init: write(0xB4) 0x03 0xA0 0x00 0x2E 0x30 0x00 0x0F 0x00 Feb 2 12:28:05 raspberrypi kernel: [ 240.848739] flexfb spi0.1: init: write(0xB6) 0x02 0x0D 0x00 0x10 0x10 0x00 0x08 Feb 2 12:28:05 raspberrypi kernel: [ 240.848854] flexfb spi0.1: init: write(0xBA) 0x0F Feb 2 12:28:05 raspberrypi kernel: [ 240.848958] flexfb spi0.1: init: write(0xB8) 0x07 0x01 Feb 2 12:28:05 raspberrypi kernel: [ 240.849069] flexfb spi0.1: init: write(0x36) 0x00 Feb 2 12:28:05 raspberrypi kernel: [ 240.849172] flexfb spi0.1: init: write(0xF0) 0x03 Feb 2 12:28:05 raspberrypi kernel: [ 240.849268] flexfb spi0.1: init: mdelay(5) Feb 2 12:28:05 raspberrypi kernel: [ 240.855609] flexfb spi0.1: init: write(0x29) Feb 2 12:28:05 raspberrypi kernel: [ 240.855730] flexfb spi0.1: init: write(0xD0) 0x0D Feb 2 12:28:05 raspberrypi kernel: [ 241.137250] flexfb spi0.1: Display update: 2665 kB/s (281.377 ms), fps=0 (0.000 ms) Feb 2 12:28:05 raspberrypi kernel: [ 241.137284] flexfb spi0.1: fbtft_register_backlight() Feb 2 12:28:05 raspberrypi kernel: [ 241.137302] flexfb spi0.1: fbtft_register_backlight(): led pin not set, exiting. Feb 2 12:28:05 raspberrypi kernel: [ 241.137943] graphics fb1: flexfb frame buffer, 800x480, 750 KiB video memory, 4 KiB buffer memory, fps=20, spi0.1 at 32 MHz Feb 2 12:28:05 raspberrypi kernel: [ 241.138000] fbtft_device: GPIOS used by 'flexfb': Feb 2 12:28:05 raspberrypi kernel: [ 241.138015] fbtft_device: 'dc' = GPIO18 Feb 2 12:28:05 raspberrypi kernel: [ 241.138026] fbtft_device: 'reset' = GPIO25 Feb 2 12:28:05 raspberrypi kernel: [ 241.138036] fbtft_device: SPI devices registered: Feb 2 12:28:05 raspberrypi kernel: [ 241.138052] fbtft_device: spidev spi0.0 500kHz 8 bits mode=0x00 Feb 2 12:28:05 raspberrypi kernel: [ 241.138065] fbtft_device: flexfb spi0.1 32000kHz 8 bits mode=0x00

But my display is completly white.

Can anybody help me please?

notro commented 10 years ago

The pins starting with T_ is for the touch panel controller. I guess the display has a 16-bit databus. Like the one I tried further up the thread.

giasone commented 10 years ago

Hi, I'm try to connect a 5.0" tft with a ssd1963 controller in parallel. i follow the connection as notro says in his post in the gpios section, also cs to gnd and power from external 3,3v circuit. what i get is only vertical colored link. nowhere i find where to connect RD ( no RS/DC). do you have some hints? I've double cheked all connections and all wirings are well connected. thanks

notro commented 10 years ago

Hi, I'm try to connect a 5.0" tft with a ssd1963 controller in parallel.

Do you have a product page link? RD should be tied HIGH (not used) RS/DC has to be somewhere. This signal determine whether the data on the interface is for the index register or if it is register data/GRAM data.

giasone commented 10 years ago

The product it's the same linked above, same seller. I already try to not connect RD. ED/DC in on GPIO2. I have to load something else? thx

notro commented 10 years ago

It's difficult to answer when you give so little information. People jump in all the time in these issues, so it's hard to know what the facts are. If you are using this:

sudo modprobe --first-time flexfb width=800 height=480 buswidth=16 init=-1,0xE2,0x23,0x02,0x04,-1,0xE0,0x01,-2,1,-1,0xE0,0x03,-2,5,-1,0x01,-2,5,-1,0xE6,0x03,0xff,0xff,-1,0xB0,0x27,0x00,0x03,0x1F,0x01,0xDF,0x00,-1,0xB4,0x03,0xA0,0x00,0x2E,0x30,0x00,0x0F,0x00,-1,0xB6,0x02,0x0D,0x00,0x10,0x10,0x00,0x08,-1,0xBA,0x0F,-1,0xB8,0x07,0x01,-1,0x36,0x00,-1,0xF0,0x03,-2,5,-1,0x29,-1,0xd0,0x0d,-3
sudo modprobe --first-time fbtft_device name=flexpfb debug=3 gpios=reset:29,dc:2,wr:31,db00:11,db01:9,db02:10,db03:22,db04:27,db05:17,db06:4,db07:3,db08:7,db09:8,db10:25,db11:24,db12:23,db13:18,db14:14,db15:15 rotate=0

Then RS should be connected to GPIO2, WR connected to GPIO31 and RD tied HIGH (3.3V).

giasone commented 10 years ago

Hi, thanks Notro for the quick reply. I apologize if the informations provided are so poor, but really I don't know what is usefull to know to troubleshoot my problem. I'll try to be more accurate:

The display is 5.0" - 800x480 Product page: http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=171198903887 Uses 0.34A @ 3.3V 3.3V rail voltage: 3.19V

Raspberry Pi image with FBTFT support 2013-12-20-wheezy-raspbian-2014-01-03-fbtft.zip

connected as LCD -> RaspberryPI

RST -> GPIO29 RS/DC -> GPIO2 WR -> GPIO31 RD -> 3.3V LED_A -> 3.3V CS -> GND db00 -> GPIO11 db01 -> GPIO9 db02 -> GPIO10 db03 -> GPIO22 db04 -> GPIO27 db05 -> GPIO17 db06 -> GPIO4 db07 -> GPIO3 db08 -> GPIO7 db09 -> GPIO8 db10 -> GPIO25 db11 -> GPIO24 db12 -> GPIO23 db13 -> GPIO18 db14 -> GPIO14 db15 -> GPIO15

I've typed in the terminal exactly what you have posted in your last comment and the result is foto

let me know if you want know more. Many Thanks

notro commented 10 years ago

That's much better. The connections looks fine to me. The stripes on the display indicates that some info is getting through to the display. Here is an example of the random nature when display memory has not been touched after poweron: https://github.com/notro/fbtft/issues/75#issuecomment-34005247

In this situation I would use a script I made to verfiy the connections on the LCD header, to be sure there is no miswiring. I had to make the script because I couldn't get a display working, and it turned out I had swapped two databus wires. https://github.com/notro/fbtft/wiki/Troubleshooting#wiki-wiring

dawys commented 10 years ago

Connecting the CS of the dsiplay to Ground causes this image at startup.

do I have to connect sd_cs and t_cs also to ground?

Maybe the init parameter are wrong?

init=-1,0xE2,0x23,0x02,0x04,-1,0xE0,0x01,-2,1,-1,0xE0,0x03,-2,5,-1,0x01,-2,5,-1,0xE6,0x03,0xff,0xff,-1,0xB0,0x27,0x00,0x03,0x1F,0x01,0xDF,0x00,-1,0xB4,0x03,0xA0,0x00,0x2E,0x30,0x00,0x0F,0x00,-1,0xB6,0x02,0x0D,0x00,0x10,0x10,0x00,0x08,-1,0xBA,0x0F,-1,0xB8,0x07,0x01,-1,0x36,0x00,-1,0xF0,0x03,-2,5,-1,0x29,-1,0xd0,0x0d,-3

20140208_163009_1

notro commented 10 years ago

@dawys is the backlight connected to 3.3V on the Raspberry Pi? If so, that might give you problems, because it's pulling to much current. Please measure the backlight current. Also measure the voltage at TP1, it should be 4.75V. Mine was 4.67V, so I ordered an extra voltage regulator. I haven't had time to try it yet.

Plottr commented 10 years ago

hey trying to get a 5" screen with the ssd1963 chip. When i connect 3.3v to the vcc pin and gnd to the gnd pin nothing happens, then i wired it up for the flexfb driver and nothing happens, only time the panel did anything was when i removed the 3.3v wire and touched the 5v pin on my psu by accident and it lit up all white but still the only time anything happend at all.

Its a similar displat that you posted from Ebay earlier in the post notro. But its from Dx http://dx.com/p/800-x-480-5-0-lcd-tft-touch-screen-module-w-stylus-pen-for-arduino-blue-154505#.UwdvMHOJCIs

notro commented 10 years ago

hey trying to get a 5" screen with the ssd1963 chip.

From the product page: Model: TFT01-5.0

This page describes a product with the same name, and it has a schematic in the Material download file: http://www.elecfreaks.com/store/50-tft-lcd-screen-module-tft0150-p-420.html

Try connecting Vcc and and LED-A to 3.3V and Gnd to Gnd. That should light up the display.

Plottr commented 10 years ago

Yeah i have found the eledmfreaks page as well. Tried your suggestion no result, must have broken the whole thing in some way. I'm going to order a new one but it will take a while to get it delivered from China, will return with the result after that.

Thanks for the help.

t0mac0 commented 10 years ago

Hi, best regards I have a 7in TFT 800x480 with SSD1963 controller but is configured @8bits, how I can port this flexfb to my LCD.

Thank you for your help

notro commented 10 years ago

I have a 7in TFT 800x480 with SSD1963 controller but is configured @8bits, how I can port this flexfb to my LCD.

Set buswidth=8, init= to match your display and skip gpios= db08 to db15

t0mac0 commented 10 years ago

Right, I already connected the LCD RST -> GPIO29 RS/DC -> GPIO2 WR -> GPIO31 RD -> 3.3V LED_A -> 3.3V CS -> GND db00 -> GPIO11 db01 -> GPIO9 db02 -> GPIO10 db03 -> GPIO22 db04 -> GPIO27 db05 -> GPIO17 db06 -> GPIO4 db07 -> GPIO3 and add the files into kernel source, select as "M"

Support for small TFT LCD display modules ---> Generic FB driver for TFT LCD displays Module to for adding FBTFT devices but doesn't work. I type modprobe flexfb width=800 height=480 buswidth=8 init=-1,0xE2,0x23,0x02,0x04,-1,0xE0,0x01,-2,1,-1,0xE0,0x03,-2,5,-1,0x01,-2,5,-1,0xE6,0x03,0xff,0xff,-1,0xB0,0x27,0x00,0x03,0x1F,0x01,0xDF,0x00,-1,0xB4,0x03,0xA0,0x00,0x2E,0x30,0x00,0x0F,0x00,-1,0xB6,0x02,0x0D,0x00,0x10,0x10,0x00,0x08,-1,0xBA,0x0F,-1,0xB8,0x07,0x01,-1,0x36,0x00,-1,0xF0,0x03,-2,5,-1,0x29,-1,0xd0,0x0d,-3 modprobe fbtft_device name=flexfb cs=1 gpios=dc:18,reset:25 debug=3 Thank you for your help.
notro commented 10 years ago

modprobe fbtft_device name=flexfb cs=1 gpios=dc:18,reset:25 debug=3

You have to use the flexpfb device, there's a 'p' in there (parallel), and specify all the pins.

Like this:

sudo modprobe fbtft_device name=flexpfb debug=3 gpios=reset:29,dc:2,wr:31,db00:11,db01:9,db02:10,db03:22,db04:27,db05:17,db06:4,db07:3
t0mac0 commented 10 years ago

is a advance, it works halfway, I think that is because, in 8 bits mode the SSD1963 need 3 bytes for color like appears in this table. and I think the driver is only sending 2 bytes. If I'm right in what file I've to modify the routine that send the pixels?. config_2

img_20140224_234617

img_20140224_234655

notro commented 10 years ago

The driver sends RGB565 in two bytes. If the display controller expected 3 bytes, the display would only be filled 66% with a distorted image. You could try adjusting the gamma curve.

See if you can get some example code for that display. It usually contains the correct init sequence for the display.

t0mac0 commented 10 years ago

Hi, again you are right, I changed the init config to 8 bits and the display look like this command 0x0F parameter 0x03 //565 16 bits to
command 0x0F parameter 0x00 //pixel format 8 bits

img_20140225_231312

detailed img_20140225_231303

img_20140225_232507

It must have to convert the 565 format 16 bits, to 8 bits format and send 3 bytes instead 2 bytes, where is the routine that draw a pixel in LCD?

notro commented 10 years ago

It must have to convert the 565 format 16 bits, to 8 bits format and send 3 bytes instead 2 bytes, where is the routine that draw a pixel in LCD?

Why do want to change that, when the display controller supports RGB565? This will not affect the colors, just how the pixels are transferred.

The gamma curve is used to change the intensity of the colors. See 9.14 Set Gamma Curve in the datasheet. 4 curves to choose from.

fbtft_write_vmem16_bus8() is used to transfer video memory in your case: https://github.com/notro/fbtft/blob/master/fbtft-bus.c#L130

t0mac0 commented 10 years ago

Sorry but I do not want to be annoying, you have been nice to me in answering my questions, I need to handle touch screen along with the module touch, the module works perfectly, but I've had too many problems with TFT. I followed all your advice, but does not correct the errors. could you test with your TFT. I changed 9.76 Set Pixel Data Interface 9.29 Set Pixel Format 9.14 Set Gamma Curve

this is a specific driver to ssd1963, I compiled into the kernel but doesn't start. there is the aswer to port to 8 bits bus

https://www.assembla.com/code/edmar_playground/subversion/nodes/24/trunk/embedded/RaspberryPi

http://www.youtube.com/watch?v=4U9TWmFlZDo

There are two drivers in the SVN repo:

  1. Driver in userspace that mmaps the GPIO region and writes the gpio-register directly
  2. Real kernel framebuffer driver. This driver is a little slower than the usespace driver though I recommend using the userspace driver. To use 8 Bit bus you need to configure the init routine for 8 Bit mode (e.g. by sending the 0xF0 command with data 0). In tft_lcfg.c change line 52 from {0x00F0, 0x0003, 5U, PARAM}, // pixel data interface 16 bit 0b011 is 16 Bit to {0x00F0, 0x0000, 5U, PARAM}, // pixel data interface 8 bit 0b000 is 8 Bit

To manage 8 Bit communicatin you need to adapt dio_writePortGroup to use 8 Pins instead of 16 in dio.c. Note that here the used Pins for the bus are defined. Now in tft.c adapt tft_sendPixelData to use three writes instead of one. Have a look at www.microtipsusa.com/pdf/SSD1963.pdf page 16. You need to split the data in three sending routines. Change tft_sendPixelData() in tft.c line 43 to: void tft_sendPixelData ( uint16 data_ui16 ) { tft_selectRS(); dio_writePortGroup((uint8)((data_ui16 >> 9) & 0xF8)); tft_deSelectWR(); tft_selectWR();

dio_writePortGroup((uint8)((data_ui16 >> 3) & 0xFC)); tft_deSelectWR(); tft_selectWR();

dio_writePortGroup((uint8)((data_ui16 << 3) & 0xF8)); tft_deSelectWR(); tft_selectWR(); }

That's it. NOTE: With this high resolution and 3 writes per pixel you won't be able to watch videos or yo high framerates on the display. If you can manage to give at least 9 bits for the display bus you can reduce writing cycles to 2. This would speed up the display 33%!

notro commented 10 years ago

I'm sorry, but I don't have time to look into it. I wish I had more time to spend on this project :-)

jamesdownsbell commented 10 years ago

Hi notro just want to say thanks for the hard work Also I have made a basic power circuit from a 5v in and then I used a logic level converter to get to 3.3v and can confirm that flexfb does indeed work great The only issue I have is when I start x I have attached some pics Any help would b greatly appreciated thanx image image image image image image Also I have tried to connect the screen via a guzunty pi but it was failing to write using flexfb

notro commented 10 years ago

Also I have made a basic power circuit from a 5v in and then I used a logic level converter to get to 3.3v

I can't imagine a logic level converter being able to deliver enough current. Have you measured the supply voltage on the Pi and on the display?

jamesdownsbell commented 10 years ago

I can't imagine a logic level converter being able to deliver enough current. Have you measured the supply voltage on the Pi and on the display?

Hi notro , thanks for the reply I have no way of measuring the voltage,that's why I used the logic level converter to be sure that 3.3v @ 50mA was getting to the screen I did try to go from the 5v input ,but the screen stayed white It works great when I'm in the terminal, It's only when I start x the problems begin I have also tried using my guzunty pi with the daughter board and flexfb but the screen fails to initialise? i end up with with multi coloured dots . Have you tried a ssd1963 screen with your guzunty pi ? I will attach a pic of the circuit (lol and I use the term circuit loosely) and the screen connected to the guzunty And thanks again for your help image image

notro commented 10 years ago

I have no way of measuring the voltage,that's why I used the logic level converter to be sure that 3.3v @ 50mA was getting to the screen

So you're feeding the backlight from another source?

It works great when I'm in the terminal, It's only when I start x the problems begin

Have you tried showing pictures from the console (e.g. fbi) ?

I have also tried using my guzunty pi with the daughter board and flexfb but the screen fails to initialise? i end up with with multi coloured dots

An uninitialized display is in my experience always white. The kind of multicolored pixels shown on your picture, is the randomness in the onboard video memory before it's updated the first time.

Have you tried a ssd1963 screen with your guzunty pi ?

No. I haven't even tried my display since january.

jamesdownsbell commented 10 years ago

Hi again notro,thanks for taking me through this. Sorry if it seems like ur spoon feeding me I'm still a noob :0)

So you're feeding the backlight from another source?

Yes sorry if I didn't make that clear I am using a ams1117 5v regulator. Then stepping down to 3.3v via logic level convertor,breaking out the power and ground connecting the 3.3v,RD,LED_A and GND,CS and T_cs to ground

Have you tried showing pictures from the console (e.g. fbi) ?

I haven't powered my pi's yet today,but I will try and report the results

An uninitialized display is in my experience always white. The kind of multicolored pixels shown on your picture, is the randomness in the onboard video memory before it's updated the first time.

Ok so would the initialisation code be different over spi ? When I try to use flexfb it fails to write and says the max memory was exceeded or something like that lol. Also out of desperation,if nothing else really, I have been trying all of the drivers in fbtft the only one that shows any real difference than the aforementioned muti dots is the itbd28_spi,and the screen is half white and the other half is white and black lines.

Thanks again for your patience and taking the time to reply.

notro commented 10 years ago

Ok so would the initialisation code be different over spi ?

No, not in this case since the SPI interface is outside of the controller.

When I try to use flexfb it fails to write and says the max memory was exceeded or something like that lol.

Is this when you try it with the Guzunty? I need to know the error message to help out here.

Also out of desperation,if nothing else really, I have been trying all of the drivers in fbtft the only one that shows any real difference than the aforementioned muti dots is the itbd28_spi,and the screen is half white and the other half is white and black lines.

For the purpose of this discussion, the only thing that differs between drivers are the init sequence and the set_addr_win() function.

jamesdownsbell commented 10 years ago

Hi again notro Thanks for quick reply, the pi is connected to the guzunty and I'm typing as follows, sudo modprobe --first-time flexfb width=480 height=272 regwidth=16 init=-1,0xE2,0x2d,0x02,0x04,-1,0xE0,0x01,-2,1,-1,0xE0,0x03,-2,5,-1,0x01,-2,5,-1,0xE6,0x00,0xff,0xbe,-1,0xB0,0x20,0x00,0x01,0xDF,0x01,0x0F,0x00,-2,5,-1,0xB4,0x02,0x13,0x00,0x2B,0x0A,0x00,0x08,0x00,-1,0xB6,0x01,0x20,0x00,0x0C,0x0A,0x00,0x04,-1,0x36,0x00,-1,0xF0,0x03,-2,5,-1,0x29,-1,0xBE,0x06,0xf0,0x01,0xf0,0x00,0x00,-1,0xd0,0x0d,-1,0xB8,0x00,0x01,-1,0xBA,0x00,-3

Then,sudo modprobe --first-time fbtft_device name=flexfb gpios=reset:22,dc:27 rotate=0 verbose=0 speed=32000000 fps=30 txbuflen=0

I changed buswidth to regwidth as buswidth is not supported over spi And thanks again for your help

Edit: There has been a development I now have a black screen with a white flashing underscore :0) I think it's working now, just some parameter to do with the size is out. dmesg shows this

[ 257.026617] graphics fb1: flexfb frame buffer, 480x272, 255 KiB video memory, 4 KiB DMA buffer memory, fps=33, spi0.0 at 32 MHz

Thanks again notro you have been a big help Edit 2: I can confirm this working now via the guzunty pi without any external power :0) image

jamesdownsbell commented 10 years ago

Hi notro, Just wondering if you have the initialisation code for the 7" ssd1963 please? Or if not,how complex if figuring it out from arduino code ? being the noob I am lol :0) Thanks again for your help

Ps :you should update the wiki when you have time,because my 4.3" screen is working flawlessly over spi without any additional power.

notro commented 10 years ago

Just wondering if you have the initialisation code for the 7" ssd1963 please?

No, sorry.

Or if not,how complex if figuring it out from arduino code ? being the noob I am lol :0)

Should be easy. Do you have a link to the source code?

Ps :you should update the wiki when you have time,because my 4.3" screen is working flawlessly over spi without any additional power.

Is the display powered from 5v or 3.3v?

jamesdownsbell commented 10 years ago

Hi Notro, Thanks again for your quick reply.

Is the display powered from 5v or 3.3v?

I am plugging the screen directly into 40 pin connector on the guzunty pis daughter card.The guzunty is connected to the pi, I'm using the standard lcd core on the guzunty wiki,and flexfb with the code above

Should be easy. Do you have a link to the source code?

http://coldtears.lin3.siteonlinetest.com/files/7.0Fb.zip That should be the link to the PDF with the initilisation code for Arduino, there may well be a lot of rubbish in there too lol.

http://www.ebay.co.uk/itm/7-7-0-inch-TFT-LCD-module-Font-IC-800x480-SSD1963-arduino-DUE-MEGA2560-3-5-4-3-/111008432389 That's the link to the seller Thanks again

notro commented 10 years ago

From UTFT\tft_drivers\ssd1963\800alt

case SSD1963_800ALT:
    LCD_Write_COM(0xE2);        //PLL multiplier, set PLL clock to 120M
    LCD_Write_DATA(0x23);       //N=0x36 for 6.5M, 0x23 for 10M crystal
    LCD_Write_DATA(0x02);
    LCD_Write_DATA(0x04);
    LCD_Write_COM(0xE0);        // PLL enable
    LCD_Write_DATA(0x01);
    delay(10);
    LCD_Write_COM(0xE0);
    LCD_Write_DATA(0x03);
    delay(10);
    LCD_Write_COM(0x01);        // software reset
    delay(100);
    LCD_Write_COM(0xE6);        //PLL setting for PCLK, depends on resolution
    LCD_Write_DATA(0x04);
    LCD_Write_DATA(0x93);
    LCD_Write_DATA(0xE0);

    LCD_Write_COM(0xB0);        //LCD SPECIFICATION
    LCD_Write_DATA(0x00);   // 0x24
    LCD_Write_DATA(0x00);
    LCD_Write_DATA(0x03);       //Set HDP   799
    LCD_Write_DATA(0x1F);
    LCD_Write_DATA(0x01);       //Set VDP   479
    LCD_Write_DATA(0xDF);
    LCD_Write_DATA(0x00);

    LCD_Write_COM(0xB4);        //HSYNC
    LCD_Write_DATA(0x03);       //Set HT    928
    LCD_Write_DATA(0xA0);
    LCD_Write_DATA(0x00);       //Set HPS   46
    LCD_Write_DATA(0x2E);
    LCD_Write_DATA(0x30);       //Set HPW   48
    LCD_Write_DATA(0x00);       //Set LPS   15
    LCD_Write_DATA(0x0F);
    LCD_Write_DATA(0x00);

    LCD_Write_COM(0xB6);        //VSYNC
    LCD_Write_DATA(0x02);       //Set VT    525
    LCD_Write_DATA(0x0D);
    LCD_Write_DATA(0x00);       //Set VPS   16
    LCD_Write_DATA(0x10);
    LCD_Write_DATA(0x10);       //Set VPW   16
    LCD_Write_DATA(0x00);       //Set FPS   8
    LCD_Write_DATA(0x08);

    LCD_Write_COM(0xBA);
    LCD_Write_DATA(0x05);       //GPIO[3:0] out 1

    LCD_Write_COM(0xB8);
    LCD_Write_DATA(0x07);       //GPIO3=input, GPIO[2:0]=output
    LCD_Write_DATA(0x01);       //GPIO0 normal

    LCD_Write_COM(0x36);        //rotation
    LCD_Write_DATA(0x02);       // -- Set to 0x01 to rotate 180 degrees

    LCD_Write_COM(0xF0);        //pixel data interface
    LCD_Write_DATA(0x03);

    delay(10);

    setXY(0, 0, 799, 479);
    LCD_Write_COM(0x29);        //display on

    LCD_Write_COM(0xBE);        //set PWM for B/L
    LCD_Write_DATA(0x06);
    LCD_Write_DATA(0xF0);
    LCD_Write_DATA(0x01);
    LCD_Write_DATA(0xF0);
    LCD_Write_DATA(0x00);
    LCD_Write_DATA(0x00);

    LCD_Write_COM(0xD0); 
    LCD_Write_DATA(0x0D);   

    LCD_Write_COM(0x2C); 
    break;

Before LCD_Write_COM value you add -1, and before delay value you add -2, and end it all with -3

init=-1,0xE2,0x23,0x02,0x04,-1,0xE0,0x01,-2,10, and so on,-3
jamesdownsbell commented 10 years ago

Hi notro, Thank you for your help with this. I am waiting for my 7" ssd1963 to arrive from china . When in gets here I will try the code and report the results. Thanks again

Edit : hi again lol I got my model B+ today and after rpi-update everything is still working flawlessly

jamesdownsbell commented 10 years ago

Hi notro, Me again lol. I have received my 7" ssd1963 I have wrote the initialisation code you helped me with earlier, But I seem to be missing something the screen starts but the colors are distorted and the image is inverted. I can't see where I'm going wrong :-1: any input at this point would be helpful as I am scratching my head lol. Thanks once again for your help

Edit : I've added a few pictures of the issues I mentioned image image image image

jamesdownsbell commented 10 years ago

Hi notro, I've had a development,the screen is now starting as it should. :+1: The 4.3" & 7" ssd1963 screens are supported by flexfb :) The only issue I'm finding is the image is reversed ie, the text reads from right to left. I don't however think it is a problem with fbtft I think the issue lays with fbcp .I'm just not sure how to proceed at this point . I have attached a few images of the aforementioned issue. Thanks once again for you help with this image image image image

notro commented 10 years ago

Set Address Mode, register 36h controls rotation and mirroring. You just have to try the different values. I have never understood how it works. I always end up trying different combinations until it works. See the datasheet, maybe you understand how it ties together.

jamesdownsbell commented 10 years ago

Hi notro, Thanks for your quick reply , I will check the data sheet and try to change the values then report back. Thanks again

jamesdownsbell commented 10 years ago

Hi notro You my friend are a genius :+1: I changed the 36h from 0x02 to 0x00 and just like magic it was solved. Thanks once again. image image

Sorry about the image quality (crappy ipad camera) Edit: everything is working fine other than the refresh rate seem a bit off. I have turned the speed up to 64000000 which has helped but I'm still not all the way there yet. Also I noticed changing the speed has upped the video memory 750 KiB but DMA is still at 4 KiB ? . Do think I should turn it up ?.

Edit 2 : I have resolved the issue .It was a loose cable :). I have also uploaded a video to YouTube of the 7" screen running at 64000000.using the ultra slim raspbian,fbcp and fbtft. Thanks again

https://m.youtube.com/watch?v=wBoRlrDtkwI

jamesdownsbell commented 10 years ago

Hi notro, Just wondering what's the fastest speed you have had from the ssd1963 ?. At the moment the best I can get is 82MHz at 50fps. It still seems struggle a bit with 720p, I mean it's watchable but still not quite there yet. I'm not sure if there is anyway of improving it ?. I will upload another video and you will see what I mean. edit: this what I am using to start the screen in case anybody else wants to give this a try :+1:. I have kept the size at 800x480 but for some reason this still set the screen to fit the 7". I am connecting the screen via a guzunty pi over spi. The init- code should be the same over parallel but you will need to change regwidth=16 to buswidth=16. flexfb width=800 height=480 regwidth=16 init=-1,0xE2,0x23,0x02,0x04,-1,0xE0,0x01,-2,10,-1,0xE0,0x03,-2,10,-1,0x01,-2,100,-1,0xE6,0x04,0x93,0xE0,-1,0xB0,0x00,0x00,0x03,0x1f,0x01,0xdf,0x00,-1,0xB4,0x03,0xA0,0x00,0x2E,0x30,0x00,0x0f,0x00,-1,0xB6,0x02,0x0D,0x00,0x10,0x10,0x00,0x08,-1,0xBA,0x05,-1,0xB8,0x07,0x01,-1,0x36,0x00,-1,0xf0,0x03,-2,10,-1,0x29,-1,0xBE,0x06,0xf0,0x00,0x00,-1,0xd0,0x0d,-1,0x2C,-3 fbtft_device name=flexfb gpios=reset:22,dc:27 debug=3 rotate=0 verbose=0 speed=82000000 fps=50 txbuflen=0

edit 2: Heres the link to the video i have uploaded of the screen running a rom and a video (720p) @82MHz.. Sorry its so long but i could not get the video to start first time. This was my forth attempt so i just went with it. :) http://www.youtube.com/watch?v=CKDNqlizkQk

notro commented 10 years ago

I'm very impressed with what you've done here. Doing 800x480 this well over SPI, quite amazing! The only thing I can think of, is using some sort of simple compression. Is it possible to implement that in guzunty?

http://www.hwlevel.com/ uses compression in at least one of their displays.