back to index

Character LCD display corruption solution

The 2004 (20x4 character) LCD on the Reprap Discount Smart Controller display module is prone to random corruption. The display scrambles and from then displays only partial values until it is completely reset and refreshed again. Apparently this is caused by transients coupled to the cable between the display and the controller.

The display in question, a generic HD44780-compatible one, is connected using its stock flat 10-wire cable to the ATmega2560 chip with the RAMPS1.4 board on two machines and a homemade clone of the same on the third. All show the same behavior, occasional display corruption.

The display in the CNC machine was almost reliably getting corrupted on power-on of the main PSU. An annoyance that finally deserved a ponderous stare at.

An online search discovered this to be a common problem of printers using these displays. The long flat cables between the controller chip (usually ATmega2560) and the display itself are unshielded and the machines have major inductive loads - stepper motors, relays, solenoids, name it. The design is not prepared for such EMI-hostile environment.

Good display

Corrupted display

The usual approach is shielding the cables. This was decided to be suboptimal, as the shielding has to be connected to something, impedes the flexibility of the cable, and crumples away over time as the thing is moved around. Neverthless, it was kept as an option if there is nothing better to do.

First, power line was addressed.

Adding a 33uF tantalum with 68nF ceramic caps on the 5V rail, straight on the display power pins, did not help appreciably.

A further research on EMI filtering of parallel display interfaces was performed.

There are commercial six-lane EMI filter chips on the market, used inline with the SPI or parallel lines of displays in eg. cellphones. An example is TPD6F002. Another is AOZ8175.

The chips use a "pi" C-R-C filter network with additional TVS diodes. Each lane looks this way:

schematics of the EMI/ESD protection chip lane
o-----*------*-------/\/\/\------*------*-------o  signal
      |      |                   |      |
     ---   -----               -----   ---
     / \   -----               -----   / \
     ---     |                   |     ---
      |      |                   |      |
o-----*------*-------------------*------*-------o  GND

The resistor value is usually 100 ohms.
The capacitor varies by chip.

The chips turned out to be difficult to source in single-piece amount, and soldering wires to their 0.4mm pitch was declared suboptimal. It was decided instead to implement the filters on discrete parts; 0604-sized SMD components are big and comfortable to work with.

Using an online calculator, the filter characteristics was calculated. The output impedance of AVR pin is usually 80-100 ohms, count 100 for now; this was taken as the first resistor (R1).

schematics for calculator
                              cutoff/center frequency
type          R       C      datasheet     calculated

AOZ8175      100     8 pF     220 MHz        199 MHz
TP6F0002     100    17 pF     100 MHz         94 MHz
this         100    56 pF                     28 MHz

other values (again, assuming 100 ohm pin output impedance):

             100   100 pF                     16 MHz
             100   220 pF                      7.2 MHz
             100   470 pF                      4.5 MHz
             100  1000 pF                      1.6 MHz

            1000    56 pF                      9.0 MHz
            1000   100 pF                      5.0 MHz
            1000   220 pF                      2.3 MHz
            1000   470 pF                      1.1 MHz
            1000  1000 pF                      0.5 MHz

Two display modules were retrofitted; one directly on the display itself as the traces were fat and easy, one on the adapter board.

The filter can be also designed with ease as an add-on in-between board to plug between the EXP1 connector and the display cable.

...and it did not work as well as hoped for, as after some inactivity and couple hours of idle laying around the display indeed got corrupted again.

Just mildly, though, for now.

Subtly corrupted display

On a hunch, a pulldown resistor of 1 kΩ was added before the filter at the ENABLE line of the display. The controller strobes data to the display by pulsing this high, the signal stays mostly at L.

...and no EMI issue appeared ever since, in weeks.

(Could this be the contribution to the EMI-sensitive behavior? The latching happens on the falling edge. The threshold level between L and H is fairly close to 0V, the margin from full Vcc to threshold is higher than from GND to threshold.)

There is also the possibility of keeping the display in read-state for most of the time, flipping the R/W signal only as needed. Can we get it generated from the ENABLE strobe, prolonged with a R-C circuit so it lasts enough over the falling edge of the strobe? (Needs change on the module board, cannot be done with just a plug-in inline board.)

Todo, irrelevant to this issue: try out the LM334 200uA current sink instead of the contrast regulation trimpot. [ref]

Todo, display reset to 8bit and then 4bit mode, on a command - add-on to Marlin: [ref]


All six signals got their own pi filter, with 56pF caps and 100ohm serial resistor. The E (Enable) signal, due to being the most susceptible to trouble, got also its own 1kohm pulldown resistor.

display interface filtering

The filter was installed in two display modules.

The first one allowed good access to the signal traces from the LCD module itself.

blue module

cut traces, removed mask

resistors and capacitors installed

resistors and capacitors installed

ground wire in place

ground wire in place

The second one required doing the modification on the module board itself.

green module



cut traces, removed mask

resistors and capacitors in place

resistors and capacitors in place

resistors and capacitors in place


If you have any comments or questions about the topic, please let me know here:
Your name:
Your email:
Leave this empty!
Only spambots enter stuff here.