Jump to content

Pushing the I2C SSD1306 OLED to its limits


Larry Bank

Recommended Posts

I'm porting this code and my OLED animation to Armbian. It runs rather slow at 100Khz I2C speed. Has anyone found a way to easily change the I2C speed on Mainline kernel Armbian without doing a custom build?

Link to comment
Share on other sites

23 minutes ago, Larry Bank said:

Has anyone found a way to easily change the I2C speed on Mainline kernel Armbian without doing a custom build?

You could try using an overlay to add a "clock-frequency" property to the I2C controller node: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt

Link to comment
Share on other sites

12 minutes ago, zador.blood.stained said:

You could try using an overlay to add a "clock-frequency" property to the I2C controller node: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt

Sorry for being thick, but exactly what does that entail? Just adding a "param" line to armbianEnv.txt?

Link to comment
Share on other sites

3 minutes ago, Larry Bank said:

Sorry for being thick, but exactly what does that entail? Just adding a "param" line to armbianEnv.txt?

No. If you are using, for example, a H3 based device, a recent enough Armbian image and want to change frequency of the I2C controller 1, you need to install kernel headers, create a file (i.e. "i2c1-change-frequency.dts")

/dts-v1/;
/plugin/;

/ {
	compatible = "allwinner,sun8i-h3";

	fragment@0 {
		target = <&i2c1>;
		__overlay__ {
			clock-frequency = <200000>;
		};
	};
};

and add it via "armbian-add-overlay"

 

Or for testing purposes just decompile, change and recompile the DT in /boot/dtb using dtc. Since there will be no node labels you'll have to check the original DT for node names, i.e. I2C 1 node would be named "i2c@1c2b000".

Link to comment
Share on other sites

Thanks for the response. I took the path of least resistance and tested it on a Raspberry Pi Zero. On that platform I can edit the /boot/config.txt to change the I2C speed. It maxes out at 400Khz no matter what value you give it. That's fast enough to do decent animation:

 

 

I wrote a blog post and shared the code on github:

 

http://bitbanksoftware.blogspot.com/2018/05/practical-animation-on-i2c-ssd1306.html

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines