drivers icon indicating copy to clipboard operation
drivers copied to clipboard

HD44780 WriteOnly mode not working (with SPLC780D)

Open neildavis opened this issue 3 years ago • 2 comments
trafficstars

Has anybody successfuly used the hd44780 driver in 'write only' mode? i.e. permanently holding the RW pin at GND and passing machine.NoPin as rw when creating the Device

I wanted to use it this way since the LCD board I'm using requires 5V, but I'm interfacing with a 3.3V MCU (Pi Pico) so want to avoid reading from the device at 5V.

I know I could use a bi-directional level shifter in the circuit, or a hardware hack, but since the driver supported this mode and timing is not important to me I thought I'd try to use it.

I've tried in 8-bit and 4-bit modes but no luck. Just get the boxes instead of text. The datasheet for the LCD module says it uses a SPLC780D rather than a HD44780 but from those datasheets I don't see a huge amount of difference in the timings.

I've tried changing ClearHomeTime & InstrExecTime in Config but found no values that work.

I've also tried rebuilding the driver with various timing changes during the Configure function for the initialization sequence to be more tolerant to the various devices as summarized here but still no luck.

If I connect RW to another GPIO pin - to allow the driver to read the 'busy flag' from the LCD module - then it works flawlessly in both 8-bit and 4-bit mode, so I've ruled out hardware failure.

Any ideas greatfully recieved. Thanks.

Here's my program (8-bit mode variant)

package main

import (
	"machine"
	"time"

	"tinygo.org/x/drivers/hd44780"
)

var (
	pinLCDEN   = machine.GP16
	pinLCDRS   = machine.GP17
	pinLCDData = [8]machine.Pin{machine.GP18, machine.GP19, machine.GP20, machine.GP21,
		machine.GP22, machine.GP26, machine.GP27, machine.GP28}
	pinLCDRW = machine.NoPin // Write only mode to avoid reading at 5V
	lcd      hd44780.Device
)

const (
	lcdCols          = 16
	lcdRows          = 2
	lcdClearHomeTime = time.Millisecond * 150
	lcdInstrExecTime = time.Microsecond * 150
)

func setupPins() {
	lcd, _ = hd44780.NewGPIO8Bit(pinLCDData[:], pinLCDEN, pinLCDRS, pinLCDRW)
	lcd.Configure(hd44780.Config{Width: lcdCols, Height: lcdRows,
		ClearHomeTime: lcdClearHomeTime, InstrExecTime: lcdInstrExecTime})
}

func main() {
	setupPins()
	lcd.SetCursor(0, 0)
	lcd.Write([]byte("Hello"))
	lcd.Display()
	lcd.SetCursor(0, 1)
	lcd.Write([]byte("World"))
	lcd.Display()
	for {
	}
}

neildavis avatar Feb 19 '22 14:02 neildavis

Was this addressed by https://github.com/tinygo-org/drivers/pull/361 ?

deadprogram avatar Apr 21 '22 13:04 deadprogram

Was this addressed by #361 ?

No, I only started using this repo at v0.19.0 which is downstream of that commit (905fc6f). All the changes I tried from the descritpion were built against dev at the time.

neildavis avatar Apr 25 '22 12:04 neildavis