View: 46426|Reply: 49

fb-tft OK

[Copy link]

12

threads

30

posts

150

credits

Registered member

Rank: 2

credits
150
Published in 2015-12-25 15:53:57 | Show all floors |Read mode
I managed to get the my ili9325 display and my oled ssd1306 working (gpio interface)
The framebuffer device shows up as /dev/fb8  
I only used Port A pins. Should be possible to use other pins as well. (letter alfabeth-1)*32 + port
In script.bin file I defined twowire and SPI port (drivers are compiled into the kernel)
The pinnumbering of the GPIO is not the one described in script.bin but simply PA2=2, PA22=22 as described in the orange pi manual.

I used the loboris kernel
goto drivers/video/fbtft
git clone https://github.com/notro/fbtft.git

(rollback to version that is compatible with 3.4 kernel (instead of 3.5)

git checkout 6da654310724c31622afa8c7d12211a6e33ec18d .

apply change to Kconfig as described by notro


for 8 bit parallel ili9325 display :

modprobe fbtft_device name=itdb28 gpios=reset:20,dc:1,wr:3,cs:10,db00:0,db01:14,db02:2,db03:21,db04:18,db05:19,db06:8,db07:9

[  172.270551] fbtft_device:  SPI devices registered:
[  172.270573] fbtft_device:      ads7846 spi0.0 1500kHz 8 bits mode=0x00
[  172.270585] fbtft_device:  'fb' Platform devices registered:
[  172.270804] fbtft_device:  GPIOS used by 'itdb28':
[  172.270816] fbtft_device:    'reset' = GPIO20
[  172.270825] fbtft_device:    'dc' = GPIO1
[  172.270833] fbtft_device:    'wr' = GPIO3
[  172.270841] fbtft_device:    'cs' = GPIO10
[  172.270849] fbtft_device:    'db00' = GPIO0
[  172.270857] fbtft_device:    'db01' = GPIO14
[  172.270866] fbtft_device:    'db02' = GPIO2
[  172.270874] fbtft_device:    'db03' = GPIO21
[  172.270883] fbtft_device:    'db04' = GPIO18
[  172.270891] fbtft_device:    'db05' = GPIO19
[  172.270899] fbtft_device:    'db06' = GPIO8
[  172.270908] fbtft_device:    'db07' = GPIO9
[  172.270916] fbtft_device:  'fb' Platform devices registered:
[  172.270958] fbtft_device:      fb_ili9325 id=0 pdata? yes
[  172.916915] graphics fb8: fb_ili9325 frame buffer, 240x320, 150 KiB video memory, 4 KiB DMA buffer memory, fps=20



for cheap 4 wire SPI OLED SSD1306

modprobe fbtft_device name=adafruit13m debug=1 gpios=reset:7,dc:6


[ 1207.084979] fbtft_device:  GPIOS used by 'adafruit13m':
[ 1207.085009] fbtft_device:    'reset' = GPIO7
[ 1207.085027] fbtft_device:    'dc' = GPIO6
[ 1207.085048] fbtft_device:  SPI devices registered:
[ 1207.085077] fbtft_device:      fb_ssd1306 spi0.0 16000kHz 8 bits mode=0x00
[ 1207.093444] fb_ssd1306 spi0.0: fbtft_request_gpios: 'reset' = GPIO7
[ 1207.093491] fb_ssd1306 spi0.0: fbtft_request_gpios: 'dc' = GPIO6
[ 1207.216107] graphics fb8: fb_ssd1306 frame buffer, 128x64, 16 KiB video memory, 4 KiB DMA buffer memory, fps=20, spi0.0 at 16 MHz

10

threads

218

posts

2040

credits

Gold member

Rank: 6Rank: 6

credits
2040
Published in 2017-7-20 08:28:08 | Show all floors
Edited by nopnop2002 at 2017-7-20 11:52
bumtras replied at 2017-7-19 17:58
Hello, everyone!
I am trying to connect ili9481 tft display to OPI zero running the latest stable ve ...

1.busnum & speed is unnecessary.
This can use only at SPI-TFT.
busnum
SPI bus number (default=0)
speed
SPI speed in Hz (default varies among displays)

2.Please confirm the connection.
dc:3,  Pin#15
reset:0, Pin#13
led:12,  Pin#3
wr:7,  Pin#12
cs:13,  Pin#24
db00:6,  Pin#7
db01:198, Pin#8
db02:199, Pin#10
db03:1,  Pin#11
db04:19, Pin#16
db05:18, Pin#18
db06:2,  Pin#22
db07:10  Pin#26

3.Try this parameter.

init=-1,0x28,-2,20,-1,0x36,0x58,-1,0x3A,0x55,-1,0x11,-2,120,-1,0x29,-2,20,-3

or

init=-1,0x28,-2,20,1,0x36,0x08,-1,0x3A,0x55,-1,0x21,-1,0x11,-2,120,-1,0x29,-2,20,-3


4.Remove /etc/modprobe.d/fbtft.conf & Reboot system & Execute by a command line & check device
sudo rm /etc/modprobe.d/fbtft.conf
sudo shutdown -r now

sudo modprobe fbtft_device name=flexpfb gpios=....
sudo modprobe flexfb width=480 height=320 buswidth=8 init=.....
ls /dev/fb*

If you try another parameter, you need to reboot system.

12

threads

30

posts

150

credits

Registered member

Rank: 2

credits
150
 Author| Published in 2015-12-28 18:04:14 | Show all floors
I have the cheapest board, which contains the Allwinner H3 SOC.

I can upload the binary modules, but I used my own version number ...
I'll try to recompile it with the standard kernel.
You'll have to wait though

Maybe you could convince "loboris" to include these modules in his distribution?

0

threads

10

posts

88

credits

Registered member

Rank: 2

credits
88
Published in 2015-12-28 06:14:51 | Show all floors
Hi !
on witch board ?
it is possible to upload binary module, please ?
thx

0

threads

10

posts

88

credits

Registered member

Rank: 2

credits
88
Published in 2015-12-28 18:48:17 | Show all floors
i would be very thankful for the binary modules for standard kernel from you, because the loboris is not very aktiv.

8

threads

55

posts

252

credits

Intermediate member

Rank: 3Rank: 3

credits
252
Published in 2015-12-29 05:14:38 | Show all floors
Edited by @lex at 2015-12-28 19:01

Hi,
Thank you for sharing.

I am new to SPI thing and would like to interface with the ssd1306. (still waiting for my display to arrive)
I think i compiled the drivers:
drivers/video/fbtft/fb_ssd1306.ko
drivers/video/fbtft/fbtft.ko

Could you please, share you FEX (section related to SPI) and how you wired the ssd1306 (could be a picture, photo)?

Binary attached:
- decompress it to a tmp directory and copy the correct files to
/lib/modules/3.4.39/kernel/drivers/video/fbtft/fb_ssd1306.ko
/lib/modules/3.4.39/kernel/drivers/video/fbtft/fbtft.ko

- and the remaining files to
/lib/modules/3.4.39/kernel/drivers/video/

- issue a depmod or depmod -a

- Kernel version must match: 3.4.39





This thread contains more resources

You need to Log in to download or view,No account?    Register

x

12

threads

30

posts

150

credits

Registered member

Rank: 2

credits
150
 Author| Published in 2015-12-29 16:52:12 | Show all floors
for the spi (mosi miso and sclk wiring check this out :

https://learn.adafruit.com/adafr ... erry-pi/wiring-up-1

[ 1207.085009] fbtft_device:    'reset' = GPIO7
[ 1207.085027] fbtft_device:    'dc' = GPIO6

Which are ports PA_07 and PA_06 (see manual orangepi PC)

how it is defined in script.bin

[spi0]
spi_used = 1
spi_cs_bitmap = 1
spi_mosi = portC00<3><default><default><default>
spi_miso = portC01<3><default><default><default>
spi_sclk = portC02<3><default><default><default>
spi_cs0 = portC03<3><1><default><default>


for the exact location of PC_00...PC_03 see manual opipc



This is something I modified because I'm also trying to get touchscreen up-and-running
(did not affect OLED spi settings)

[spi_devices]
spi_dev_num = 1

[spi_board0]
modalias = "ads7846"
max_speed_hz = 1500000
bus_num = 0
chip_select = 0
mode = 0
full_duplex = 1
manual_cs = 0


Attention : it could be necessary to type ALT-F1 (to switch to framebuffer, and spacebar to return)

fbi -d /dev/fb8 -T 2 -noverbose -a Mystery-100x100.jpg

0

threads

2

posts

100

credits

Registered member

Rank: 2

credits
100
Published in 2015-12-30 17:39:33 | Show all floors
Edited by andruzzzhka at 2015-12-30 17:59

Hi!
Can you write a step by step guide, how to compile it, please?
I compiled it without errors, but when i try load it:
modprobe: ERROR: could not insert 'fbtft_device': Exec format error

0

threads

10

posts

88

credits

Registered member

Rank: 2

credits
88
Published in 2016-1-2 17:46:36 | Show all floors
andruzzzhka replied at 2015-12-30 17:39
Hi!
Can you write a step by step guide, how to compile it, please?
I compiled it without errors, but ...

compiled on orange pi, or on pc (x86) with cross compiler ?

0

threads

2

posts

100

credits

Registered member

Rank: 2

credits
100
Published in 2016-1-7 22:31:56 | Show all floors
beee replied at 2016-1-2 17:46
compiled on orange pi, or on pc (x86) with cross compiler ?

When I compiled fbtft with the kernel on the PC with the cross compiler it worked out! Thanks!

0

threads

10

posts

88

credits

Registered member

Rank: 2

credits
88
Published in 2016-1-11 16:55:27 | Show all floors
Compiled fbtft for Oprange Pi PC:
goo.gl/rokH6M
Archive contains the kernel modules (for all LCD) and compiled several useful programs for fbdev.
Tested on cheap Arduino LCD from banggood (SKU 940735). Spfd5408 chip is almost ILI9341. The connection is the same as by snowbody
CS (LOW) -> 35
DC (CD, RS) -> 11
WR -> 15
RD (HIGH) -> 1
RESET -> 37
D0 -> 13
D1 -> 10
D2 -> 22
D3 -> 26
D4 -> 28
D5 -> 27
D6 -> 31
D7 -> 33
as root:
rmmod gpio_sunxi (if necessary)
modprobe fbtft_device custom name=flexpfb gpios=reset:20,dc:1,wr:3,cs:10,db00:0,db01:14,db02:2,db03:21,db04:18,db05:19,db06:8,db07:9
modprobe flexfb width=320 height=240 buswidth=8 init=\
-1,0x01,-2,5,-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,0x38,-1,0x11,-2,120,-1,0x29,-2,20,-3
or etc modules, respectively modprobe.d blacklist
You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list