0

I have loaded the appropriate kernel modules and set them to load upon boot (i2c-dev and i2c_bcm2835). A call to lsmod confirms that they do indeed load on boot. But alas, I don't see any i2c devices appearing in /dev. There is no /boot/config.txt file in Alpine.

Has anyone else come across this problem before? What might a next step be to figuring out what's wrong? Thanks.

EDIT: I've been reading more... could this have anything to do with device tree?

1 Answer 1

2

You need to announce the I²C hardware to the i2c_bcm2835 module. It's not hardcoded, but controlled by the DTB loaded at boot. Add

dtparam=i2c_arm=on

to /boot/config.txt or /boot/usercfg.txt.

You may also need to load the module

Source: https://wiki.alpinelinux.org/wiki/Setting_up_lm_sensors

Load it once

modprobe i2c-dev

Make it permanent

echo 'i2c-dev' > /etc/modules-load.d/i2c.conf
6
  • 1
    There is no /boot/config.txt file in Alpine.
    – user91215
    Commented Oct 26, 2018 at 14:39
  • Then, either the boot partition /dev/mmcblk0p1 is not mounted by default, or you are running with the default configuration and simply had to create that file. But first check if it is mounted. Creating that file on the root partition will do nothing.
    – Janka
    Commented Oct 26, 2018 at 15:05
  • You're right, /dev/mmcblk0p1 is not mounted by default. Alpine is not persistent between boots--the entire system is loaded into RAM on boot. Should I just mount it anyway and make the file?
    – user91215
    Commented Oct 26, 2018 at 15:11
  • You have to edit that file on that partition. It's only needed for the built-in bootloader of the Raspberry Pi, you don't need to have it mounted when the system is up.
    – Janka
    Commented Oct 26, 2018 at 15:20
  • Alright, so I noticed that I was probably looking the wrong place for this config file. I was looking for /media/mmcblk0p1/boot/config.txt but there actually is a config.txt alongside a start.elf and cmdline.txt in /media/mmcblk0p1/ so I imagine that's the one. Upon adding the suggested line to the top of config.txt in that directory, I indeed got /dev/i2c-1!!! Thank you!
    – user91215
    Commented Oct 26, 2018 at 15:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.