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

Mathy
Posts: 333
Joined: Mon Oct 05, 2009 2:39 pm
Has thanked: 30 times
Been thanked: 33 times
Contact:

Adding SSD1306 buffered optimization to the I2C component

Postby Mathy » Thu Feb 04, 2016 3:51 pm

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/viewtopic.php?f=56&t=14170&hilit=ssd1306&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
Has thanked: 30 times
Been thanked: 33 times
Contact:

Re: Adding SSD1306 buffered optimization to the I2C componen

Postby Mathy » Sun Feb 07, 2016 2:24 pm

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
Has thanked: 30 times
Been thanked: 33 times
Contact:

Re: Adding SSD1306 buffered optimization to the I2C componen

Postby Mathy » Thu Feb 11, 2016 12:17 pm

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: 14468
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4536 times
Been thanked: 4204 times
Contact:

Re: Adding SSD1306 buffered optimization to the I2C componen

Postby Benj » Thu Feb 11, 2016 3:24 pm

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.68 KiB) Downloaded 116 times

User avatar
Benj
Matrix Staff
Posts: 14468
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4536 times
Been thanked: 4204 times
Contact:

Re: Adding SSD1306 buffered optimization to the I2C componen

Postby Benj » Thu Feb 11, 2016 3:37 pm

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: 99
Joined: Tue Jan 05, 2010 10:07 am
Has thanked: 9 times
Been thanked: 22 times
Contact:

Re: Adding SSD1306 buffered optimization to the I2C component

Postby ronaldlijs » Wed Feb 06, 2019 10:48 pm

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: 14468
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4536 times
Been thanked: 4204 times
Contact:

Re: Adding SSD1306 buffered optimization to the I2C component

Postby Benj » Thu Feb 07, 2019 1:05 pm

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.