OK, I got it to work. It’s a little confusing, but essentially what you have to do is this:
Go into the BIOS (press DELETE at boot)
Go to the Advanced > HAT Configuration option.
Once you’re there, there are a couple of options at the very top of the list, to choose between GPIO and I2C5 (top line) and GPIO vs I2C6 (second line). Select each and toggle the option to I2C5 (first line) and I2C6 (second line).
Press F4 to save changes and exit from BIOS. Confirm when asked.
Boot into Linux.
Open a terminal, and install i2c-tools: $ sudo apt install i2c-tools
When finished with the install, add yourself to the ‘i2c’ group if you’d like to use the i2c buses as user (so you don’t have to do it as ‘root’ or ‘sudo’ all the time):
$ sudo usermod -a -G i2c user (substitute your username for ‘user’ of course)
Reboot. To confirm it worked, enter “id” at the command line after it reboots. You should see something like this:
uid=1000(tb) gid=1000(tb) groups=1000(tb),4(adm),20(dialout),24(cdrom),27(sudo),30(dip),46(plugdev),116(lpadmin),126(sambashare),127(i2c)
- Now you can use the i2c buses as user. NOTE: Pins 3 & 5 on the 40-pin header represent the i2c-1 bus. Pins 27 & 28 on the 40-pin header represents the i2c-2 bus.
Note that these ARE NOT the same names as you’ll see for those two buses in the BIOS, which is one of the things that had me confused for a while. But through experimentation I was able to figure it out–and both buses seem to work fine, at least in terms of seeing the devices on them. I haven’t written any code to work with an i2c device yet, but I don’t see why it wouldn’t work. If we can see the devices on the bus, then we should be able to work with them (again, as ‘user’ if you do the usermod thing I listed above).
So I would try to enable I2C6 in the BIOS, mount your Sensor Hat, and then use i2cdetect on bus 2.
$ i2cdetect -r -y 2
See if anything shows up. I would think you’d see it, but I don’t have one here so you’ll have to try it and then report back on your progress. If it does show up, then note the addresses of the devices and compare it to the Sense Hat documentation.
I actually want to see about maybe getting wiringPi to work on this board, because that would be a very easy way to have a very nice library to do i2c and GPIO stuff. But since this isn’t an RPi of course, it might be a challenge. Worst-case scenario, I have to write my own i2c library for this board. I’ve done it before for a Linux device…back in the days before wiringPi. These things are just files in the Linux file system, so providing you have the correct permissions to use the bus (file), it’s not rocket science.
Hope this helps.
EDIT: I just checked out the features of the Sense Hat, and they look pretty cool…so I ordered one! It will be here in two days, and I’ll play around with it.
I also found a video about this board on YouTube and was able to grab a screen shot of the page in the BIOS where you’ll need to change to the I2C5 and I2C6 choices, if you want to make assign those pins to the i2c buses. This is step #3 in my post above.