Multiple I2C device - gadgeteer and not gadgeteer

Hello all,
I try to use 2 gadgeteer I2C modules (pulseInOut and touch"C8") and 1 non gadgeteer Midas display on my Fez Hydra.

It seems there is problem between display and “touchC8”. Before discribing my tests, I’ve a general question :
There is only one I2C bus. In the GHI example [url]https://www.ghielectronics.com/docs/12/i2c[/url] , both configuration use the same speed. Is it mandatory ? If yes, how can i read the speed and adress automatically configured for gadgeteer modules ?

Thanks.
Arnaud.

You can use whatever speed on each device’s configuration, as you swap the config in before expecting to talk to the bus. But you may introduce issues on a device if it doesn’t handle that change in speed (most should) but often you might be better to pick the highest maximum for the slowest device and use that, or at least test initially at something not too far above that.

As far as Gadgeteer modules, you can just dig into the code. https://bitbucket.org/ghi_elect/gadgeteer/src

Thanks Brett,
it’s a good news.
TouchC8 seems to use 100 (bit/s ?), while my display 200. I’ll check tonight.
Arnaud.

if it’s 100 and 200, then you’ll likely be fine with 200 :slight_smile: Good luck and let us know what your testing shows!

Hello,
At 100 or 200 kHz for I2C clock, it’s the same.
Following test à 100 kHz :
remind : I want to use 3 I2C devices, must it doesn’t work, so I reduce :
TouchC8 and PulseInOut : ok.
PulseInOut and Midas display : Ok.
TouchC8 and Midas display : NOK.

If I only send 2 commands to the display (for config), I succeed to use touchC8.
But when I want to send a third command to the display( ‘clear’, ‘Home’ or a text …), every thing seems to stop.
In debug mode, the programm never reach this third command, a “System.NullReferenceException” occurs just before, on the line to swap my I2C config ! :frowning:
I’ve tried to send this command just after config, or after a few second, or after other instructions etc… it never works properly.

All my display managment functions work if I remove touchC8 and associated functions from the project.

besides the setup calls, can you share a code snippet that works / doesn’t work? Did you try swap interspersing commands for each device amongst the other, eg issue one display setup command, one touch command, another display, another touch, another display…

Hello,
since there is no real direct command that I can send to touch C8, I changed the place of touchC8 events construction ( like

 ).
My first test was only TouchC8 with pulseInOut, without any declaration nor hardware connection of the midas display.
With or without event declaration position change, it was worst ! There was 1 second latency time between touching C8 and result (light debug led), while it was very fast yesterday.

As I've decided to exclude touchC8 from my project (before your last reply), I've started heavy hardware modifications. So my hardware config is not ready to use display again to fulfill these tests quickly.

But I've found an answer to my main question about I2C speed managment.
I've also learn that instruction order can have an unexpected effect.
So I consider this post closed, thank you !

And I got new bad elements about touchC8 : It seems not easy to get reliable operation of it.