WLOG - notes something different

i2c

Inter-Cntergrated Circuit protocol, used to communicate with a wide verity of IC devices on a single physical bus.

9front / plan9 provide I2C support in a form of kernel device abstraction, but not necessarily enabled for your specific device.

9front does not support I2C on Raspberry Pi out of the box.

installation

As of 9front release HUMANBIOLOGICS on 2023.11.22, the I2C code is part of the base system, with tweaks to deferentiate betweeen miltiple I2C busses (if they exist).

If hardware support is in for your device, just use it.

usage

When supported / enabled, I2C devices should be accessible through #J kernel device.

Example - bme680 (address 0x77) raw I2C access:

DEPRECATED Raspberry Pi 1 - (RPI 1) DEPRECATED

Enabling I2C support on Raspberry Pi 1 with 9front, by including code from plan9. Luckily, many resources can be found on this topic. Here is a cleanup and condensed summary.

references

adventuresin9 video on the subject: youtube

preparation

code installation

compile and install new kernel

The process also requires mounting the boot partition and editing config files.

mount RPI 1 boot partition

RPI1 uses a fat/dos partition with config files that are used to boot the board.

The boot partition can be mounted with 9fs script:

9fs pidos

This will bind the boot partition to /n/pidos folder.

If you get an error that partition cannot be found (usually when using rpuc for remote access), block kernel device needs to be mounted first:

bind -b '#S' /dev

This will mount /dev/sdM0 directory with partition devices on the sd card.

compile kernel

In /sys/src/9/bcm directory run the build command:

cd /sys/src/9/bcm
mk install

This will create new kernel image 9pi in /arm directory.

Don't forget to clean up AFTER installing the kernel:

mk clean

installing the kernel

It is a good idea to keep old kernel images around in case anything goes wrong, to restore the previous working state. Either rename old images to a new name and copy new images using the old name. Or Copy new images with a new name and edit the config file, selecting the kernel image. For example, we will copy new images with a new name and edit the config file to showcase where everything is.

The mounted pidos partition in /n/pidos should contain many files. This time we're interested in 9pi and config.txt (ignore the cmdline.txt that was edited during RPI 1 setup).