User avatar
meltwater
Posts: 1015
Joined: Tue Oct 18, 2011 11:38 am

Re: 2.8" TFT + Touch Shield Board

Fri Jul 12, 2013 7:26 am

texy wrote:Hi,
Notro's download as linked in the first post of this thread is based on the latest wheezy image and is only a few days old.
Or am I misunderstanding your question?
Texy
Just hoping to replace the kernel on my main card which has everything setup, networking etc. etc.

Does that mean I just need to copy over the kernel.img from the boot partition of Notro's image to my current one, and then I would be able to use the screen on that setup too (once all the other steps have been followed)?
______________
http://www.themagpi.com/
A Magazine for Raspberry Pi Users
Read Online or Download for Free.

My new book: goo.gl/dmVtsc

Meltwater's Pi Hardware - pihardware.com

Like the MagPi? @TheMagP1 @TheMagPiTeam

texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: 2.8" TFT + Touch Shield Board

Fri Jul 12, 2013 7:34 am

Hi,
TBH, it's not something I have played around with. I suspect it's not as simple as just the kernel, but it may just be the kernel, plus another folder or two ;)
Notro may be able to assist further, but if you wanted to experiment, make a back-up and give it a go. I think it would be useful to establish exactly which files fbtft needs to run for this display board (and it's touch panel).
Let us know how you get on......

Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: 2.8" TFT + Touch Shield Board

Fri Jul 12, 2013 7:35 am

PS - did you like my video - you may recognise the background ;)
http://www.youtube.com/watch?v=7CQt9nlTBEE


Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

notro
Posts: 696
Joined: Tue Oct 16, 2012 6:21 pm
Location: Drammen, Norway

Re: 2.8" TFT + Touch Shield Board

Fri Jul 12, 2013 9:01 am

meltwater wrote: Just hoping to replace the kernel on my main card which has everything setup, networking etc. etc.

Does that mean I just need to copy over the kernel.img from the boot partition of Notro's image to my current one, and then I would be able to use the screen on that setup too (once all the other steps have been followed)?
You need /boot/kernel.img and the folder /lib/modules/3.6.11+/ which contains the kernel modules matching the kernel.
Using info on this wikipage you should be able to extract the necessary files from the image: https://github.com/notro/fbtft/wiki/FBT ... ld-process

User avatar
meltwater
Posts: 1015
Joined: Tue Oct 18, 2011 11:38 am

Re: 2.8" TFT + Touch Shield Board

Fri Jul 12, 2013 7:09 pm

Many thanks Notro! Will try that out.

Texy...excellent choice of non-conductive surface there!
Hope to see an article at some stage in the future, plenty of great applications for a Raspberry Pi with a touch screen.

Can we hope for a 3d display one day...how amazing would that be! ;) Humm...in fact, how hard would it be to connect two screens (I take it they are SPI driven or similar)...drive them with two slightly offset images...

Oh, hope you don't mind, but I have a suggestion for Rev2 of the board, and that is a jumper/switch for the display's power. That way, if you want to switch the screen off you can and save power.
______________
http://www.themagpi.com/
A Magazine for Raspberry Pi Users
Read Online or Download for Free.

My new book: goo.gl/dmVtsc

Meltwater's Pi Hardware - pihardware.com

Like the MagPi? @TheMagP1 @TheMagPiTeam

texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: 2.8" TFT + Touch Shield Board

Sat Jul 13, 2013 12:20 pm

Hi meltwater,
the power is derived from the 3v3 rail from the Pi. I guess it would be easy enough to implement a switch. The display, once configured takes around 64mA,. At switch on it take approx 40mA.

Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: 2.8" TFT + Touch Shield Board

Sat Jul 13, 2013 12:22 pm

Here is a short python script that takes pictures in a loop using the Pi camera, and displays it on the TFT screen :

Code: Select all

#!/usr/bin/python
# camera v4.02
# for pi camera, and TFT set to 0 rotate
# takes picture,loads jpg and rotates onto TFT
# 
from subprocess import call
import pygame, sys, os, time, datetime
from pygame.locals import *
os.environ["SDL_FBDEV"] = "/dev/fb1"
time.sleep(0.5)
pygame.init()

DISPLAYSURF = pygame.display.set_mode((320, 240), 0, 32)

surf = pygame.Surface((240, 320)).convert()

