Larry Bank Posted May 6, 2018 Share Posted May 6, 2018 I wrote a blog post about speeding up drawing on the SSD1306 display by bit-banging the I2C protocol. The code is for Arduino, but it has useful info about my iterative process of optimizing code that some of you may find interesting: https://bitbanksoftware.blogspot.com/2018/05/fast-ssd1306-oled-drawing-with-i2c-bit.html Link to comment Share on other sites More sharing options...
Larry Bank Posted May 22, 2018 Author Share Posted May 22, 2018 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 More sharing options...
zador.blood.stained Posted May 22, 2018 Share Posted May 22, 2018 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 More sharing options...
Larry Bank Posted May 22, 2018 Author Share Posted May 22, 2018 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 More sharing options...
zador.blood.stained Posted May 22, 2018 Share Posted May 22, 2018 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". 1 Link to comment Share on other sites More sharing options...
Larry Bank Posted May 24, 2018 Author Share Posted May 24, 2018 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 2 Link to comment Share on other sites More sharing options...
Recommended Posts