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

Problem with SPI interface circuit #89

Closed masoudr closed 10 years ago

masoudr commented 10 years ago

Hi notro, first I wanna say thank you for your great work. I have a 2.4 inch tft lcd with ili9325 drive which worked fine with your kernel and 8bit parallel data bus,but I wanna use your spi interface circuit,but I can't get it work :( I tried your test script and last night I got an error that was about "wr" pin,so I changed the "STR" pin which comes from 4096 to Q3 instead of Q2 in 4040 IC (as you mentioned in the circuit) so the problem with "wr" fixed. but still I have nothing in my screen,even when I load the driver still I have only white screen(I know if I make it work it will go black with back light on) So I couldnt get it worked yet,and I dont know what should I do. can you help me ? also I use these ICs in my circuit maybe the problem is there: CD74HC4040 TC74HC4049AP TC74HCU04AP

thanks.

edit: finally I get it working: "sudo modprobe fbtft dma" but I set the speed on 16 Mhz and I think it is too slow,but when I change it to 32Mhz,the Speed get better but the colors get worst :(

notro commented 10 years ago

When the colors get wrong, you have transmission errors. I could use 48Mhz on my ILI9325 display, but I could not use DMA: https://github.com/notro/fbtft/wiki/Performance#itdb28_spi

On the latest kernel DMA is enabled by default. To turn off:

sudo modprobe fbtft dma=0
masoudr commented 10 years ago

I dont know what the dma is,but which is better to get it on or off ? last hour I used my 3.2 tft ssd 1289,but when I played a video it seems that both frame rates with ili9325 and ssd1289 are the same in 16Mhz. with enabled dma both of these LCDs worked fine. do you suggest enabling dma ? and my second question is if I increase the fps in loading the driver is better or not ? for example you said that you get 10 frames on ssd1289 what would happen if I set the fps on 20 on the loading of driver or leave it as defaults ? and my third question is my touch screen of ili9325 lcd hasnt the driver and it only has X- X+ Y- Y+ pins,can I make it work without external interface ? thanks bro.

notro commented 10 years ago

Using DMA lessens the burden on the CPU, as the number of interrupts is drastically reduced. But if you only use it as a console or for X windows without showing movies, it's not that important. DMA is good if you can use it.

The fps argument name is misleading, as it denotes the delay between updates. Increased fps means less delay between updates. Details: https://github.com/notro/fbtft/wiki/FPS

my touch screen of ili9325 lcd hasnt the driver and it only has X- X+ Y- Y+ pins,can I make it work without external interface ?

You need a touch controller to use that touch panel. Many displays use the ADS7846 or compatible.

masoudr commented 10 years ago

I can get maximum 20Mhz for ssd1289 with enabled DMA. everything works fine,but for last question I used 5 volts for vdd of the ICs,and LCD,because I saw on datasheet that if we use 5 volts on vdd we can achieve higher frequency. for example in my 4040 IC,maximum frequency on 5volt is about 30 Mhz,while on 3.3v it is just about 15Mhz,is it true ? and does it harm the Raspberry pi or I have to use only 3.3 v from my pi ? thanks

notro commented 10 years ago

I used 5 volts for vdd of the ICs

Maybe that's why you can use DMA and I can't.

As long as you don't feed 5V into the Pi and the LCD controller handles 5V, I see no reason why you can't do it. But I'm no expert in these matters. Have a look in the datasheet and see what the minimum voltage for HIGH is at 5V. The SSD1289 has a Vddio pin that controls the power for the interface pins.

in my 4040 IC,maximum frequency on 5volt is about 30 Mhz,while on 3.3v it is just about 15Mhz,is it true ?

Probably. These are my findings: https://github.com/notro/fbtft/wiki/SPI-interface-circuit#dynamic-charateristics

masoudr commented 10 years ago

few hours ago I used 3.3v and the maximum frequency was about 16Mhz with enabled DMA. I saw on datasheet that high output voltage at vdd=5v was about 4.4 volts,anyway I think if we can increase the supply voltage we can achieve higher frequency.or I think it is better to use a micro controller instead. I think some arduino interfaces like pro mini would be good choice and we can achieve higher frequency at the cost of nothing.

notro commented 10 years ago

I think some arduino interfaces like pro mini would be good choice and we can achieve higher frequency at the cost of nothing.

That will be difficult with these speeds:

There are two version of the Pro Mini. One runs at 3.3V and 8 MHz, the other at 5V and 16 MHz.

masoudr commented 10 years ago

does the low frame rate just because of frequency ? Is there any way to increase the frame rate without increasing the frequency ? I create a breakout shield for your interface and it is doing fine,however there are some interfaces in my country which connect to AV/HDMI pin and you can just install your LCD on it but only supports bigger one which has LVDS output like 7" LCDs.

notro commented 10 years ago

You can increase the framerate by increasing the fbtft_device fps= argument. The fps value is used to calculate the minimum delay between updates in kernel ticks: 100/fps This means you have these (high) values: 20 (default), 30, 50, 100

Details: https://github.com/notro/fbtft/wiki/FPS

masoudr commented 10 years ago

I increased the FPS when loading the driver but still I cant get smoothness in playing videos. I read that article but I cant figure it out how to find true FPS of my display. how much the number of FPS must be or you suggest ?

notro commented 10 years ago

I increased the FPS when loading the driver but still I cant get smoothness in playing videos.

I don't think you can manage that at 20MHz. Some performance numbers: https://github.com/notro/fbtft/wiki/Performance The SPI Interface circuit is not for high performance use.

I read that article but I cant figure it out how to find true FPS of my display.

Use the debug argument like in the Performance page. Use dmesg to see the numbers.

masoudr commented 10 years ago

thanks bro, I increased the fps to 60 and I got better video frame rate. one more question,can I use a single chip Serial/parallel 16bit converter like "74F676", it has maximum frequency about 90Mhz. moreover I don't know,maybe the limitation of maximum frequency is because of binary counter,if not I think we can achieve higher frequency with a single 16bit parallel Serial converter which has more benefits. Is it right ?

notro commented 10 years ago

one more question,can I use a single chip Serial/parallel 16bit converter like "74F676",

54F/74F676 - 16-Bit Serial/Parallel-In, Serial-Out Shift Register I couldn't find anything about parallel out in the datasheet.

A single chip would have been a better solution, but when I researced this, I couldn't find a readily available one with a higher frequency.

masoudr commented 10 years ago

hum maybe your right I think I have to more research with this. because of these small screens I wanna use larger screens but I dont know which option is better: using these lcds with this interface which connected to gpio pins, or use a TV to lcd controller board which uses AV output and lcd that connects to it directly, which has better performance ?

notro commented 10 years ago

SPI/GPIO connected displays drops in performance as the resolution increases. The best update speed I have seen with FBTFT is 4400kB/s: https://github.com/notro/fbtft/wiki/Performance

Theoretical max fps: QVGA - 320x240 is 320x240x2 bytes per full frame update = 150kB -> 4400/150 fps = 29fps VGA - 640x480 = 600kB -> 7fps

HDMI/RCA has the best performance since the GPU does the display update. As I understand the RCA output doesn't give sharp images.

Or you can wait for: http://raspi.tv/2014/raspberry-pi-official-7-inch-dsi-prototype-preview

masoudr commented 10 years ago

yes you are right,in my country these stuffs wont come easily and older stuffs for RasPi hasnt came yet.I just wanna buy this interface board with a 7" TFT lcd because I don't have a HDMI TV.

http://www.ebay.com/itm/LCD-Controller-Board-for-7-TFT-LCD-Module-800x480-50Pins-AT070TN92-93-94-/170975426131?pt=US_TV_Boards_Parts_Components&hash=item27ceedf653

http://www.ebay.com/itm/7inch-original-INNOLUX-AT070TN92-800-480-TFT-lcd-with-touch-panel-7-tft-lcd-/180842934946

notro commented 10 years ago

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

karlitos commented 10 years ago

Hello,

did anyone tried to find a single chip, which woul replace the SPI interface circuit ?

I was able to find these following chis: 74F675ASC - 16-Bit Serial-In, Serial/Parallel-Out Shift Register The maximal frequency of this chip should be 90MHz There are some of them availible on eBay.

STP16DPS05 - Low voltage 16-bit constant current LED sink driver with outputs error detection This should operate at 30MHz and can be ordered online.

Beside the 16-Bit Serial-In, Parallel-Out feature, for which other necessary properties should I look ?

notro commented 10 years ago

Beside the 16-Bit Serial-In, Parallel-Out feature, for which other necessary properties should I look ?

You need a way to latch the data into the LCD controller (/WR). This is the difficult one to find at high speed and low price.

stevstrong commented 7 years ago

Sorry to wake up this thread here after such long inactivity time, but I would like to share my experience with the SPI interface posted here.

I am driving a 480x320 display board with a Blue Pill, and during my tests I encountered the problem of the display not working (corrupted colors) with frequencies higher than 24MHz (see my detailed posts here).

I have found out that the bottleneck is the involved 74HC4040 counter - it has (on my board at least) a huge propagation delay (tPD~40ns) which brings the generated WR pulse out of sync relative to the shifted parallel data (16 bits) when using SPI at 36MHz.

The solution I have implemented is inserting additional delays to the MOSI and SCLK signals (after 4040 and before 4094). This I have implemented using pairs of the free inverter gates available in the on-board 74HC04 circuit (see here).

An alternative solution is to increase a bit the supply voltage (3.8V instead of 3.3V). This reduces by couple of nanoseconds the propagation delay of the 4040 counter.

Hope that I could help other users confronted with the same problem.