Adding SSD1306 buffered optimization to the I2C component

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
Mathy
Posts: 333
Joined: Mon Oct 05, 2009 2:39 pm
Contact:

Adding SSD1306 buffered optimization to the I2C component

Post by Mathy »

Hello,

I bought little Oled LCD who seems to be very great :)
But they are I2C and not SPI version.

I made some "i2c optimisation" to have a faster display but it is still not enought.
I don't have a very beautiful refresh rate.

I saw ont his topic http://www.matrixtsl.com/mmforums/viewt ... 6&start=50 that they are some optimisation made for the spi version to only write pixel values that have changed.
Is it possible to have the same optimisation on the simple I2C version ?

Thank you for your help :)

Mathy
Posts: 333
Joined: Mon Oct 05, 2009 2:39 pm
Contact:

Re: Adding SSD1306 buffered optimization to the I2C componen

Post by Mathy »

Hello,

Maybe I'm doing something wrong ?
I'm just trying to print numbers on the screen but I have to clear the display before print something everytime.
The result is I have some flickering.

I think the oled component I use need some optimisations made for the spi version to only write pixel values that have changed.
So i could print number without clearing the display but maybe I can make it right with another way ?

Thank you :)

Mathy
Posts: 333
Joined: Mon Oct 05, 2009 2:39 pm
Contact:

Re: Adding SSD1306 buffered optimization to the I2C componen

Post by Mathy »

Benj ?

Do you understand what I mean with my bad english ? :mrgreen:
I can explain it in an other way or try to make a little video to see why it is not as good as It could be.

Thank you :)

User avatar
Benj
Matrix Staff
Posts: 14929
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: Adding SSD1306 buffered optimization to the I2C componen

Post by Benj »

Hello Mathy,

Yes I understand your meaning. I have already had a quick look and meant to reply but must have got distracted onto something else.

I will go over the code again now and see if I can make any improvements.

....

Ok, I've looked now and the code is the same for the two components. Here is the latest exported component if you want to see if this improves things at all.
gLCD_SSD1306_i2c.fcpx
(8.67 KiB) Downloaded 163 times

User avatar
Benj
Matrix Staff
Posts: 14929
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: Adding SSD1306 buffered optimization to the I2C componen

Post by Benj »

Here is something you can try if the new component is not giving you and speed boost.

Go into the CAL I2C file and edit this section of code.

Code: Select all

  #ifndef MX_I2C_SW_DEL
	#define MX_I2C_SW_DEL
	#define MX_I2C_SW_BAUD	((500000 / MX_I2C_BAUD_X)-1)
	#if (MX_I2C_SW_BAUD < 1)
		#define MX_I2C_DELAY	delay_us(1);
	#else
		#define MX_I2C_DELAY	delay_us(MX_I2C_SW_BAUD);
	#endif
  #endif
to this, you may have to increase the number of nops until the comms works reliably.

Code: Select all

  #ifndef MX_I2C_SW_DEL
	#define MX_I2C_SW_DEL
	#define MX_I2C_SW_BAUD	((500000 / MX_I2C_BAUD_X)-1)
	#if (MX_I2C_SW_BAUD < 1)
		#define MX_I2C_DELAY	nop();nop();
	#else
		#define MX_I2C_DELAY	delay_us(MX_I2C_SW_BAUD);
	#endif
  #endif

ronaldlijs
Posts: 117
Joined: Tue Jan 05, 2010 10:07 am
Contact:

Re: Adding SSD1306 buffered optimization to the I2C component

Post by ronaldlijs »

Hi Ben et al,

For Flowcode 8, is there an SD1306 Buffered component for I2C at all? I have tried an I2C SSD1306 with an Arduino and it's got very slow referesh rate :-( Especially when pushing some bitmaps onto the screen...

Thanks,
R

User avatar
Benj
Matrix Staff
Posts: 14929
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: Adding SSD1306 buffered optimization to the I2C component

Post by Benj »

Hello,

Yes there is a buffered SSD1306 component in Flowcode 8 you can use the free 30 day trial to test it out.

As for only writing pixel values that change. On a monochrome display you usually control 8 pixels in one write operation. So all 8 pixel values would have to be unchanged to get any speed optimisation.

Post Reply