i2c changes from july? need code analysis help

I’ve decided to modify a code for an pretty old project, but after updating it with fresh spark.cli it now fails
I’ve reverted code changes, compiled again and it still not working

v60 - old binary compiled at 14.07.2014 - works
v67 - same code, new binary compiled at 30.09.2014 - works weirdly — LCD display info is mess, performance is slow, suspecting i2c functionality broken

Codebase: https://bitbucket.org/Ryotsuke/coffeerobot/src
v60 binary https://www.dropbox.com/s/hzw32xvedwqdqeo/coffee60?dl=0
v67 binary https://www.dropbox.com/s/wlqx7uygexjo129/coffee67?dl=0

Alright. So it seems like you are the 2nd user with I2C issues this week.

@satishgn and @mdma, are you guys able to review the I2C PRs and what’s going on?

@jgoggins or @dave, can we do a roll-back for now?

Yes, please do. This hangs now, but did not before -

while (!Wire.available()) ;
ret = Wire.read();

If I comment out the while line I get data, but not always correct data.

    //while (!Wire.available()) ;
    ret = Wire.read();

Why would Wire.available() hang and Wire.read return data?

Hey Guys,

I think Satish committed a fix for this, so I’m hoping we can roll that out with the next firmware release soon, sorry about that!


I’m also having trouble with Wire code (trying to read an Adafruit BMP180 and TSL2561 over i2c) that was working last month. I’ve traced it to the very first Wire.requestFrom (when initializing my i2c slave device) never making anything available to read. My own code (mostly cobbled together examples) doesn’t work, and neither does this (much simpler and easier to read and troubleshoot) example from @BDub https://gist.github.com/technobly/8342329

Jeff :smile:

@Jeff_Highsmith Yes, many of the I2C polling examples do not work. There was an update merged into the build to improve I2C speed using DMA, however that seems to have broken traditional ways of reading data from the I2C bus. There is another thread discussing the topic -

I have been told the plan is to release a fix in the next release on or around Oct 15. Till then if you want to get it working you will have to build locally with a version that has the code fix from @satishgn.

Oh and I thought my BMP180 was broken, then I didn’t get it to work with the first, then second AM2321 as well, so this is the reason!

Hope the fix will go smoothly this time.


I think I have a similar issue but the symptom is no cloud connectivity; would that make sense? My code worked fine a couple of weeks ago but now, after re-flash, I get no connectivity. If I flash with a simpler non I2C app using web IDE, the core works fine. Any input would be great before I lose it!! :smile:

Another “I2C was working, now isn’t” story here, coincidentally also with a BMP180.

Complication: I had initially wired up my breadboard wrong, and thought I had fried D0 and/or D1 by drawing too much current.

Troubleshooting steps: Verify BMP180 works (on Raspberry Pi); it does. Verify D0 and D1 work by using them to flash LEDs; works great.

Try code like:


This produces no level change on D0 or D1 (as verified with a 'scope).

P.S. I tried the above earlier this (15 October) evening, so I’m hoping that just means they went with the latter option in the “on or around” part of the release date. If not, I have some other problem.

Can anyone comment on whether it is possible to damage the Spark Core hardware in such a way that digitalWrite() on D0 and D1 work, but I2C doesn’t?

Sorry for the auto-followup, but: I built my own firmware locally, and @satishgn 's Pull Request 322 definitively fixes the problem for me. Getting good readings out of the BMP180 now.

Phew. Didn’t fry my core!


I’ve just got to try online code again. It works not but it is dramaticaly less reliable for me. I2C display with new code failed about 3 times in 9 minutes of code working, stoping all firmware (temperature readings stopped as well).
@satishgn @Dave @zachary

1 Like

Thanks for the heads up, just wanted to say that we saw this and the firmware team is looking into it. Sorry it doesn’t seem to be behaving as expected. You definitely changed your code and recompiled?


@ryotsuke is the display the only thing on the I2C bus? If so can you tell me what display / backpack it is and also would you be able to see if when isolating and running just the display code if this still exhibits the same failure rate?

When you say it failed and stopped all firmware… is there any more to the failure description that you can elaborate on? The observed failure is just that the code “locks up” essentially or is there more to it?

Full symptoms are:
Breathing cyan
No temperature is sent to server
Joystick cotrol not working
Lcd is a random chars with few pixels blinking

Code is in first post

There is lcd and voltage monitor on i2c, onewire temperature sensor, serial module and analog joystick, and a servo