AS1115 Self-Addressing fails

According to the AS1115 manual, writing to register 0x2D should cause the chip to change its address from the default 0x0 to one specified by the wiring between KEYA (pin 11) and SEGF (pin16) and SEGG (pin 18); e.g., connecting pin 11 to pin 16 should cause the AS1115 to respond to address 0x1, and connecting pin 11 to nothing corresponds to address 0x3.

All the sample code I’ve found on the web uses only one AS1115 and doesn’t change its address from 0x0. I’m trying to use two, and cannot get them to recognize their addresses.

I’m able to change various parameters, e.g., brightness, blinking, and coding, by writing to various registers, using address 0x0, so I am convinced that my code correctly sends i2c commands to the chip. And by reading the KEYA and KEYB registers at address 0x0, I can see that SEGF reads as 0x0 while all the others read as 0x1. This corresponds to the wiring of the chips (one has KEYA shorted to SEGF; the other has KEYA with no connections).

At this point, I’m stuck. Has anybody else run into this? Is there some sample code – preferably in C – that is known to work? Is there some other forum where I can search for help?

Thanks.

Greetings,

I agree with your reading of the datasheet, and that the ability to read & write is pretty good evidence of functioning I2C… Silly question perhaps, but have you tried reading back the contents of 0x2D? If it came back with a 0x1 yet the chip still responds on address 0x00 while you’re reading back that SegG/F are configured for something else, that would seem to be inconsistent with the datasheet.

If 0x2D read back as 0x00 though, it might suggest that the bit of interest is either not getting set or is being reset somehow; one might look for power glitches or some sort of timing issue in such case.

Thanks for the quick response.
I’ve tried reading the 0x2D register. If I address the chips as 0x1 or 0x3, as wired, all reads fail altogether (i.e., return NAK). If I address the chips as 0x0, then the result of reading 0x2D is 0x00, both before and after trying to get the chip to set its address, and then reading the keys associated with KEYA gives 0b11111101, indicating SEGF is closed and the rest are open – as expected, since KEYA is shorted to SEGF on one of the chips.

The manual does not indicate that register 0x2D can be read. Do you believe it can be?

Hello @ThisEndUp,

Would you be willing to share the relevant portions of your code so I can see the exact command sequence you are following?

2 Likes

Yes, I’ll be glad to send the code. Let me make a version that has the code to drive the LEDs – most of it is a couple of decades old! – but not the code for the application itself. I’ve got a bunch of competing tasks right now, so it may be a couple of days before I complete this.

Hi Matt,

As the British would say, “OBE” (overtaken by events). Sorry.

I’ve not posted the code because I’ve been hammered with other things, and I solved the issue as far as my project is concerned by running both AS1115s with their default address of 0x00 but using separate lines for their clocks. I.e., both use the i2c data line for their data inputs, but one AS1115 is clocked by the usual i2c line and the other is clocked by a separate line under program control. Since I’d written all the i2c code in a modular fashion in the first place, this was an easy modification. (It helps that there was an unused output pin on the cpu.) I admit that it’s a bit of a hack, but it works!

Thanks,
~ThisEndUp