Here now the patch for using the LCD2004A with an TXS0108E on the RPi Pico:
diff --git a/src/lcd_hd44780.c b/src/lcd_hd44780.c
index 0afca915..bd142d58 100644
--- a/src/lcd_hd44780.c
+++ b/src/lcd_hd44780.c
@@ -45,7 +45,6 @@ static __always_inline void
hd44780_xmit_bits(uint8_t toggle, struct gpio_out e, struct gpio_out d4
, struct gpio_out d5, struct gpio_out d6, struct gpio_out d7)
{
- gpio_out_toggle(e);
if (toggle & 0x10)
gpio_out_toggle(d4);
if (toggle & 0x20)
@@ -54,8 +53,14 @@ hd44780_xmit_bits(uint8_t toggle, struct gpio_out e, struct gpio_out d4
gpio_out_toggle(d6);
if (toggle & 0x80)
gpio_out_toggle(d7);
- ndelay(230);
- gpio_out_toggle(e);
+
+ const uint32_t delay = 12000;
+
+ ndelay(delay);
+ gpio_out_write(e, 0);
+ ndelay(delay);
+ gpio_out_write(e, 1);
+ ndelay(delay);
}
// Transmit 8 bits to the chip
@@ -94,7 +99,7 @@ command_config_hd44780(uint32_t *args)
{
struct hd44780 *h = oid_alloc(args[0], command_config_hd44780, sizeof(*h));
h->rs = gpio_out_setup(args[1], 0);
- h->e = gpio_out_setup(args[2], 0);
+ h->e = gpio_out_setup(args[2], 1);
h->d4 = gpio_out_setup(args[3], 0);
h->d5 = gpio_out_setup(args[4], 0);
h->d6 = gpio_out_setup(args[5], 0);
@@ -126,6 +131,7 @@ command_hd44780_send_cmds(uint32_t *args)
gpio_out_write(h->rs, 0);
uint8_t len = args[1], *cmds = command_decode_ptr(args[2]);
hd44780_xmit(h, len, cmds);
+ ndelay(3000);
}
DECL_COMMAND(command_hd44780_send_cmds, "hd44780_send_cmds oid=%c cmds=%*s");
@@ -136,6 +142,7 @@ command_hd44780_send_data(uint32_t *args)
gpio_out_write(h->rs, 1);
uint8_t len = args[1], *data = command_decode_ptr(args[2]);
hd44780_xmit(h, len, data);
+ ndelay(3000);
}
DECL_COMMAND(command_hd44780_send_data, "hd44780_send_data oid=%c data=%*s");
For the next I’ll try to it completly on 3.3V and if it works, i’ll report back.