Thank you very much for that tip. That did the trick in combination with my initial device tree overlay. I2C now works.
I then tried to analyze if I can get the &i2c1
version to work. Reading about your two links I now understand that these &[node]
things are semantic sugar to extend other nodes. I then tried to use that in combination with the hardware.i2c.enable = true
but I still had no success as I already predicted since this doesn’t change the dtb file (I already analyzed this in my last post). I then tried to remove the -i2c
suffix and still had the hardware.i2c.enable = true
set which works now. So
I2C TL;DR
To enable i2c on a raspberry pi zero, use:
hardware.deviceTree = {
enable = true;
overlays = [
{
name = "enable-i2c1-device";
dtsText = ''
/dts-v1/;
/plugin/;
/ { compatible = "brcm,bcm2835"; };
&i2c1 { status = "okay"; };
'';
}
];
};
hardware.i2c.enable = true;
WIFI
I now also wifi to work by either
wpa_supplicant:
hardware.firmware = [ pkgs.raspberrypiWirelessFirmware ];
networking = {
wireless = {
enable = true;
networks = {
[SSID] = {
psk = "[PSK]";
};
};
};
};
or using iwd
:
systemd.services.iwd.serviceConfig.Restart = "always";
hardware.firmware = [ pkgs.raspberrypiWirelessFirmware ];
networking = {
networkmanager.wifi.backend = "iwd";
wireless.iwd.enable = true;
};
boot.extraModprobeConfig = ''
options cfg80211 ieee80211_regdom="DE"
'';
And then connect to the wifi using the following commands:
$ iwctl
# list
# station wlan0 scan
# station wlan0 get-networks
# station wlan0 connect [ssid]
This will save the config for the next boot to: /var/lib/iwd
.