paul42
Posts: 26
Joined: Mon Nov 26, 2012 5:38 pm

Using 2 threads with i2c

Tue Feb 05, 2013 7:33 pm

I have 2 pcbs on my i2c buss on different addresses. I want to talk to each from a separate python thread.

Will the Quick2wire i2c module take care of near simultaneous writes to the buss or must I use a single thread to keep things in order?

Thanks Paul

User avatar
joan
Posts: 14936
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Using 2 threads with i2c

Tue Feb 05, 2013 7:50 pm

I don't know but it sounds like a bad idea. "Hardware/firmware" is best used by one chunk of "software" at a time.

techpaul
Posts: 1512
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
Contact: Website

Re: Using 2 threads with i2c

Tue Feb 05, 2013 7:51 pm

As it is a bus, it should be possible as the driver queues the transactions internally.

Why not try it anyway
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/

paul42
Posts: 26
Joined: Mon Nov 26, 2012 5:38 pm

Re: Using 2 threads with i2c

Tue Feb 05, 2013 8:05 pm

I will give it a try. One thread reads an 8 ch ADC & the plan is for the other to write to a 16 x 4 line lcd.

Currently I write to the lcd using the onboard serial but the system crashes after a couple of days. I am running a test now with the serial disabled to prove that's my issue.

I can use either for the lcd as I am using the Hobbytronics lcd backplate.

At first I thought my crashes were due to the usb serial cable to the mobile phone my program uses to send & receive texts, but I have had it running a test program accessing the phone every minute for just over 3 days with no problems.

Paul

Return to “Python”