Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Oct 2021 10:39:27 +0700
From:      Olivier <Olivier.Nicole@cs.ait.ac.th>
To:        Andriy Gapon <avg@FreeBSD.org>
Cc:        freebsd-arm@freebsd.org
Subject:   Re: Using 20x4 LCD display
Message-ID:  <wu735opkc28.fsf@banyan.cs.ait.ac.th>
In-Reply-To: <2c56fffe-327b-dd56-fa08-bc013a8881cd@FreeBSD.org> (message from Andriy Gapon on Fri, 22 Oct 2021 11:25:32 %2B0300)

next in thread | previous in thread | raw e-mail | index | archive | help
Andriy Gapon <avg@FreeBSD.org> 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

-- 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?wu735opkc28.fsf>