Page 1 of 1

Sense HAT LED matrix i2c protocol

Posted: Tue Mar 13, 2018 12:52 pm
by hans_ober
Is there any documentation on the actual i2c protocol that the AVR MCU on the Sense HAT uses? I couldn't find the firmware of the AVR that drives the LED matrix.
I'm trying to use the SenseHAT with another microcontroller, and with software emulated i2c on the Pi.

Re: Sense HAT LED matrix i2c protocol

Posted: Tue Mar 13, 2018 5:40 pm
by DougieLawson
The SenseHAT code at: https://github.com/RPi-Distro/python-sense-hat doesn't access any I2C devices. The pixels are set up as a 64 pixel RGB565 frame buffer (how that's driven by the RPi is not documented).

There's docs at: https://www.raspberrypi.org/documentati ... /README.md

Re: Sense HAT LED matrix i2c protocol

Posted: Tue Mar 13, 2018 5:56 pm
by ShiftPlusOne
The idea is to talk to the device directly rather than through the linux driver.

Firmware source is here:
https://github.com/raspberrypi/rpi-sense

Re: Sense HAT LED matrix i2c protocol

Posted: Wed Mar 14, 2018 5:25 pm
by hans_ober
ShiftPlusOne wrote: The idea is to talk to the device directly rather than through the linux driver.

Firmware source is here:
https://github.com/raspberrypi/rpi-sense
DougieLawson wrote: The SenseHAT code at: https://github.com/RPi-Distro/python-sense-hat doesn't access any I2C devices. The pixels are set up as a 64 pixel RGB565 frame buffer (how that's driven by the RPi is not documented).

There's docs at: https://www.raspberrypi.org/documentati ... /README.md
I had a look at the docs on github, and nothing is mentioned about the I2C protocol the AVR uses. The firmware for the AVR isn't posted either.
Without any of this, it will be nearly impossible to use I2C commands to control the AVR (without using the standard driver), right?

EDIT:
https://github.com/raspberrypi/rpi-sens ... ter/main.c didn't seem to have much in it, but https://github.com/raspberrypi/rpi-sens ... pi-sense.S has assembly code. I'll need to have a closer look at it and see if it can be used.

Re: Sense HAT LED matrix i2c protocol

Posted: Wed Mar 14, 2018 7:27 pm
by ShiftPlusOne
It can definitely be used. The information is off the top of my head, so I can't give you the specifics, but there's really nothing tricky to it.Try i2cget and i2cset to write to the first few registers and the rest should be obvious.

I'm sure I've seen straight C libraries for talking to it, but the first one I found is a C# one: https://github.com/emmellsoft/RPi.Sense ... Support.cs

Re: Sense HAT LED matrix i2c protocol

Posted: Thu Mar 15, 2018 5:24 pm
by hans_ober
ShiftPlusOne wrote:
Wed Mar 14, 2018 7:27 pm
It can definitely be used. The information is off the top of my head, so I can't give you the specifics, but there's really nothing tricky to it.Try i2cget and i2cset to write to the first few registers and the rest should be obvious.

I'm sure I've seen straight C libraries for talking to it, but the first one I found is a C# one: https://github.com/emmellsoft/RPi.Sense ... Support.cs
My application is based on Python, so I'll try using a Python i2c library.

Re: Sense HAT LED matrix i2c protocol

Posted: Fri Mar 16, 2018 5:44 am
by hans_ober
https://github.com/4eMaLo/SenseHAT-Game-of-Life

I tried this out and it works perfectly!

Re: Sense HAT LED matrix i2c protocol

Posted: Sun Mar 18, 2018 1:30 pm
by alphanumeric
Pinout and other info here, https://pinout.xyz/pinout/sense_hat# if that helps?