Newhaven Products > Character LCDs

NHD-C0220BiZ Sometimes Ignoring "Clear Display" Command

(1/1)

dstover:
Hello,

I'm communicating with the C0220BiZ through its I2C interface, and having a problem with the "Clear Display" (chip 0x3C (7-bit), register 0x00, data 0x01) command executing consistently. Subsequent I2C writes to data (0x40) append text to the existing contents of DDRAM, as though the Clear command were never received.

I would greatly appreciate any thoughts on why this is happening. I'm willing to provide more scope captures or run further tests if that helps remove entropy from the discussion.

Overview:

* My I2C commands appear well-formed (see attached oscope grabs).
* My I2C master doesn't sense a NACK or time out (it would set a sticky flag in my debugger, which it has not done).
* Slowly stepping through my program proves that it is not a matter of wait time between transmissions; I have observed persistent text after oscope confirmation that a Clear Display command was sent and the LCD did ACK all frames.
Program notes:
My test program initializes the display as per the ST7036 datasheet (see code below), and loops through a simple clear-write-wait routine:

* The clear function waits 2 ms after transmission, before allowing data to be written to the display. In fact, all writes to the command register (0x40) wait 2 ms after transmitting.
* Writes to the command register are formed as single I2C writes (start/chip/reg/data/stop for each instruction).
* Writing data to the display is formed as a repeated write (same concept as sample code from the Newhaven datasheet).
* A wait time of 100 ms is issued after writing data to the display, before looping back to the Clear Display command

--- Code: ---#define lcdSlave    0x3C
#define lcdCmd      0x00
#define lcdDat      0x40
void lcdInit( void ) {
   waitMS(40);
   lcdWriteCmd(0x38); // Function Set:: 8b; 2Line; SingleHeight; InstrTable 00b
   lcdWriteCmd(0x39); // Function Set:: 8b; 2Line; SingleHeight; InstrTable 01b
   lcdWriteCmd(0x14); // Bias Set:: 1/5 bias
   lcdWriteCmd(0x78); // Contrast Set:: C[3:0] is data[3:0]
   lcdWriteCmd(0x5E); // Pwr/Contrast Set:: ICON.on; Boost.on; C[5:4] = data[1:0]
   lcdWriteCmd(0x6D); // Follower Control:: Follower.on; ratio = data[2:0]
   waitMS(300);
   lcdWriteCmd(0x0C); // Display:: Display on, cursor off
   lcdWriteCmd(0x01); // Clear Display
   lcdWriteCmd(0x06); // Entry Mode Set:: Cursor.incrementDirection; Shift.disabled
}
void lcdWriteCmd( u8 outCmd ) {
   i2cMasterWrite(lcdSlave, lcdCmd, outCmd);
}

--- End code ---

dstover:
Found a solution. Making a note for those who might run into a similar issue.

My I2C master was running in fast mode (400KHz) which this device only supports at voltages of 4.5 < VDD < 5.5. My device was running at a standard 3.3V.

I fixed my problem by recoding my I2C master to run at 200KHz (max is 300KHz with a 25/75% SCL duty cycle, 200KHz with 50/50), but could have just as easily green-wire'd VDD above 4.5V.

Cheers
David

Michael_L:
Thank you for posting your results!

Navigation

[0] Message Index

Go to full version