Newhaven Display Forum

Newhaven Products => Character LCDs => Topic started by: majorninth on May 22, 2015, 01:50:47 PM

Title: NHD-C0220BiZ-FSW-FBW-3V3M NAKs all odd numberd ASCII characters
Post by: majorninth on May 22, 2015, 01:50:47 PM
I'm trying to understand why only the odd numbered ASCII characters are NAKed (even numbered are ACKed).
10K pull ups on clock and data. Custom board, I2C communications.
Characters are all displayed correctly if I remove the ACK/NAK check completely from the comm layer.
Title: Re: NHD-C0220BiZ-FSW-FBW-3V3M NAKs all odd numberd ASCII characters
Post by: Michael_L on May 28, 2015, 07:31:56 AM
I've not heard of this before.  Are you sure you are reading the bits correctly?  Do you have another one of these displays to test?
Title: Re: NHD-C0220BiZ-FSW-FBW-3V3M NAKs all odd numberd ASCII characters
Post by: majorninth on May 28, 2015, 01:22:04 PM
see attached logic analyzer screen dump. The same thing happens for all 255 characters. A scope dump also shows the NAKs/ACKs.
Title: Re: NHD-C0220BiZ-FSW-FBW-3V3M NAKs all odd numberd ASCII characters
Post by: Michael_L on May 28, 2015, 02:52:28 PM
How fast are you running your I2C communcation?  Can you try slowing it down and testing it again just for troubleshooting?  Do you have any other displays to test?
Title: Re: NHD-C0220BiZ-FSW-FBW-3V3M NAKs all odd numberd ASCII characters
Post by: majorninth on May 28, 2015, 03:14:02 PM
I'm bit banging (a port of the given example). From the capture it is running about 150K. I did try adding another CLK_LO at every CLK_LO and a CLK_HI at every CLK_HI to run at 50% of my nominal speed. No difference.

static void I2C_out(unsigned char j) //I2C Output
{
//   int t=0;
   int n;
   unsigned char d;
   d=j;
   for(n=0;n<8;n++){
      if((d&0x80)==0x80)
         SDA_HI;
      else
         SDA_LO;
      d=(d<<1);
      SCL_LO;
      SCL_HI;
      SCL_LO;
   }
      SCL_LO;
   SCL_HI;
        //ignore the ack info for now
   //while(SDA_READ==1)
   //{
      //SCL_LO;
      //SCL_HI;
      //if (++t>100)
         //break;
   //}
   SCL_LO;
}

Title: Re: NHD-C0220BiZ-FSW-FBW-3V3M NAKs all odd numberd ASCII characters
Post by: Michael_L on May 28, 2015, 04:10:53 PM
Thanks for the information.  Do you have any other displays to try?  Are the any other devices present on the I2C bus?  If so, can you isolate the display?  With your current I2C setup, can you communicate with any other devices and receive all ACKs correctly?  As I've said I haven't heard of this previously, so it is a new, and fairly odd issue.
Please confirm the above, and if all else fails please either contact quality@newhavendisplay.com to setup an RMA to return the display back to us for analysis.  If you prefer a quicker alternative, you may purchase another display from our website or our distributors such as DigiKey or Mouser and run your test again.
Title: Re: NHD-C0220BiZ-FSW-FBW-3V3M NAKs all odd numberd ASCII characters
Post by: majorninth on May 28, 2015, 04:26:46 PM
I have 3 boards they all exhibit the same problem. The display is the only device on the I2C bus. It is interesting to note that the display seems perfectly happy if I ignore the NAK and if I try to keep reading (waiting for an ACK) it will never supply one. It appears that it thinks things are ok even tho I got a NAK. And all the characters NAKed display fine.
Title: Re: NHD-C0220BiZ-FSW-FBW-3V3M NAKs all odd numberd ASCII characters
Post by: Michael_L on May 28, 2015, 04:51:31 PM
It seems there is some issue with your software or board.  I have just tested this display with an Arduino with the following code, and coded it to not allow for the program to continue if there is no ACK.  All characters are displayed properly.  See code below:

Code: [Select]
#include <Wire.h>

int RES = 22;
int ASDA = 20;
int ASCL = 21;

unsigned char text1[]={"  Newhaven Display  "};
unsigned char text2[]={"____NHD-C0220BiZ____"};
unsigned char text3[]={"    May 28, 2015    "};
unsigned char text4[]={"   Michael LaVine   "};
unsigned char text5[]={"ACK TEST -- 11111111"};

const char slave2w = 0x3C;  //3E for CiZ (0x7C shifted over 1 bit)  //3C for BiZ (0x78 shifted over 1 bit)
const char comsend = 0x00;
const char datasend = 0x40;
const char line2 = 0xC0;

void show(unsigned char *text)
{
  int n, d;
  d=0x00;
  Wire.beginTransmission(slave2w);
  Wire.write(datasend);
  for(n=0;n<20;n++)
  {
    Wire.write(*text);
    ++text;
  }
 
  while(Wire.endTransmission());
}

void nextline(void)
{
  Wire.beginTransmission(slave2w);
  Wire.write(comsend);
  Wire.write(line2);
  while(Wire.endTransmission());
}

void cleardisplay(void)
{
  Wire.beginTransmission(slave2w);
  Wire.write(comsend);
  Wire.write(0x01);
  while(Wire.endTransmission());
}

void CiZ_init()
{
  Wire.beginTransmission(slave2w);
  Wire.write(comsend);
  Wire.write(0x39);
  delay(1);
  Wire.write(0x14);
  Wire.write(0x70);
  Wire.write(0x5E);
  Wire.write(0x6D);
  Wire.write(0x0C);
  Wire.write(0x01);
  Wire.write(0x06);
  while(Wire.endTransmission());
}

void setup()
{
  pinMode(RES, OUTPUT);
  pinMode(ASCL, OUTPUT);
  pinMode(ASDA, OUTPUT);
  digitalWrite(RES, HIGH);
  //delay(10);
  //digitalWrite(ASCL, LOW);
  //digitalWrite(ASDA, LOW);
  //delay(10);
  Wire.begin();
  delay(10);
  CiZ_init();
  delay(5);
}

void loop()
{
  show(text5);
  nextline();
  show(text2);
  delay(1500);
  cleardisplay();
  delay(2);

  show(text3);
  nextline();
  show(text4);
  delay(1500);
  cleardisplay();
  delay(2);
}

Note - the Wire.endTransmission() function will only return a 0 if it receives an ACK.