From nobody Mon Oct 25 03:39:27 2021 X-Original-To: freebsd-arm@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7AB7C181FEC3 for ; Mon, 25 Oct 2021 03:39:54 +0000 (UTC) (envelope-from Olivier.Nicole@cs.ait.ac.th) Received: from mail.cs.ait.ac.th (mail.cs.ait.ac.th [192.41.170.16]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hd1140N3zz3sHg; Mon, 25 Oct 2021 03:39:51 +0000 (UTC) (envelope-from Olivier.Nicole@cs.ait.ac.th) Received: from mail.cs.ait.ac.th (localhost [127.0.0.1]) by mail.cs.ait.ac.th (Postfix) with ESMTP id E1BF7112502; Mon, 25 Oct 2021 10:39:41 +0700 (+07) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cs.ait.ac.th; h= content-type:content-type:mime-version:message-id:date:date :in-reply-to:subject:subject:from:from:received:received :received; s=selector1; t=1635133181; x=1636947582; bh=G3xoh5wqn MPapqAnEXrMP2nl1BeJ+j0MQmn9QanEbJQ=; b=L5GUrDBD818IkSg1nUqtEoeZM C8hB+9mMkeYYrarPaBA4OzGB4Gt+0o8D05eQ+3uDIKtuJOXIzN8zRVA8eBLWHBbY BJ+lWW++ebDdicU9634qO7JjWbQuRx95f4xz4zhCTSxjzT/YSX/hhXnECw7fPi3L XQX0WLmPaeD0N8viNY= X-Virus-Scanned: amavisd-new at cs.ait.ac.th Received: from mail.cs.ait.ac.th ([127.0.0.1]) by mail.cs.ait.ac.th (mail.cs.ait.ac.th [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id bDe0qgXdvhEm; Mon, 25 Oct 2021 10:39:41 +0700 (+07) Received: from banyan.cs.ait.ac.th (banyan.cs.ait.ac.th [192.41.170.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.cs.ait.ac.th (Postfix) with ESMTPS id F31E2112501; Mon, 25 Oct 2021 10:39:40 +0700 (+07) Received: (from on@localhost) by banyan.cs.ait.ac.th (8.15.2/8.15.2/Submit) id 19P3dRwg063048; Mon, 25 Oct 2021 10:39:27 +0700 (ICT) (envelope-from on@banyan.cs.ait.ac.th) From: Olivier To: Andriy Gapon Cc: freebsd-arm@freebsd.org Subject: Re: Using 20x4 LCD display In-Reply-To: <2c56fffe-327b-dd56-fa08-bc013a8881cd@FreeBSD.org> (message from Andriy Gapon on Fri, 22 Oct 2021 11:25:32 +0300) Date: Mon, 25 Oct 2021 10:39:27 +0700 Message-ID: List-Id: Porting FreeBSD to ARM processors List-Archive: https://lists.freebsd.org/archives/freebsd-arm List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arm@freebsd.org MIME-Version: 1.0 Content-Type: text/plain X-Rspamd-Queue-Id: 4Hd1140N3zz3sHg X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=cs.ait.ac.th header.s=selector1 header.b=L5GUrDBD; dmarc=pass (policy=none) header.from=cs.ait.ac.th; spf=pass (mx1.freebsd.org: domain of Olivier.Nicole@cs.ait.ac.th designates 192.41.170.16 as permitted sender) smtp.mailfrom=Olivier.Nicole@cs.ait.ac.th X-Spamd-Result: default: False [-2.70 / 15.00]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[cs.ait.ac.th:s=selector1]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.10)[text/plain]; RCVD_DKIM_ARC_DNSWL_MED(-0.50)[]; NEURAL_SPAM_MEDIUM(1.00)[1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[4]; MID_RHS_MATCH_FROMTLD(0.00)[]; RCVD_IN_DNSWL_MED(-0.20)[192.41.170.16:from]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[cs.ait.ac.th,none]; DKIM_TRACE(0.00)[cs.ait.ac.th:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:4767, ipnet:192.41.170.0/24, country:TH] X-ThisMailContainsUnwantedMimeParts: N Andriy Gapon writes: > On 22/10/2021 09:52, Olivier wrote: >> Hello, >> >> I would like to use a 20x4 LCD display attached to a Raspberry Pi >> running FreeBSd 12.2. >> >> I can talk to the display through the I2C interface, when I send >> something the back light will turn off and on, so the link is >> established. >> >> What I cannot find is the sequence of codes to send in order to write a >> character on te screen, to move the cursor around, etc. >> >> All documentation I could find so far relate to Raspbian or Arduino and >> are always using high level libraries (I could not find such on FreeBSD, >> equivalent to WiringPi). >> >> Whatever random characters I send to the screen, it persistently shows >> alternating empty lines and lines or black boxes. >> >> Any help pointing me in the right direction will be greatly appreciated. > > I have a small utility for talking to a character LCD display via gpio. > I am not sure about your exact hardware, but typically the I2C interface is just > a GPIO-over-I2C (aka an I2C I/O expander). > > The utility is here: https://github.com/avg-I/gpiolcd > It's based on ppilcd utility written for driving such LCDs connected to a > parallel port. That utility can be found at share/examples/ppi/ppilcd.c. It > uses parallel port ioctl-s for the job. > > To use my utility you need the LCD to be presented as a gpio device. > For that you need a driver for a specific I2C to I/O port expander that you > have. In my case it's PCF8574. > > You can search the internet for information about how HD44780 (and similar) works. > > https://www.exploreembedded.com/wiki/LCD_16_x_2_Basics > http://web.alfredstate.edu/faculty/weimandn/lcd/lcd_addressing/lcd_addressing_index.html > https://www.ti.com/product/PCF8574 > > P.S. > In case you also have PCF8574 or compatible, I have a driver for it but I > haven't committed it yet. You can find it here: > https://github.com/avg-I/freebsd/commit/fb31fe9a933d62c7af96b0ab830b98cbfeed5309 Thank you for all the pointers you offered. Olivier --