User avatar
ecaheti
Posts: 140
Joined: Tue Aug 14, 2012 3:06 pm
Location: Normandie, France
Contact: Website

Sense Hat + Adafruit DC & Stepper Motor HAT

Mon Apr 04, 2016 8:44 am

Hi,

I'm working on a project where I want to use a Sense Hat and also a Stepper motor hat from adafruit.

Both seems to work well separately, but when I connect both, the sense hat leds are stuck on, and python API returns error of communication.

Is there a compatibility issue between both ?

Here is the i2cdetect of the Sense hat alone

Code: Select all

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- 1c -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- UU -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- 5c -- -- 5f 
60: -- -- -- -- -- -- -- -- -- -- 6a -- -- -- -- -- 
70: -- -- -- -- -- -- -- --      

And the one of Stepper Hat

Code: Select all

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: 60 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 

70: 70 -- -- -- -- -- -- --          


Any idea where I should investigate ?

Thanks by advance

scotty101
Posts: 3958
Joined: Fri Jun 08, 2012 6:03 pm

Re: Sense Hat + Adafruit DC & Stepper Motor HAT

Mon Apr 04, 2016 11:22 am

The official HAT specification does not support stacking.

Both devices have an I2C EEPROM device on the same address which will conflict with each other.
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

User avatar
ecaheti
Posts: 140
Joined: Tue Aug 14, 2012 3:06 pm
Location: Normandie, France
Contact: Website

Re: Sense Hat + Adafruit DC & Stepper Motor HAT

Mon Apr 04, 2016 11:25 am

scotty101 wrote: Both devices have an I2C EEPROM device on the same address which will conflict with each other.
Which adress are you talking about ?
Stepper Hat uses 60 and 70, does not seems to interfere with Sense Hat, is it ?

dgordon42
Posts: 788
Joined: Tue Aug 13, 2013 6:55 pm
Location: Dublin, Ireland

Re: Sense Hat + Adafruit DC & Stepper Motor HAT

Mon Apr 04, 2016 8:15 pm

All HAT devices contain an EEPROM, which contains configuration information about the device.
The Pi reads the data from the EEPROM over i2c bus 0, which is controlled by the GPU, and therefor is not accessible by the user.
i2c bus 0 reads the HAT EEPROM through physical pins 27 & 28 on the GPIO header.
All HAT EEPROMs use i2c address 0x28, therefor you can only use one HAT device on a Pi, as scotty101 pointed out above.

The i2cdetect readouts you posted above are for i2c bus 1, and so you cannot see the conflict.

Hope this helps,
Dave.

User avatar
ecaheti
Posts: 140
Joined: Tue Aug 14, 2012 3:06 pm
Location: Normandie, France
Contact: Website

Re: Sense Hat + Adafruit DC & Stepper Motor HAT

Wed Apr 06, 2016 8:16 am

Ok thanks, I understand it better now.

But in my case (using sense hat), I follow the instructions found here ; viewtopic.php?p=829527#p829527
and it allowed me to use both Hat at the same time. Even if I don't get how it works....


Edit : Humm, so I assume that reading eeprom on i2c bus 0 load dynamically peripherals on Linux DT. Adding dtoverlay=rpi-sense "force" the DT to consider a Sense Hat, but how is the Motor Hat detected ? Perhaps something hard coded in Adafruit drivers ?

dgordon42
Posts: 788
Joined: Tue Aug 13, 2013 6:55 pm
Location: Dublin, Ireland

Re: Sense Hat + Adafruit DC & Stepper Motor HAT

Wed Apr 06, 2016 10:46 pm

I don't have a sense hat, or an Adafruit DC, but I would guess that the Adafruit DC is on the bottom, ie. closest to the Pi, and it does not pass the i2c bus 0 signals on pins 27 & 28 on to the sense hat.
The Pi therefor only reads the Adafruit DC EEPROM, and sets up Device Tree to work with it.
You then manually add the line "dtoverlay=rpi-sense" to /boot/config.txt to set up Device Tree to work with the Sense Hat.

You could test this idea by checking that there is no connection between the input and output pins 27 & 28 on the Adafruit DC.

Dave.

Return to “Astro Pi”