Invalid I2C pin configuration (pinctrl) in NCS v2.0.0

Hello. After switching to NCS v2.0.0, we started observing a strange I2C issue - some sensors did not communicate whatsoever, and some sensors worked just fine. Further analyzing this, the problem was that there was a high voltage for the log. 0.

See the waveform and the "third state" on the green line (SDA):

This is an I2C read sequence and you can see the slave device cannot overdrive the master, which master is actively driving log. 1 to the SDA line.

The fix is to alter the pinctrl settings and switch SDA + SCL lines to open-drain mode.

Original code:

	i2c0_default: i2c0_default {
		group1 {
			psels = <NRF_PSEL(TWIM_SDA, 0, 21)>,
				<NRF_PSEL(TWIM_SCL, 0, 20)>;
		};
	};

Fixed code:

	i2c0_default: i2c0_default {
		group1 {
			psels = <NRF_PSEL(TWIM_SDA, 0, 21)>,
				<NRF_PSEL(TWIM_SCL, 0, 20)>;
			nordic,drive-mode = <NRF_DRIVE_S0D1>;
		};
	};

Our original configuration was inspired by other dtsi / pinctrl examples in the NCS v2.0.0 tree. Apparently, all of them do not use the open-drain drive, and despite the slave might "seem to work", from a hardware perspective this is quite a critical misconfiguration. Not only this problem increases the power budget for the I2C transaction, but it might also exceed the slave chip specifications.

When the chip has a slightly weaker drive strength than nRF52, the logic threshold might be on the edge and the system may work in an unpredictable manner.

Thank you. P.

Parents Reply Children
No Data
Related