Hi,
Re: 2004 LCD and variants
The HD44780 requires a 470ns delay between the first three bytes and 50us after the next three bytes making up a data command or character insertion. Using an I2C piggyback this makes transferring multiple writes without CPU intervention by DMA impossible on most CPU’s.
Can I confirm the Sparkfun models, with the onboard CPU, are acting as a buffer, that is receiving I2C by interrupt into a buffer and doing the insertion’s as part of a loop routine? The arduino sample code does not show any delay() commands which suggests this is the case.
The intention is to send commands and data writes for about half the screen at 0.5Hz using DMA only.
After some time with the display I have determined it’s not really suitable for purpose due to poor firmware choices. I also have a partially broken screen but that’s something else.
-
The maximum characters in one shot is around the 26 mark and then the display crashes. Probably the circular buffer isn’t long enough. I work around this by DMA’ing blocks of 20 in 4 sends with a timer, which works.
-
The choices to enter command mode are painfully stupid. Instead of using non printable ASCII for these it’s using the pipe and plus character - DUH!
-
The 8 custom characters also need a command character which prevents sending them by DMA. The HD controller uses non printable ASCII character spaces and the firmware creator should have stuck with it.
-
the background control is useful but there should be a separate write settings to EEPROM. I was intending to use it to flash when errors occur, system good etc, but 100,000 writes may, long term, not be enough.
-
Documentation is terrible. Many of the commands are not listed in the cheat-sheet. There’s nothing on how to reprogram the CPU. I assume it’s using the RST pin which I found and the 4 SPI pins but haven’t tested it yet. Many of the commands I’ve got by reading the firmware source code.
Overall unimpressed - Sparkfun had an opportunity to do something very nice here but they’ve missed the mark by omitting real-life testing.
DMA is useful with a frame-buffer. Once 50%+ of the screen needs writing the benefits of shifting the cursor around become a negative. I just pump out all 4 rows at an interval. The problem then is the 8 printable custom characters need a command character but the frame-buffer is a defined length. You say using the pipe character is as good as any, I disagree, any of the 0x0–0x20 ascii characters would have been an obvious choice, and the 8 characters should have been mapped into these as well.
I hadn’t come across that guide for updating the firmware which is something if I have to hack at it. Unfortunately the LCD screen is faulty (characters are weirdly dim in the upper right and lower left corner with very slow response) so it’s on the way back to the distributor.