# set up the colors
BLACK = (  0,   0,   0)
WHITE = (255, 255, 255)
RED   = (255,   0,   0)
GREEN = (  0, 255,   0)
BLUE  = (  0,   0, 255)

#pygame.mouse.set_visible(0)

# draw on the surface object
DISPLAYSURF.fill(WHITE)

pygame.display.flip()
while True:

    start_time = time.time()
    filename = datetime.datetime.fromtimestamp(start_time).strftime('%Y-%m-%d%H:%M:%S')+".jpg"
    argument="raspistill -o " + filename
    call ([argument], shell=True)
    print "argument = ",argument
    print "picture saved = ",filename
    print filename[-3:]
    time.sleep(0.25)
    if (filename[-3:] == "JPG") or (filename[-3:] == "jpg") : 
        surf = pygame.image.load(filename)
        print "image load :",time.time() - start_time
        next_time = time.time()
        picture = pygame.transform.scale(surf, (320, 240))
        DISPLAYSURF.blit(picture,(0,0))
        print "rotate and scale :",time.time() - next_time

    pygame.display.flip()
    end_time = time.time()
    print "time taken :",end_time - start_time

# run the game loop
    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            sys.exit()
    pygame.display.flip()

I have a different version that uses my Nikon D80 in conjunction with Gphoto.

Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

User avatar
bob_binz
Posts: 441
Joined: Thu Feb 02, 2012 7:58 pm
Location: Stockport, UK

Re: 2.8" TFT + Touch Shield Board

Sun Jul 14, 2013 4:05 pm

texy wrote:
bob_binz wrote:This looks great Texy.

Out of curiosity, who manufactures your PCBs?
Hi Bob,
Itead Studios -
http://imall.iteadstudio.com/open-pcb/p ... yping.html
Texy
Hi Texy, out of more curiosity, where do you get the wire-wrap IDC socket? Do they also sell PCB mount? I'm having a right struggle getting them - none on e-bay, tandyonline have sold out and RS and Farnell don't seem to stock them.

texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: 2.8" TFT + Touch Shield Board

Sun Jul 14, 2013 4:18 pm

Hi,
eBay can be a bit of a pain for searching - it's knowing what to search for is the thing - try 171037522421 (I bet you didn't think of that ;) )
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

User avatar
bob_binz
Posts: 441
Joined: Thu Feb 02, 2012 7:58 pm
Location: Stockport, UK

Re: 2.8" TFT + Touch Shield Board

Sun Jul 14, 2013 5:48 pm

texy wrote:Hi,
eBay can be a bit of a pain for searching - it's knowing what to search for is the thing - try 171037522421 (I bet you didn't think of that ;) )
Texy

Brilliant, thanks Texy

Gary Littlemore
Posts: 327
Joined: Thu Oct 11, 2012 11:52 am
Location: Cheshire, UK

Re: 2.8" TFT + Touch Shield Board

Mon Jul 15, 2013 12:32 pm

Are there any instructions to get this screen working with RaspBMC?
3b+, 2b, b+, b, Zero & Zero-W

texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: 2.8" TFT + Touch Shield Board

Mon Jul 15, 2013 12:44 pm

I think the question should be 'is it possible to get this display working with RaspBMC" ? ;)

And that would be a good question and worth investigating. I suspect the answer is no because RaspBMC uses the GPU to write to the screen.
For this display (with fbtft) the CPU is doing the work............
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

Aikidokajeff
Posts: 68
Joined: Fri May 25, 2012 3:31 pm

Re: 2.8" TFT + Touch Shield Board

Mon Jul 15, 2013 12:52 pm

I've got a few test programs working to give me the base to what I want but I was wondering if you knew a ways to "lock" the /dev/input/eventX to a single value. (maybe udev?)
When I've used different keyboards etc I have to change the os.environ option to point to the correct input or the program crashes.

Any thoughts?

texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: 2.8" TFT + Touch Shield Board

Mon Jul 15, 2013 1:14 pm

Well you can 'lock' it by not changing the hardware ;)
I considered it the other way - by looking at the devices loaded and finding which eventX related to the TP :

Code: Select all

from evdev import InputDevice, list_devices
devices = map(InputDevice, list_devices())
eventX=""
for dev in devices:
    if dev.name == "ADS7846 Touchscreen":
        eventX = dev.fn
