Addafruit Alphanumeric Display

Questions on control of serial busses
danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: Addafruit Alphanumeric Display

Post by danlee58 »

Although the Adafruit display is powered with a 5 Volt source, it can be used with a 3.3 Volt signal. The VI2C pin sets the logic level to be compatible with the lower voltage.

I am now using P0.1, and P0.11 as SDA & SCL. Are those pins Open Drain?

Since COUT allows any pins to be used as SDA & SCL, I could opt to use pins that are not open drain without pullups. I have only one display on the bus.

Are P1.28 & P1.29 suitable for SDA & SCL without pullups?

I believe that it's possible that my display is damaged. I have another unit, that I will assemble, and try.



danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: Addafruit Alphanumeric Display

Post by danlee58 »

I connected the display to P1.26 (SDA), and P1.28 (SCL) with no pullups. I changed the device address to 0xEE. Now I am getting the Acknowledge. I still am not able to turn any LEDs ON. It's difficult to decipher the cryptic Holtek & Adafruit data sheets.

basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

Re: Addafruit Alphanumeric Display

Post by basicchip »

There have to be pull-ups somewhere for i2c to work.

The i2c routines only drive low and Tristate for high, which acts like an open drain.

danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: Addafruit Alphanumeric Display

Post by danlee58 »

I added the pullups to 3.3 Volts. I also assembled a new display board. The results are the same. I get the Acknowledge, but no LEDs turn ON.

I'm trying to get some help from Adafruit & Holtek.

basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

Re: Addafruit Alphanumeric Display

Post by basicchip »

When I am trying to debug an external peripheral, I look for some register that I can write to that can be read back. That is a pretty good indication that the connection is good, otherwise, it is time to pull out the oscilloscope to look at signals. I assume you don't have that option, maybe I should resurrect the logicscope code, which would turn an ARMmite into a 16 channel logic analyzer, good enough to look at i2c or spi.

Next after you can read or write to a register, it is time to look for some sample code. Does Adafruit publish any code for Arduino (it is in C) so it should be pretty easy to port or at least copy the sequence of events.

danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: Addafruit Alphanumeric Display

Post by danlee58 »

I do have a scope. It's an ancient HP. I can look at the signals, if I put the code in a loop.
I did get a sample program from someone on the Adafruit Forum.
Here is something that I saw going over the Adafruit & Holtek data.

Rev. 1.10 27 May 16, 2011
HT16K33
RAM Mapping 16*8 LED Controller Driver with keyscan
●● When an address byte is sent, the device compares the first seven bits after the START condition.
If they match, the device outputs an acknowledge on the SDA line.
●● 28-Pin package:
1 1 1 0 A2 A1 A0 R/W


If A2, A1, A0 are all High, the Address should be OxEE.

Here is a snippet from the sample code from the Adafruit Forum:

char *message = "**** 0000 ";

Adafruit_AlphaNum4 alpha4 = Adafruit_AlphaNum4();

void setup() {
alpha4.begin(0x70); // pass in the address
alpha4.clear();
alpha4.writeDisplay();

That is followed by:

// send a message!
for (uint8_t i=0; i<strlen(message)-4; i++) {
alpha4.writeDigitAscii(0, message);
alpha4.writeDigitAscii(1, message[i+1]);
alpha4.writeDigitAscii(2, message[i+2]);
alpha4.writeDigitAscii(3, message[i+3]);
alpha4.writeDisplay();

delay(800); //So you have time to verify all the little bits are glowing properly
}}

This code displays four zeros (0000).

An address of 0x07 should not work. Is this LSB first?

basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

Re: Addafruit Alphanumeric Display

Post by basicchip »

i2c is MSB first. You'd have to dig into the Arduino code to figure out what the example does, though my guess is it builds an array and then sends it out.

There is only one read/write register, that being the address pointer. Which is at address 0x0- where the - is the lower 4 bits which sets the address. From the spec sheet I can't tell if the actual address can be read back. But in any case any data written after the pointer is set, writes the RAM at that address and increments the pointer. So you should be able to write a sequence to RAM and read it back.

On page 32 of the Holtek spec are flow charts for initializing and writing to the device.

danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: Addafruit Alphanumeric Display

Post by danlee58 »

I found a problem.

if (INx(sda_pin) && INx(scl_pin)) {
SET_SDA_LOW; // drive SDA low
i2c_stall();

It seems that INx(sda_pin) and INx(scl_pin) are always 0. I am using P1.26, and P1.29 as SDA, & SCL. When I check them with a meter, they are 3.27 Volts. I have them pulled up to 3.3 Volts. Do I have to pull them up to 5 Volts? I may do that anyway, because I can save a wire connection to the Adafruit board by jumpering the VI2C pin to the VCC pin (5 Volts).

basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

Re: Addafruit Alphanumeric Display

Post by basicchip »

You can pullup to either 5 or 3.3V, the LPC1756 can take the 5V input, I'm not sure about the holtek part though most 5V parts accept 3.3V as a valid HIGH.

Though P0.29 and P0.30 are "special" on the LPC1756 as they are shared with the USB port and because of that they have to be controlled in parallel, meaning they have to be both inputs or outputs. The BASIC firmware takes care of this, but as you are using C, you would have to do the same. Better would be to use some other pin than P0.29

danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: Addafruit Alphanumeric Display

Post by danlee58 »

Bruce,

Those pins are P1.26, and P1.29, not P0.29.

Post Reply