Re: Using 20x4 LCD display

Olivier <[email protected]>
Newsgroups gmane.os.freebsd.devel.arm
Message-ID <[email protected]>
Andriy Gapon <[email protected]> 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

--
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.