print eventX
os.environ["SDL_MOUSEDEV"] = eventX

Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

Aikidokajeff
Posts: 68
Joined: Fri May 25, 2012 3:31 pm

Re: 2.8" TFT + Touch Shield Board

Mon Jul 15, 2013 1:21 pm

texy wrote:Well you can 'lock' it by not changing the hardware ;)
I considered it the other way - by looking at the devices loaded and finding which eventX related to the TP :

Code: Select all

from evdev import InputDevice, list_devices
devices = map(InputDevice, list_devices())
eventX=""
for dev in devices:
    if dev.name == "ADS7846 Touchscreen":
        eventX = dev.fn
print eventX
os.environ["SDL_MOUSEDEV"] = eventX


Texy
*Copies* *Pastes*
:-) That's great!
I'd love to not change the hardware but my end goal is to run without keyboard and mouse etc but allow for the option of using them for config/diagnostics.

Thanks,

Jeff

SimTIES
Posts: 2
Joined: Mon Jul 15, 2013 1:41 pm

Re: 2.8" TFT + Touch Shield Board

Mon Jul 15, 2013 1:49 pm

texy wrote: Hi Mart,
yes, little a little more than just installing drivers as fbtft uses a custom kernel, see instructions here :
https://github.com/notro/fbtft/wiki/Bui ... ft-drivers

As always, I would recommend making a backup before trying it.

Regards,
Texy
Hey texy,

I 've been trying to install the drivers for fbtft to make sure I can do it before I order your screen, but I've been having a problem.
I've followed the instructions to install the kernel sources and build the kernel and fbtft drivers, but when I try to modprobe fbtft_device I get an error saying: "FATAL: Module fbtft_device not found."

Am I missing something?

Thanks!!

texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: 2.8" TFT + Touch Shield Board

Mon Jul 15, 2013 2:11 pm

