Possible regression with I2C after move to pin control interface in Nordic Connect SDK 2.0.0

Nordic Connect SDK 2.0.0 moved to the use pin control interface, also for I2C.

When I tried to port some of my application I noticed a possible regression.

As a basis for one of my projects I used the "nrf52833dk_nrf52820" board and used an overlay file to compensate for the different pins that I use for the I2C interface.

I naively copied the following description from the c:\ncs\v2.0.0\zephyr\boards\arm\nrf52833dk_nrf52820\nrf52833dk_nrf52820-pinctrl.dtsi file and modified it according to my needs.

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

	i2c0_sleep: i2c0_sleep {
		group1 {
			psels = <NRF_PSEL(TWIM_SDA, 0, 28)>,
				<NRF_PSEL(TWIM_SCL, 0, 29)>;
			low-power-enable;
		};
	};

However I noticed that my application did not work any more, so I compared the changes that were introduced by the move to the pin control interface.

Long story short: with NCS 1.9.1 and before the I2C pins are configured by default and unconditionally with pull-up enabled and drive strength set to "S0D1", ie. standard 0, disconnect 1.

With NCS 2.0.0 this is no longer true, which is probably a good thing, however this may come as a surprise.

The board dtsi file does not have the necessary settings either, so I had to modify my overlay file to include the following:

	i2c0_default: i2c0_default {
		group1 {
			psels = <NRF_PSEL(TWIM_SDA, 0, 7)>,
					<NRF_PSEL(TWIM_SCL, 0, 30)>;
			bias-pull-up;
			nordic,drive-mode = < NRF_DRIVE_S0D1 >;
		};
	};

With these settings for the pull-up and drive strength configurations my application is now working again.

So the question is: Is this a regression comparing NCS 2.0.0 and NCS 1.9.1 and should these changes be added to the board dtsi files by default?

On the one hand every I2C bus may be differently set up, so in the end everybody is responsible for setting everything up correctly on their own.

On the other hand, using pull-up and S0D1 drive strength setting has been the default up to now and probably will work with most (if not all) I2C bus configurations you may encounter.

So what do you think?

Related