I2C Speed and ticker interrupts

07 May 2010

Some of you will be aware that I have written an MSF locked clock for the MBed.

It uses a 16x2 LCD display to show the time and date which works perfectly.

I have decided to take this a step further and make use of a graphical LCD display to show the same data and some extra bits and pieces.

The graphical display in question is a ByVAC BV4512 whos datasheet can be found at http://www.byvac.com/downloads/datasheets/BV4512%20DataSheet.pdf

I have written a driver for the display modelled on the TextLCD-I2C library which seems to work fine except it does seem a little slow. My driver supports all the builtin commands (pixel, box, printchar, hline, vline) and some extra functions I have written in software like circle etc).

Once complete, I'll publish the code if anyone is interested.

Back to my clock............

My clock is ticker interrupt driven by a routine that fires every 10mS. Within this routine apart from keeping correct time by counting interrupts I also call printf to display the information on the TextLCD which works absolutely fine.

When I add similar printf's to write to the ByVAC display it works but everything slows down almost as though interrupts are being missed.

I guess its an overkill updating the display every 10mS anyway but are my problems indicative of an I2C problem or simply something to be expected with the way I am doing things?

Would I be better off setting up a seperate ticker interrupt routine to update the graphical LCD less often ?

If so how would the two ticker interrupts react together, would I still be in danger of loosing interrupts here and there ?

Persumably if one ticker interrupt has fired the other cannot fire until the first has returned ?

Regards

Lynton

 

24 Dec 2010

Could be just the I2C speed.  The display is 128 x 64 bits, so to rewrite the entire display is 1024 bytes.  One byte takes about 10 clocks on I2C, so that's about 10,000 clocks.  If you're running the bus at 100kHz that will take 1/10 second (100ms).  At 400kHz, still 25ms. 

So to update the display in 10ms you need to be sending only changed bytes, or only update part of the screen in each tick.

The microprocessor does have an I2C channel (0) which can run at 1MHz -- but unfortunately MBED does not bring that out to pins.

Mike