A Quick Tour Around the IS31FL373x Chips

A project log for D1 Mini Matrix Deluxe Shields

Shields for the D1 Mini ESP8266 board using the ISSI chips

deʃhipudeʃhipu 07/02/2017 at 22:263 Comments

There is a whole family of those, and they are all controlled in a similar way. Of course all the details are in the datasheets, and in theory this is all the information you need, but in practice I think it's useful to have a general bird's-eye view of the whole thing.

The chips are controlled over I2C and I'm not going to explain that. Uncharacteristically, it has two additional pins related to the I2C protocol, apart from the usual SDA and SCL: those are the IIC-RST, which can be used to reset the part of the chip that handles communication, in case your bus gets stuck in some weird state preventing communication, and VIO, which sets the voltage that you want to use for the communication. I usually just pull the IIC-RST down and the VIO up.

The higher-level protocol is also quite simple. You have 8-bit registers with b-bit addresses, divided into pages. To read or write a register from the current page, you simply write that register's number, and then either read with a repeated start or write. That's pretty much standard. Changing a page is bit more involved, because it's apparently potentially dangerous: first you need to unlock the page register by writing the magic value 0xc5 to the register 0xfe, and then you can write the page number to the register 0xfd.

There are four pages.

Page 0 is dedicated to configuring which LEDs are being used, and to reading results of the open/short detection. At the minimum you need to write 1s to the bits corresponding to the LEDs that are actually connected to the chip (your matrix may be smaller than the chip's maximum). You only do it once at the beginning.

Page 1 contains information about brightness of each individual LED. That's where you actually draw your pixels. Of course, the default brightness is 0, so you need to write something there to actually see anything.

Page 2 controls blinking, or rather "breathing", as they call the fade-in fade-out animation that you can set on any of the individual LEDs, in 3 different variations of timing. You don't need to touch anything here. Oh, and for this to have any effect, you need to set the B_EN bit in the register 0x00 on page 3.

And finally page 3 is configuration. At the minimum, you need to write 0x01 to the register 0x00 here to enable the chip, and some value to the register 0x01 setting the global brightness (because of course it defaults to 0 and you wouldn't see anything). The rest is about configuring the blink timings, pull-up and pull-down resistors on the LEDs, and a software reset -- not that interesting.

So the workflow of the driver is usually as follows:

  1. Set which LEDs you are using by writing to registers on page 0.
  2. Switch to page 3.
  3. Enable the chip and set the global brightness.
  4. Switch to page 1.
  5. Actually draw your graphics by writing to the registers on page 1.

That should get you started. Of course, there are lots more small details and possibilities there.


davedarko wrote 07/03/2017 at 21:02 point

Just for the fun of it - I've just changed the code to:

 - Set each grayscale once on page 1

 - blink LEDs by turning them on and off on page 0

This has a better refresh rate, when it comes down to only turning them on and off (but you lose all the benefits of grayscale stuff, of course)

Thanks for sharing the workflow! Your code was great to work through but I've missed step 4 and 5 :D this might help the next who wants to work with the shields. 

  Are you sure? yes | no

deʃhipu wrote 07/03/2017 at 22:14 point

If you want to just blink them all, you can either:

- just change the global current control register on page 3 -- only 2 bytes per blink!

- set all the pixels to blinking on page 2 and forget about it -- 0 bytes per blink!

  Are you sure? yes | no

davedarko wrote 07/03/2017 at 22:29 point

You win :D

  Are you sure? yes | no