From nobody Fri Oct 22 11:38:54 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 746A418118E1 for ; Fri, 22 Oct 2021 11:39:06 +0000 (UTC) (envelope-from freebsd-rj@obsigna.com) Received: from mo4-p00-ob.smtp.rzone.de (mo4-p00-ob.smtp.rzone.de [85.215.255.24]) (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-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "*.smtp.rzone.de", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbMnP1CFZz3nhB for ; Fri, 22 Oct 2021 11:39:05 +0000 (UTC) (envelope-from freebsd-rj@obsigna.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1634902738; s=strato-dkim-0002; d=obsigna.com; h=Message-Id:In-Reply-To:To:References:Date:Subject:From:Cc:Date:From: Subject:Sender; bh=+Ru5EgjqFDtCO/OrHmnSc6Tw8m+454+yCp3ZAsWySck=; b=gtJ90jqF/OYK5RKsyPuQhUNYlyoM/FN0bNJvkxnKXJYsi2z8MCwn67sBb13HFH9eia nQ1zCDWTrscR9SPejLysgb1oG1BM0BYqUCiO/YPYIZ7rPuQUEoQCcAiQ2IwcQHS8npXx gzPWhFvQQSWSwdFpRMhAMfKgtEUUkM9xgmKKsMpUdSGOJXHlpml6iARkObsrQ6uXIx/5 iREK9ovatSubLung7B8sso5NBjFUeX8zWU4dcd+6PuQLkXv227n/iXJFOiSmETZ3OxLG cEKzHB/yE42tToIAEKNFwiTXuPAr5uAbEdjRHPul4mUhpzlYj0oRUn6JpUL2KiXLpXqA i0hg== X-RZG-AUTH: ":O2kGeEG7b/pS1F2rRHW2isrKl4DV03XBEi+I6ZuztdvN9wS3wFGySS4Lw+ldTBio0dVbInGjc9L2phQKBg==" X-RZG-CLASS-ID: mo00 Received: from mail.obsigna.com by smtp.strato.de (RZmta 47.34.1 DYNA|AUTH) with ESMTPSA id i029c0x9MBcwgNS (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate) for ; Fri, 22 Oct 2021 13:38:58 +0200 (CEST) Received: from rolf-aux.obsigna.com (rolf-aux.obsigna.com [192.168.222.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.obsigna.com (Postfix) with ESMTPSA id 675221350F91D for ; Fri, 22 Oct 2021 08:38:55 -0300 (-03) From: "Dr. Rolf Jansen" Content-Type: multipart/alternative; boundary="Apple-Mail=_E0FE9533-D6FE-4CCA-A1C8-D86EA3735A40" 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 (Mac OS X Mail 11.5 \(3445.9.7\)) Subject: Re: Using 20x4 LCD display Date: Fri, 22 Oct 2021 08:38:54 -0300 References: To: freebsd-arm@freebsd.org In-Reply-To: Message-Id: <031FB1DF-6B2A-4122-AC5B-34E921995284@obsigna.com> X-Mailer: Apple Mail (2.3445.9.7) X-Rspamd-Queue-Id: 4HbMnP1CFZz3nhB X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=pass header.d=obsigna.com header.s=strato-dkim-0002 header.b=gtJ90jqF; dmarc=none; spf=pass (mx1.freebsd.org: domain of freebsd-rj@obsigna.com designates 85.215.255.24 as permitted sender) smtp.mailfrom=freebsd-rj@obsigna.com X-Spamd-Result: default: False [-1.00 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ip4:85.215.255.0/24]; TO_DN_NONE(0.00)[]; URI_COUNT_ODD(1.00)[3]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[obsigna.com:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:6724, ipnet:85.215.255.0/24, country:DE]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[obsigna.com:s=strato-dkim-0002]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-arm@freebsd.org]; DMARC_NA(0.00)[obsigna.com]; RCPT_COUNT_ONE(0.00)[1]; RCVD_IN_DNSWL_NONE(0.00)[85.215.255.24:from]; FROM_NAME_HAS_TITLE(1.00)[dr]; RWL_MAILSPIKE_POSSIBLE(0.00)[85.215.255.24:from]; RCVD_TLS_ALL(0.00)[] X-Spam: Yes X-ThisMailContainsUnwantedMimeParts: Y --Apple-Mail=_E0FE9533-D6FE-4CCA-A1C8-D86EA3735A40 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > Am 22.10.2021 um 03:52 schrieb Olivier : >=20 > I would like to use a 20x4 LCD display attached to a Raspberry Pi > running FreeBSd 12.2. >=20 > 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. I use a 20x4 LCD (HD44780 type) over I2C (via PCF8574T) on a BeagleBone = Black. For this, I manually transcribed one of the many Python libraries = into plain C, and I wrote a minimalistic I2C glue interface in C, so it = can be easily addressed. I just put a .zip file for downloading it on my web site: https://obsigna.com/Downloads/LCD_20x4_over_I2C.zip I added a Hello World test program (s. below). Perhaps you need to = change the I2C device number and the I2C address in lcd.c. Here I have: uint8_t lcd_iicid =3D 1; uint8_t lcd_addr =3D 0x27; The Python code contained a lot of delays between various calls. This = was not necessary for the BeagleBone Black, I removed this and it let me = optimize the subroutines for transferring data to the display. I don=E2=80= =99t know whether this would work on a Raspberry Pi, though. Compile it with: cc i2c.c lcd.c hello.c -o hello Run it with: ./hello #include #include #include #include #include "i2c.h" #include "lcd.h" int main(int argc, const char *argv[]) { lcd_begin(); lcd_print("Hello, World!", 13); lcd_setCursor(0, 1); lcd_print("HD44780 over PCF8574", 20); lcd_setCursor(0, 2); lcd_print("If it does not work,", 20); lcd_setCursor(0, 3); lcd_print("do not ask me why.", 18); return 0; } Best regards Rolf Dr. Rolf Jansen - - Rua Reginaldo de Lima, 98 Parque S=C3=A3o Diogo 09732-550, S=C3=A3o Bernardo do Campo S=C3=A3o Paulo - Brazil Phone: 0055-11/4317-0974 Mobile: 0055-11/9 8141-1465 E-Mail: rj@obsigna.com BLog: obsigna.com --Apple-Mail=_E0FE9533-D6FE-4CCA-A1C8-D86EA3735A40--