UNO Q: Wire1 to ssd1327 - what is fastest I2C speed?

For the heck of it, I pulled out one of the QWIIC displays I purchased.
It is an SSD1327 sold by Sparkfun:
Zio Qwiic OLED Display (1.5inch, 128x128) - SparkFun Electronics

I thought I would use the Aeafruit _SSD1327 library, with their one
Example sketch: SSD1327_test.ino.

I needed to edit the example sketch to use Wire1 instead of Wire:
Adafruit_SSD1327 display(128, 128, &Wire1, OLED_RESET, 1000000);

the begin method from: 0x3d to 0x3c
if ( ! display.begin(0x3C) ) {

Uploaded it using Arduino IDE, and the display is crawling along:
I have KiTTY window opened connected to Serial1 (through USB To Serial adapter).

And I was getting endless Error messages:

[00:10:04.703,000] <err> i2c_ll_stm32_v2: i2c: speed above "fast" requires manual timing configuration, see "timings" property of st,stm32-i2c-v2 devicetree binding
[00:10:05.407,000] <err> i2c_ll_stm32_v2: i2c: speed above "fast" requires manual timing configuration, see "timings" property of st,stm32-i2c-v2 devicetree binding
[00:10:06.087,000] <err> i2c_ll_stm32_v2: i2c: speed above "fast" requires manual timing configuration, see "timings" property of st,stm32-i2c-v2 devicetree binding
[00:10:06.742,000] <err> i2c_ll_stm32_v2: i2c: speed above "fast" requires manual timing configuration, see "timings" property of st,stm32-i2c-v2 devicetree binding
[00:10:07.392,000] <err> i2c_ll_stm32_v2: i2c: speed above "fast" requires manual timing configuration, see "timings" property of st,stm32-i2c-v2 devicetree binding
[00:10:08.037,000] <err> i2c_ll_stm32_v2: i2c: speed above "fast" requires manual timing configuration, see "timings" property of st,stm32-i2c-v2 devicetree binding
[00:10:08.890,000] <err> i2c_ll_stm32_v2: i2c: speed above "fast" requires manual timing configuration, see "timings" property of st,stm32-i2c-v2 devicetree binding
[00:10:09.743,000] <err> i2c_ll_stm32_v2: i2c: speed above "fast" requires manual timing configuration, see "timings" property of st,stm32-i2c-v2 devicetree binding
[00:10:10.595,000] <err> i2c_ll_stm32_v2: i2c: speed above "fast" requires manual timing configuration, see "timings" property of st,stm32-i2c-v2 devicetree binding
[00:10:11.448,000] <err> i2c_ll_stm32_v2: i2c: speed above "fast" requires manual timing configuration, see "timings" property of st,stm32-i2c-v2 devicetree binding
[00:10:12.276,000] <err> i2c_ll_stm32_v2: i2c: speed above "fast" requires manual timing configuration, see "timings" property of st,stm32-i2c-v2 devicetree binding
[00:10:13.080,000] <err> i2c_ll_stm32_v2: i2c: speed above "fast" requires manual timing configuration, see "timings" property of st,stm32-i2c-v2 devicetree binding

Which I know that is being output from Zephyr:
In the function:
int i2c_stm32_configure_timing(const struct device *dev, uint32_t clock)

	default:
		LOG_ERR("i2c: speed above \"fast\" requires manual timing configuration, "
			"see \"timings\" property of st,stm32-i2c-v2 devicetree binding");
		return -EINVAL;

I updated the example to comment out the 1mhz speed and the library
defaults to 400k, which runs and I no longer see those error messages.

Question, is what is the fastest speed it supports?
I am guessing 400k

However it looks like the hardware maybe supports up to 1Mhz:

65.2 I2C main features
β€’ IΒ²C-bus specification rev03 compatibility:
– Target and controller modes
– Multicontroller capability
– Standard-mode (up to 100 kHz)
– Fast-mode (up to 400 kHz)
– Fast-mode Plus (up to 1 MHz)
– 7-bit and 10-bit addressing mode

I will look through the device tree to see if there are any timing properties.

Side note: I wonder if the function i2c_stm32_configure_timing in
zephyr\drivers\i2c\i2c_ll_stm32_v2.c should bail out with an error if one
asks for a higher speed than it can support, maybe it should instead
do LOG_WRN and maybe setup to the highest speed supported.
But that is probably beyond the scope of this question.

Thanks

My understanding is 400K

Which β€œit” are you referring to?

The I2C spec from NXP says that an I2C bus can operate at up to 5Mbit/s, however the SSD1327 datasheet says that it only supports up to 400kHz. That will be your limiting factor.

Thanks @sonofcy and @markd833,

Yes, it appears like the Wire object is throttled to a max of 400K within the
Zephyr setup. I fully understand that not all hardware can go beyond that speed.

It is defined within Zephyr in the file:
.../zephyr/boards/arduino/uno_q/arduino_uno_q-common.dtsi

&i2c4 {
	status = "okay";
	pinctrl-0 = <&i2c4_scl_pd12 &i2c4_sda_pd13>;
	pinctrl-1 = <&i2c4_scl_pf14 &i2c4_sda_pf15>;
	pinctrl-names = "default", "sleep"; /* TODO: sleep is jmisc mux */
	clock-frequency = <I2C_BITRATE_FAST>;
};

With <I2C_BITRATE_FAST>
And that is defined in the file: zephyr/include/zephyr/dt-bindings/i2c/i2c.h


#define I2C_BITRATE_STANDARD	100000	/* 100 Kbit/s */
#define I2C_BITRATE_FAST	400000	/* 400 Kbit/s */
#define I2C_BITRATE_FAST_PLUS	1000000 /* 1 Mbit/s */
#define I2C_BITRATE_HIGH	3400000	/* 3.4 Mbit/s */
#define I2C_BITRATE_ULTRA	5000000 /* 5 Mbit/s */

So for the fun of it, I might try rebuilding with I2C_BITRATE_FAST_PLUS
And see what happens.

Note: AFAIK, the Wire object does not know what device is connected to it, so I pretty sure
it does not limit you from trying to go faster, other than maybe failing the communications.
Note: I am disregarding the case where the device connected to it is defined in the device
tree under the I2c object, like, which camera might be built into the device tree, example:

&i2c3 {
	status = "okay";

	hm01b0: hm01b0@24 {
		compatible = "himax,hm01b0";
		zephyr,deferred-init;
		reg = <0x24>;
		status = "okay";
		reset-gpios = <&gpioe 3 GPIO_ACTIVE_HIGH>;
		pwdn-gpios = <&gpiod 5 GPIO_ACTIVE_HIGH>;
		data-bits = <4>;
		port {
			hm01b0_ep_out: endpoint {
				remote-endpoint-label = "dcmi_ep_in";
			};
		};
	};
};

This is from a native zephyr test apps I have, that I am currently testing out my
changes to the HM01B0 camera device driver in Zephyr. But that is off topic
(Zephyr Native and testing on Portenta H7)

Thanks again!
Kurt