I2C arduino wire library mod success!!!

14 views
Skip to first unread message

Dan Bowen

unread,
Apr 28, 2012, 3:57:32 PM4/28/12
to white-sta...@googlegroups.com, uk...@googlegroups.com
Hello all,
Just wanted to announce that I've successfully tested a mod to the arduino 1.0 wire library that adds a timeout to the freeze-prone while() loops!  I'll put it on github as a separate repo shortly.  For now it is available here: https://github.com/whitestarballoon/Com-Controller/tree/SessionInitiationFixing/Libraries

I know the following debug output will be mostly meaningless to most of you, but the interesting bit is the line where it says I2C library returned error number: 5, and the fact that the arduino continues to operate past the I2C error.  If you're familiar with the Wire library, there is no error 5, that's the new timeout error code!  

Background on what is going on on the I2C bus to cause the freeze:
Some device is continuously holding the I2C data line low, and some other device(s) are constantly clocking the clock line.  In this snippet of debug output the arduino is trying to become master and send an I2C command to a slave device.  When using the standard wire library, the arduino freezes here every time in one of the Wire library while loops.

The arduino would normally just stay frozen after the comment about I2C Packet Length, until you reboot it manually.  Not even the watchdog timer would save it, (I tried it) because the wire library was disabling interrupts that the watchdog timer uses.

Here's the debug output:
TiCk-t 1:18:06:34  !
SAT-D 1:18:06:41  Unsolicited response: SBDRING
CC-D 1:18:06:41  Iridium Satellite Modem is ringing
SAT-I 1:18:06:41  Initiating Iridium Short Burst Data Session...
Sat-D 1:18:06:46  Got good +SBDIX respponse
Sat-D 1:18:06:46    messageOutboundXfer_status: 0, messageInboundXfer_status: 1, msgInb_len: 5, msgs_queuedAtGroundStation: 1
MessageContent from Iridium 9602 Modem ==--> 3a 5 f1 0 0 
CONTENT IS UPLINK COMMAND.  Command not for comm controller, route to I2C Bus!
I2C Packet length: 5
I2CTXERR
I2CTXERR
I2CTXERR
I2CTXERR
I2CTXERR
I2CTXERR
I2CTXERR
I2CTXERR
I2CTXERR
 I2C Library returned error number: 5
TiCk-t 1:18:08:07  !
SAT-D 1:18:08:07  Unsolicited response: 0
SAT-D 1:18:08:07  Unsolicited response: OK
SAT-D 1:18:08:07  Unsolicited response: +CIEV:0,3


Thanks,
Dan

stea...@gmail.com

unread,
Sep 7, 2012, 3:06:00 AM9/7/12
to uk...@googlegroups.com, uk...@googlegroups.com, white-sta...@googlegroups.com
Here to alleviate your i2c headache (hopefully), is the standalone lib plus instructions:

https://github.com/steamfire/WSWireLib

Also, I highly recommend a stream-storing logic analyzer such as the Logic 8 or bug logic 2.

Thanks,
Dan


Sent from my iPhone

On Sep 6, 2012, at 23:19, Troy Reabe <tomas...@gmail.com> wrote:

This sounds great, I have been having I2C lockups that have been driving me up the wall.
What does it take to put this into action and run it in the arduino invioment.
Do I just need to copy the Libary into the the folder or do what is needed to be done to do this?
 
Thank you and I look forward to working I2C
--
You received this message because you are subscribed to the Google Groups "UKHAS" group.
To view this discussion on the web visit https://groups.google.com/d/msg/ukhas/-/bgoD2T9cQ9gJ.
To post to this group, send email to uk...@googlegroups.com.
To unsubscribe from this group, send email to ukhas+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ukhas?hl=en.

Tim Miller

unread,
Sep 7, 2012, 4:53:34 AM9/7/12
to white-sta...@googlegroups.com

Any chance this fix will be submitted upstream to Arduino repo?

Nathan Armentrout

unread,
Sep 7, 2012, 8:40:36 AM9/7/12
to white-sta...@googlegroups.com
This is great! Thanks!!

stea...@gmail.com

unread,
Sep 7, 2012, 9:42:18 AM9/7/12
to white-sta...@googlegroups.com, white-sta...@googlegroups.com
I got it from nightly builds from a while back, but they rejected it in the final Arduino builds.


Thanks,
Dan


Sent from my iPhone
Reply all
Reply to author
Forward
0 new messages