Sparkfun HD44780 LCD Delays

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.

  1. 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.

  2. 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!

  3. 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.

  4. 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.

  5. 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.

  • Programming instructions are at https://learn.sparkfun.com/tutorials/av … are-update both for using the bootloader and Arduino environment and for using an AVR programmer

  • Using printable characters for control (with an escape character) makes it easier for users to debug their code; using pipe for the escape character is as reasonable a choice as anything (at least it isn’t the +++ with 3-second padding that Hayes used for the AT commands…)

  • I agree that they could use some documentation

  • There is an Arduino library available if you are going that route. If not, it’s a good source for examples on how to use the command set

  • Displaying the custom characters appears to be done by |n where n is 35+char number. That can be sent by DMA like any other message. It’s no different than sending \n for a newline

  • The product is open source; feel free to modify it to support your unique application needs. For example, you can add a command to blink the backlight without touching the eeprom

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.