Hi,
firstly (sorry it's not clear), have you downloaded notro's image?
Directlink to the latest image is here :
http://tronnes.org/downloads/2013-05-25 ... -fbtft.zip

Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

SimTIES
Posts: 2
Joined: Mon Jul 15, 2013 1:41 pm

Re: 2.8" TFT + Touch Shield Board

Mon Jul 15, 2013 2:13 pm

texy wrote:Hi,
firstly (sorry it's not clear), have you downloaded notro's image?
Texy
Maybe that's what I'm missing. is that the page called "FBTFT image build process"?
I'm slightly confused since I don't know order the instructions should be followed in

texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: 2.8" TFT + Touch Shield Board

Mon Jul 15, 2013 2:23 pm

Follow the instructions in the first post of this thread in that order and you should be good to go - note you do NOT need to do any compiling.
Also note that you do not need a display physically connected in order to get /dev/fb1
Hope this helps,
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

anlumo
Posts: 7
Joined: Wed Jul 03, 2013 11:59 pm

Re: 2.8" TFT + Touch Shield Board

Mon Jul 15, 2013 8:21 pm

Soldered the board today, but it doesn't work :cry:

Image

I followed the instructions here, and when the hy28afb module is loaded, the screen goes black for maybe half a second, then goes back to white. ts_test does report the touches, but the display stays white.

I tried both loading the modules manually and changing /etc/modules and rebooting. It's the same for both.

Somebody got an idea?

texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: 2.8" TFT + Touch Shield Board

Mon Jul 15, 2013 9:31 pm

Hi,
we need to establish if its hardware or software. For software check that dmesg shows the following fr the display :

Code: Select all

d
[    9.788256] spi spi0.0: setup: want 500000 Hz; bus_hz=250000000 / cdiv=500 == 500000 Hz; mode 0: cs 0x00000000
[    9.788294] spi spi0.0: setup: cd 0: 500000 Hz, bpw 8, mode 0x0 -> CS=00000000 CDIV=01f4
[    9.788474] spi spi0.1: setup: want 500000 Hz; bus_hz=250000000 / cdiv=500 == 500000 Hz; mode 0: cs 0x00000001
[    9.788499] spi spi0.1: setup: cd 1: 500000 Hz, bpw 8, mode 0x0 -> CS=00000001 CDIV=01f4
[    9.788605] bcm2708_spi bcm2708_spi.0: SPI Controller at 0x20204000 (irq 80)
[    9.897343] bcm2708_i2c bcm2708_i2c.0: BSC0 Controller at 0x20205000 (irq 79) (baudrate 100k)
[    9.980929] bcm2708_i2c bcm2708_i2c.1: BSC1 Controller at 0x20804000 (irq 79) (baudrate 100k)
[   10.077683] Registered led device: led0
[   11.267632] usbcore: registered new interface driver rtl8192cu
[   17.008983] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[   17.468315] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[   18.363510] i2c /dev entries driver
[   18.499381] fbtft_device:  SPI devices registered:
[   18.505590] fbtft_device:      spidev spi0.0 500kHz 8 bits mode=0x00
[   18.513301] fbtft_device:      spidev spi0.1 500kHz 8 bits mode=0x00
[   18.520896] fbtft_device:  'fb' Platform devices registered:
[   18.527734] fbtft_device:      bcm2708_fb id=-1 pdata? no
[   18.534326] fbtft_device: Deleting spi0.0
[   18.542062] spi spi0.0: setup: want 48000000 Hz; bus_hz=250000000 / cdiv=6 == 41666666 Hz; mode 3: cs 0x0000000C
[   18.542099] spi spi0.0: setup: cd 0: 48000000 Hz, bpw 8, mode 0x3 -> CS=0000000c CDIV=0006
[   18.542231] fbtft_device:  GPIOS used by 'hy28afb':
[   18.558202] fbtft_device:    'reset' = GPIO25
[   18.563763] fbtft_device:    'led' = GPIO18
[   18.576408] fbtft_device:  SPI devices registered:
[   18.582511] fbtft_device:      spidev spi0.1 500kHz 8 bits mode=0x00
[   18.598222] fbtft_device:      hy28afb spi0.0 48000kHz 8 bits mode=0x03
[   18.823596] hy28afb spi0.0: setup: want 2000000 Hz; bus_hz=250000000 / cdiv=125 == 2000000 Hz; mode 3: cs 0x0000000C
[   19.498523] graphics fb1: hy28afb frame buffer, 320x240, 150 KiB video memory, 4 KiB buffer memory, fps=33, spi0.0 at 48 MHz
[   19.770396]
[   19.770396]
Hardware :
You've used the 2 supplied pads to protect against shorts?
You've triple checked your soldering?

Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

anlumo
Posts: 7
Joined: Wed Jul 03, 2013 11:59 pm

Re: 2.8" TFT + Touch Shield Board

Mon Jul 15, 2013 9:52 pm

texy wrote:Hi,

Code: Select all

...
[   18.823596] hy28afb spi0.0: setup: want 2000000 Hz; bus_hz=250000000 / cdiv=125 == 2000000 Hz; mode 3: cs 0x0000000C
[   19.498523] graphics fb1: hy28afb frame buffer, 320x240, 150 KiB video memory, 4 KiB buffer memory, fps=33, spi0.0 at 48 MHz
[   19.770396]
[   19.770396]
I've got an additional

Code: Select all

[   39.136921] hy28afb spi0.0: Elapsed time for display update:   54.384006 ms (fps: 18, lines=240)
right before the last line. Otherwise it's identical, when I use the updated options for the 22fps mode.
Hardware :
You've used the 2 supplied pads to protect against shorts?
yes
You've triple checked your soldering?
I've checked that the GPIO female plug is connected to the GPIO-breakout on all pins. Checking the display itself is harder, since I don't know which pin is supposed to be connected to which pin. Visually it looks ok.

texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: 2.8" TFT + Touch Shield Board

Mon Jul 15, 2013 10:09 pm

Try removing the fps and speed options.
The extra line you have is because I haven't got debug enabled.
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

anlumo
Posts: 7
Joined: Wed Jul 03, 2013 11:59 pm

Re: 2.8" TFT + Touch Shield Board

Mon Jul 15, 2013 10:26 pm

texy wrote:Try removing the fps and speed options.
No change.

User avatar
bob_binz
Posts: 441
Joined: Thu Feb 02, 2012 7:58 pm
Location: Stockport, UK

Re: 2.8" TFT + Touch Shield Board

Tue Jul 16, 2013 6:32 am

can you post your entire dmesg?

also, you definitely haven't got anything else running thats using the gpio at the same time?

Return to “HATs and other add-ons”