Photon locks up with minimal I2C code

I’m trying to get I2C communications from an Arduino Due to a Photon and am running into problems. Using the example [here][1], I verify the code and then flash. As the Photon reboots, it flashes green and then goes to solid cyan. I then enter Safe Mode and re-flash Tinker OTA to start over.

Troubleshooting consisted of starting with a blank sketch - empty void loop and void setups. One by one, I began adding things back one by one.

First, I added #include “application.h”, verified and flashed. Good.
Next, I added Wire.begin(9); verified and flashed. Good
Next, I added Wire.requestFrom(8, 6); verified and flashed. Lockup.

I repeated this process a couple times, just to sanity-check myself and I am able to reproduce the issue consistently.

As of this post, I have nothing connected to the Photon (other than the micro-USB going to an adequate power supply).

Here’s the code I’m using:

#include "application.h"

// Master Reader running on Device No.1 (Use with corresponding Slave Writer running on Device No.2)

void setup()
  Wire.begin(9);              // join i2c bus as master

void loop()
//  Wire.requestFrom(8, 6);    //<--- this is what locks up the Phton
    //char c =;    // receive a byte as character


Please forgive me if I’ve left out anything that would be helpful, and thank you for any insight you can provide.

I believe that Wire.begin(9) specifies I2C slave mode. But Wire.requestFrom() can only be used in master mode. I think you should use the version of Wire.begin() that doesn’t take a parameter.

1 Like

Thanks @rickkas7, that was my problem!

Now, on to expanding the code to actually do something!

I’m still struggling with the basics of I2C communications, so if anyone knows of any tutorials/examples that I haven’t found in my searches, I’d owe you a cold one!