# \[Core\], i2c reboots core

**URL:** <https://community.particle.io/t/core-i2c-reboots-core/31551>\
**Category:** Troubleshooting\
**Created:** [April 11, 2017, 2:27am UTC](https://community.particle.io/t/core-i2c-reboots-core/31551 "2017-04-11T02:27:04Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Geekbozu](https://avatars.discourse-cdn.com/v4/letter/g/df788c/32.png) [@Geekbozu](https://community.particle.io/u/Geekbozu)\
**Post date:** [April 11, 2017, 2:27am UTC](https://community.particle.io/t/core-i2c-reboots-core/31551/1 "2017-04-11T02:27:04Z")

</div>

So I have a photon and a core, When I use the photon my code works. When i flip it out for the core with the same code it crashes and restarts. Code is below. Not really sure what is going on here.

Also using 4.7k resistors for pullups, have also tried 10k, I know the bus is functional as other i2c devices on the same bus still function.

```auto

 
int pic = 1;

void reqEv(){
  //RGB.color(0, 255, 0);
  if (pic != 0){
     //grab and send picture here. 
     
     Wire.write(255);
     Wire.write(0);
     Wire.write(0);
 }
}
void recEv(int bytes)
{
 // RGB.color(0, 0, 255);
    if (bytes >1){
    int a = Wire.read();
    switch(a){
        case 01:
            pic = Wire.read();
            
    }
    }

}

void setup()
{ 
  Wire.setSpeed(CLOCK_SPEED_100KHZ);
  Wire.begin(2);

  Wire.onReceive(recEv);
  Wire.onRequest(reqEv);
  RGB.control(true);
  RGB.color(255, 0, 0);
 }
 
 
void loop()
{
 delay(10);
}

```

Symptoms are the code runs through setup, Then seemingly when it gets an onReceive event it hangs and reboots (Led goes WHITE pulse -\> Green flash -\> Cyan flash -\> Breath -\> repeat)

---

<div class="post-metadata">

**Author:** ![Geekbozu](https://avatars.discourse-cdn.com/v4/letter/g/df788c/32.png) [@Geekbozu](https://community.particle.io/u/Geekbozu)\
**Post date:** [April 13, 2017, 1:34am UTC](https://community.particle.io/t/core-i2c-reboots-core/31551/2 "2017-04-13T01:34:42Z")

</div>

So a little more investigating. When ever I pull D0 low, after initializing the Wire interface the core freezes, then reboots.  
With out i2c being enabled the pin functions as normal.

---

<div class="post-metadata">

**Author:** ![Geekbozu](https://avatars.discourse-cdn.com/v4/letter/g/df788c/32.png) [@Geekbozu](https://community.particle.io/u/Geekbozu)\
**Post date:** [April 16, 2017, 4:36pm UTC](https://community.particle.io/t/core-i2c-reboots-core/31551/3 "2017-04-16T16:36:31Z")

</div>

So I went and got my second spark core by un-wiring it from its current home. It also exhibits the same symptoms ☹

Really stumped here

---

<div class="post-metadata">

**Author:** ![nrobinson2000](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/nrobinson2000/32/15624_2.png) [@nrobinson2000](https://community.particle.io/u/nrobinson2000)\
**Post date:** [April 16, 2017, 8:01pm UTC](https://community.particle.io/t/core-i2c-reboots-core/31551/4 "2017-04-16T20:01:52Z")

</div>

What version of the system firmware are you running on the core?

---

<div class="post-metadata">

**Author:** ![Geekbozu](https://avatars.discourse-cdn.com/v4/letter/g/df788c/32.png) [@Geekbozu](https://community.particle.io/u/Geekbozu)\
**Post date:** [April 16, 2017, 8:13pm UTC](https://community.particle.io/t/core-i2c-reboots-core/31551/5 "2017-04-16T20:13:59Z")

</div>

0.6.1

And I have tried a handful of others as well. No change.

---

<div class="post-metadata">

**Author:** ![BDub](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bdub/32/5137_2.png) [@BDub](https://community.particle.io/u/BDub)\
**Post date:** [April 16, 2017, 8:37pm UTC](https://community.particle.io/t/core-i2c-reboots-core/31551/6 "2017-04-16T20:37:49Z")

</div>

@Geekbozu can you try adding `interrupts();` to the end of setup() as seen here: [https://github.com/spark/firmware/issues/1136](https://github.com/spark/firmware/issues/1136)

---

<div class="post-metadata">

**Author:** ![Geekbozu](https://avatars.discourse-cdn.com/v4/letter/g/df788c/32.png) [@Geekbozu](https://community.particle.io/u/Geekbozu)\
**Post date:** [April 16, 2017, 9:09pm UTC](https://community.particle.io/t/core-i2c-reboots-core/31551/7 "2017-04-16T21:09:15Z")

</div>

@BDub No change. accidentally had the device turning on in master mode. In slave mode no change from original symptoms

---

<div class="post-metadata">

**Author:** ![Geekbozu](https://avatars.discourse-cdn.com/v4/letter/g/df788c/32.png) [@Geekbozu](https://community.particle.io/u/Geekbozu)\
**Post date:** [April 19, 2017, 11:54am UTC](https://community.particle.io/t/core-i2c-reboots-core/31551/8 "2017-04-19T11:54:23Z")

</div>

SO I also tried the develop branch from the repository, No change in behavior either. That being said I AM setup to compile locally now and will probably start poking around the firmware, still at a loss here 😕

With some preliminary poking it seems to not even enter the i2c intterupt handler, but I will also say I have not been able to solidly prove that yet. (that is with intterupts(); at the end of setup)

---

<div class="post-metadata">

**Author:** ![LulaNord](https://avatars.discourse-cdn.com/v4/letter/l/c0e974/32.png) [@LulaNord](https://community.particle.io/u/LulaNord)\
**Post date:** [April 20, 2017, 5:27pm UTC](https://community.particle.io/t/core-i2c-reboots-core/31551/9 "2017-04-20T17:27:44Z")

</div>

Hi…I have a core from the origional kickstarter project, however only recently have I had the time to sit down and play with the unit.  
I did a firmware update (including the depp firmware update) and setup with a basic breadboard and a DHT22 to capture temp/humidity, my code flashes fine and runs however it appears to never be able to display the data on either serial or the particle console.

[prototype pcb assembly](http://www.7pcb.com/Prototype-PCB-Assembly.php)

---

<div class="post-metadata">

**Author:** ![Geekbozu](https://avatars.discourse-cdn.com/v4/letter/g/df788c/32.png) [@Geekbozu](https://community.particle.io/u/Geekbozu)\
**Post date:** [April 22, 2017, 10:19pm UTC](https://community.particle.io/t/core-i2c-reboots-core/31551/10 "2017-04-22T22:19:16Z")

</div>

Pull request sent,

> <https://github.com/particle-iot/firmware/pull/1305>
