From owner-freebsd-arch@FreeBSD.ORG Mon Apr 27 12:13:12 2015 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 68FBABE7; Mon, 27 Apr 2015 12:13:12 +0000 (UTC) Received: from mailhost.netlabit.sk (mailhost.netlabit.sk [84.245.65.72]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DAEA61B9C; Mon, 27 Apr 2015 12:13:10 +0000 (UTC) Received: from zeta.dino.sk (fw1.dino.sk [84.245.95.252]) (AUTH: LOGIN milan) by mailhost.netlabit.sk with ESMTPA; Mon, 27 Apr 2015 14:13:07 +0200 id 00347808.553E27D3.000068E2 Date: Mon, 27 Apr 2015 14:13:07 +0200 From: Milan Obuch To: Adrian Chadd Cc: freebsd-arch@freebsd.org Subject: Re: using libgpio to bitbang LCDs! Message-ID: <20150427141307.46630f07@zeta.dino.sk> In-Reply-To: <20150427124841.7b8a59bc@zeta.dino.sk> References: <20150427124841.7b8a59bc@zeta.dino.sk> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.27; i386-portbld-freebsd10.1) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2015 12:13:12 -0000 On Mon, 27 Apr 2015 12:48:41 +0200 Milan Obuch wrote: > On Sat, 11 Apr 2015 23:45:55 -0700 > Adrian Chadd wrote: > > > Hi, > > > > The library source code and a demo program is available here: > > > > https://github.com/erikarn/freebsd-liblcd > > > > It includes the wiring needed to hook the example OLED board up > > (http://www.adafruit.com/products/684) to a Carambola 2 evaluation > > board. > > > > Anything you can get 5v and 5 GPIO pins from will work. (Well, as > > long as there's also libgpio / gpio API support for your device..) > > > > > > > > -adrian > > > > Hi, > > I downloaded master.zip from github and now I am trying to modify it > for my hardware - Raspberry PI and TFT display with ILI9341 chip > https://learn.adafruit.com/adafruit-pitft-28-inch-resistive-touchscreen-display-raspberry-pi > My original attempt to use SPI failed probably because ILI9341 does > not use pure SPI, but there is one extension - DC pin. I did not > manage to satisfy chip's timing/bit sequence/whatever, so I would > like to try bit banging. > > I found two small issues with archive downloaded - > freebsd-liblcd-master/src/beastie_ili9340c_320x240/Makefile seems to > ba a copy of > freebsd-liblcd-master/src/beastie_ssd1351_128x128/Makefile, I think > there should be a difference, after my fix > > --- beastie_ili9340c_320x240/Makefile 2015-04-23 21:40:10.693847000 > +0200 +++ beastie_ssd1351_128x128/Makefile 2015-04-13 > 00:58:06.000000000 +0200 @@ -3,7 +3,7 @@ > > .include > > -PROG=beastie_ili9340c_320x240 > +PROG=beastie_ssd1351_128x128 > SRCS=main.c > CFLAGS+=-I../../lib/liblcd > LDFLAGS+=-L../../lib/liblcd > > > The second issue is when doing 'make install' binaries produced are > being installed into / directory. While both are not fatal for me, > they are annoyances at least. > > I found following in source files: > > /* Configured for the carambola 2 board */ > cfg.gpio_unit = 0; > cfg.pin_cs = 19; > cfg.pin_rst = 20; > cfg.pin_dc = 21; > cfg.pin_sck = 22; > cfg.pin_mosi = 23; > > I see there no 'pin_miso', so does this mean only one directional > communication is being used, no status reading, or both reading and > writing are being carried over one pin? If the former, then all I > should to do is change pin numbers in above given excerption to ones > valid for Raspberry Pi, if the later, I can't use this without more > modifications. > > Also, I have simple monochrome display with PCD8544 chip, which should > use basically the same bus design, so it could be used for this too, > with some modification. > > Regards, > Milan > I decided just to try it. I copied freebsd-liblcd-master/src/beastie_ili9340c_320x240 to freebsd-liblcd-master/src/beastie_ili9340c_320x240-1, just to keep things clean (and be able to revert easy if I screw something too much) and changed configuration lines mentioned above to /* Configured for the Raspberry Pi board */ cfg.gpio_unit = 0; cfg.pin_cs = 8; cfg.pin_rst = 0; cfg.pin_dc = 25; cfg.pin_sck = 11; cfg.pin_mosi = 10; and it works, a bit slowly, but this could be expected. Also note there is no reset pin connected in my display, so I put there 0, which may not be the best value, but it works. One more issue here - picture is turned upside down, I have four buttons below screen and I need to turn the display to be normally readable so they are on top... but this is not hard to solve... I can use this display now, it is slow, but works. Regards, Milan