nopnop2002 / Raspberry-ili9325

Parallel TFT Shield Library for wiringPi
64 stars 14 forks source link

Code works but frame buffer doesnt on Mcufriend ili9325 #19

Closed tbillion closed 3 years ago

tbillion commented 7 years ago

where did you get this init code? init=\ -1,0x00E3,0x3008,-1,0x00E7,0x0012,-1,0x00EF,0x1231,\ -1,0x0001,0x0100,-1,0x0002,0x0700,-1,0x0003,0x1030,\ -1,0x0004,0x0000,-1,0x0008,0x0207,-1,0x0009,0x0000,\ -1,0x000A,0x0000,-1,0x000C,0x0000,-1,0x000D,0x0000,\ -1,0x000F,0x0000,-1,0x0010,0x0000,-1,0x0011,0x0007,\ -1,0x0012,0x0000,-1,0x0013,0x0000,-2,200,\ -1,0x0010,0x1690,-1,0x0011,0x0223,-2,50,\ -1,0x0012,0x000D,-2,50,-1,0x0013,0x1200,\ -1,0x0029,0x000A,-1,0x002B,0x000C,-2,50,\ -1,0x0020,0x0000,-1,0x0021,0x0000,-1,0x0030,0x0000,\ -1,0x0031,0x0506,-1,0x0032,0x0104,-1,0x0035,0x0207,\ -1,0x0036,0x000F,-1,0x0037,0x0306,-1,0x0038,0x0102,\ -1,0x0039,0x0707,-1,0x003C,0x0702,-1,0x003D,0x1604,\ -1,0x0050,0x0000,-1,0x0051,0x00EF,-1,0x0052,0x0000,\ -1,0x0053,0x013F,-1,0x0060,0xA700,-1,0x0061,0x0001,\ -1,0x006A,0x0000,-1,0x0080,0x0000,-1,0x0081,0x0000,\ -1,0x0082,0x0000,-1,0x0083,0x0000,-1,0x0084,0x0000,\ -1,0x0085,0x0000,-1,0x0090,0x0010,-1,0x0092,0x0600,\ -1,0x0007,0x0133,-3

ive been trying for 3 days to get this screen to work when i first use the commands for modprobe it will turn the screen black (but its always black) and then it will just flash ... i suspect the init codes are wrong or i have an ili 9325 (C) or (D) which are newer revisions that have different init sequences.i also cant figure out how this init sequecen works how does the system know which part of the variables is the command and which is the data...

nopnop2002 commented 7 years ago

I got this code from here. https://github.com/notro/fbtft/wiki/flexfb

At first,You have to check the chip of your TFT using this. https://github.com/nopnop2002/lcd_id

Most seller's information is NOT right. I have more than 10 of TFT. But I have not met right seller's information in the past.

There is ILI9325C/9325D initialize sequence. https://www.itead.cc/blog/initialization-for-ili9325c-ili9325d-ili9327-and-hx8347-a

You can convert to INIT parameter.

LCD_Write_COM(0x00,0xE5); LCD_Write_DATA(0x78,0xF0); // set SRAM internal timing LCD_Write_COM(0x00,0x01); LCD_Write_DATA(0x01,0x00); // set SS and SM bit

delay(50); // Delay 50ms

init=-1,0x00E5,0x78F0,-1,0x0001,0x0100,....,-2,50,.....,-3

tbillion commented 7 years ago

ive already confirmed with the actual arduino code that the displays are 9325 but like that itead site says, there are newer variations, than you for the example how to convert the itead information i tried for a good day to converti ti to notros information string but i was doing it incorrectly i see. i could not find in his source how he was sending the information to the display.

Is there any rhyme or reason to the connection pins that the LCD is attached to ? or is it just whatever you feel like?

EDIT:

