When I boot my Raspberry Pi 3 GPIO port 2 (SDA.1) is in mode "IN" instead of "ALT0". This prevents I²C communication and causes
i2cdetect -y 1 to wrongly show all addresses. As soon as I set the correct mode for the port (
gpio -g mode 2 alt0) the I²C hardware and
i2cdetect work as expected.
On fresh Raspbian installations the mode is "ALT0" on startup. So I think there's something wrong in my current configuration. I checked
- If there is a driver configuration in /etc/modprobe.d regarding this
but couldn't find anything that switches the GPIO mode on startup. So it could be a driver or an init.d script. How can I find out where the mode is switched as quick as possible?
Note: The common assumption on the web is a hardware failure if
i2cdetect shows all addresses, however a wrong mode could cause the same. I'm telling this here, because others may draw wrong conclusions like me. So don't change / throw away your Raspberry before having checked the correct mode "ALT0" being set for GPIO ports 2 and 3 by calling the
gpio readall command!