`Option 1 Rev C: modprobe fbtft_device name=flexpfb rotate=180 fps=60 gpios=dc:3,reset:17,wr:2,cs:21,db00:9,db01:11,db02:18,db03:23,db04:24,db05:25,db06:8,db07:7 modprobe flexfb width=240 height=320 buswidth=8 regwidth=16 setaddrwin=1 init=-1,0x0001,0x0100,-1,0x0002,0x0200,-1,0x0003,0x1030,-1,0x0004,0x0000,-1,0x0008,0x0207,-1,0x0009,0x0000,-1,0x000A,0x0000,-1,0x000C,0x0000,-1,0x000D,0x0000,-1,0x000F,0x0000,-1,0x0010,0x0000,-1,0x0011,0x0007,-1,0x0012,0x0000,-1,0x0013,0x0000,-1,0x0007,0x0001,-2,200,-1,0x0010,0x1690,-1,0x0011,0x0227,-2,50,-1,0x0012,0x000D,-2,50,-1,0x0013,0x1200,-1,0x0029,0x000A,-1,0x002B,0x000D,-2,50,-1,0x0020,0x0000,-1,0x0021,0x0000,-1,0x0030,0x0000,-1,0x0031,0x0404,-1,0x0032,0x0003,-1,0x0035,0x0405,-1,0x0036,0x0808,-1,0x0037,0x0407,-1,0x0038,0x0303,-1,0x0039,0x0707,-1,0x003C,0x0504,-1,0x003D,0x0808,-1,0x0050,0x0000,-1,0x0051,0x00EF,-1,0x0052,0x0000,-1,0x0053,0x013F,-1,0x0060,0xA700,-1,0x0061,0x0001,-1,0x006A,0x0000,-1,0x0080,0x0000,-1,0x0081,0x0000,-1,0x0082,0x0000,-1,0x0083,0x0000,-1,0x0084,0x0000,-1,0x0085,0x0000,-1,0x0090,0x0010,-1,0x0092,0x0000,-1,0x0007,0x0133,-3

Option2 Rev D: modprobe fbtft_device name=flexpfb rotate=180 fps=60 gpios=dc:3,reset:17,wr:2,cs:21,db00:9,db01:11,db02:18,db03:23,db04:24,db05:25,db06:8,db07:7 modprobe flexfb width=240 height=320 buswidth=8 regwidth=16 setaddrwin=1 init=-1,0x0001,0x0100,-1,0x0002,0x0200,-1,0x0003,0x1030,-1,0x0004,0x0000,-1,0x0008,0x0207,-1,0x0009,0x0000,-1,0x000A,0x0000,-1,0x000C,0x0000,-1,0x000D,0x0000,-1,0x000F,0x0000,-1,0x0010,0x0000,-1,0x0011,0x0007,-1,0x0012,0x0000,-1,0x0013,0x0000,-1,0x0007,0x0001,-2,200,-1,0x0010,0x1690,-1,0x0011,0x0227,-2,50,-1,0x0012,0x000D,-2,50,-1,0x0013,0x1200,-1,0x0029,0x000A,-1,0x002B,0x000D,-2,50,-1,0x0020,0x0000,-1,0x0021,0x0000,-1,0x0030,0x0000,-1,0x0031,0x0404,-1,0x0032,0x0003,-1,0x0035,0x0405,-1,0x0036,0x0808,-1,0x0037,0x0407,-1,0x0038,0x0303,-1,0x0039,0x0707,-1,0x003C,0x0504,-1,0x003D,0x0808,-1,0x0050,0x0000,-1,0x0051,0x00EF,-1,0x0052,0x0000,-1,0x0053,0x013F,-1,0x0060,0xA700,-1,0x0061,0x0001,-1,0x006A,0x0000,-1,0x0080,0x0000,-1,0x0081,0x0000,-1,0x0082,0x0000,-1,0x0083,0x0000,-1,0x0084,0x0000,-1,0x0085,0x0000,-1,0x0090,0x0010,-1,0x0092,0x0000,-1,0x0007,0x0133,-3 `

there are the commands i used for my display turns out my display is as i suspected a revision D ili9325, i am getting closer to a solution however now my video on the tft looks like this:

https://youtu.be/apV1xKtHrbw

Here are the command line commands i used to test this please tell me if i am doing something wrong... https://goo.gl/photos/VbHATF7CaK1Gr1JK9

tbillion commented 7 years ago

got it ... David Prentice Actually has the right Init Code it is

Option 8 Rev D (David Prentice): YES modprobe fbtft_device name=flexpfb rotate=180 fps=60 gpios=dc:3,reset:17,wr:2,cs:21,db00:9,db01:11,db02:18,db03:23,db04:24,db05:25,db06:8,db07:7 modprobe flexfb width=240 height=320 buswidth=8 regwidth=16 setaddrwin=1 init=-1,0x00E5,0x78F0,-1,0x0001,0x0100,-1,0x0002,0x0200,-1,0x0003,0x1030,-1,0x0004,0x0000,-1,0x0005,0x0000,-1,0x0008,0x0207,-1,0x0009,0x0000,-1,0x000A,0x0000,-1,0x000C,0x0000,-1,0x000D,0x0000,-1,0x000F,0x0000,-1,0x0010,0x0000,-1,0x0011,0x0007,-1,0x0012,0x0000,-1,0x0013,0x0000,-1,0x0007,0x0001,-2,200,-1,0x0010,0x1690,-1,0x0011,0x0227,-2,50,-1,0x0012,0x000D,-2,50,-1,0x0013,0x1200,-1,0x0029,0x000A,-1,0x002B,0x000D,-2,50,-1,0x0020,0x0000,-1,0x0021,0x0000,-1,0x0030,0x0000,-1,0x0031,0x0404,-1,0x0032,0x0003,-1,0x0035,0x0405,-1,0x0036,0x0808,-1,0x0037,0x0407,-1,0x0038,0x0303,-1,0x0039,0x0707,-1,0x003C,0x0504,-1,0x003D,0x0808,-1,0x0060,0x2700,-1,0x0061,0x0001,-1,0x006A,0x0000,-1,0x0080,0x0000,-1,0x0081,0x0000,-1,0x0082,0x0000,-1,0x0083,0x0000,-1,0x0084,0x0000,-1,0x0085,0x0000,-1,0x0090,0x0010,-1,0x0092,0x0000,-1,0x0007,0x0133,-3

its from the MCUFRIEND_kbv for arduino. I figured if it works on arduino well why not here. and it does.. Thanks you for showing me how to convert the codes to fbtft

-T

nopnop2002 commented 7 years ago

Thank you very much for your report. I'm not good at English. When someone else questioned newly, I expect your response.

WacKEDmaN commented 4 years ago

along the same lines here... i have a ili9341 lcd running with the demos here..works great.. but now im trying to get it working as framebuffer.. using these commands... i see the screen flicker and change from solid white to white with lines...

sudo modprobe fbtft_device name=flexpfb fps=60 gpios=dc:3,reset:4,wr:7,cs:2,db00:5,db01:6,db02:13,db03:19,db04:26,db05:12,db06:17,db07:20

sudo modprobe flexfb width=240 height=320 buswidth=8 regwidth=16 setaddrwin=1 init=-1,0x28,-2,20,-1,0xCF,0x00,0x83,0x30,-1,0xED,0x64,0x03,0x12,0x81,-1,0xE8,0x85,0x01,0x79,-1,0xCB,0x39,0x2c,0x00,0x34,0x02,-1,0xF7,0x20,-1,0xEA,0x00,0x00,-1,0xC0,0x26,-1,0xC1,0x11,-1,0xC5,0x35,0x3E,-1,0xC7,0xBE,-1,0xB1,0x00,0x1B,-1,0xB6,0x0a,0x82,0x27,0x00,-1,0xB7,0x07,-1,0x3A,0x55,-1,0x36,0x48,-1,0x11,-2,120,-1,0x29,-2,20,-3

im not sure if pinouts are wrong, i converted the wiringpi pins to the BCM pins (with the gpio readall table)..or if the init string is wrong for this LCD (ive tryed multiple..even tryed converting it from this ili93xx.c file)..

any tips would be greatly appreciated

nopnop2002 commented 4 years ago

Many of the reasons why it doesn't work properly are that your TFT is not ILI9341.

Use this to confirm that your TFT is ILI9341.

https://github.com/nopnop2002/lcd_id

WacKEDmaN commented 4 years ago

it is a ILI9341.. chcked with lcd_id..i use ili9341 libs on both arduino and stm32..and it works with your code with -DILI9341... i just cant get framebuffer to work

nopnop2002 commented 4 years ago

I executed the following command:

$ sudo modprobe fbtft_device name=flexpfb \
gpios=reset:4,dc:3,wr:7,cs:2,db00:5,db01:6,db02:13,db03:19,db04:26,db05:12,db06:16,db07:20

$ dmesg

[   92.540238] fbtft_device: GPIOS used by 'flexpfb':
[   92.540250] fbtft_device: 'reset' = GPIO4
[   92.540257] fbtft_device: 'dc' = GPIO3
[   92.540263] fbtft_device: 'wr' = GPIO7
[   92.540270] fbtft_device: 'cs' = GPIO2
[   92.540276] fbtft_device: 'db00' = GPIO5
[   92.540282] fbtft_device: 'db01' = GPIO6
[   92.540289] fbtft_device: 'db02' = GPIO13
[   92.540296] fbtft_device: 'db03' = GPIO19
[   92.540302] fbtft_device: 'db04' = GPIO26
[   92.540309] fbtft_device: 'db05' = GPIO12
[   92.540315] fbtft_device: 'db06' = GPIO16
[   92.540322] fbtft_device: 'db07' = GPIO20
[   92.540364] bcm2708_fb soc:fb: soc:fb id=-1 pdata? no
[   92.540401] platform flexpfb.0: flexpfb id=0 pdata? yes
[   92.560796] flexfb: module is from the staging directory, the quality is unknown, you have been warned.
[   92.562933] flexfb flexpfb.0: argument(s) missing: width and height has to be set.
[   92.562994] flexfb: probe of flexpfb.0 failed with error -22

I have confirmed that flexpfb gives an error, but I don't know why.

WacKEDmaN commented 4 years ago

thank you :) i am seeing the same things.. even if i modprobe flexfb first...with width and height..and the init...the FB still wont show(it doesnt throw any errors in dmesg..but doesnt display anything either!)

strange thing is it works perfect with the wiringpi code..

nopnop2002 commented 4 years ago

I tried this:

$ sudo modprobe fbtft_device name=flexpfb \
width=240 height=320 gpios=reset:4,dc:3,wr:7,cs:2,db00:5,db01:6,db02:13,db03:19,db04:26,db05:12,db06:16,db07:20

But the error doesn't disappear from dmsg.

[ 1061.960633] flexfb flexpfb.0: argument(s) missing: width and height has to be set.
[ 1061.960690] flexfb: probe of flexpfb.0 failed with error -22
WacKEDmaN commented 4 years ago

i do.. flexfb first..then the flexpfb.. theres a P in there for Parallel LCDs

sudo modprobe flexfb width=240 height=320 buswidth=8 regwidth=16 setaddrwin=1 init=-1,0x28,-2,20,-1,0xCF,0x00,0x83,0x30,-1,0xED,0x64,0x03,0x12,0x81,-1,0xE8,0x85,0x01,0x79,-1,0xCB,0x39,0x2c,0x00,0x34,0x02,-1,0xF7,0x20,-1,0xEA,0x00,0x00,-1,0xC0,0x26,-1,0xC1,0x11,-1,0xC5,0x35,0x3E,-1,0xC7,0xBE,-1,0xB1,0x00,0x1B,-1,0xB6,0x0a,0x82,0x27,0x00,-1,0xB7,0x07,-1,0x3A,0x55,-1,0x36,0x48,-1,0x11,-2,120,-1,0x29,-2,20,-3 

sudo modprobe fbtft_device name=flexpfb fps=60 gpios=dc:3,reset:4,wr:7,cs:2,db00:5,db01:6,db02:13,db03:19,db04:26,db05:12,db06:17,db07:20

then fb1 shows up in /dev but fbcp and console change over doesnt seem to work...

nopnop2002 commented 4 years ago

regwidth=16 ??

Is your ILI9341 16Bit-I/F? ? If 8Bit-I/F, try the following.

https://github.com/nopnop2002/ili9325_rpi/wiki/FrameBuffer-Setting-to-ILI9341

WacKEDmaN commented 4 years ago

yes its 8bit... i tryed 8 regwidth.. same results... ill check out the new info...thanks