SC16IS740 I2C Bridge Causing 1 or 15 Panic Blinks (Secure Fault?)

I'm developing a product that uses a SC16IS740 I2C bridge to communicate with a GPS module (BN-880). For power savings purposes, the GPS module is turned off initially, and power is sent to it when a reading is required. The serial bridge is powered all the time to avoid hot-connecting an I2C device.

In setup() I'm using Ricks excellent SC16IS7xxRK library to configure the serial bridge, and everything seems normal. After setup, when power is enabled to the GPS module, the device immediately hardfaults and gives either 1 or 15 LED blinks, but it's almost always 15 LED blinks (Secure Fault?)

If the GPS module itself is unplugged, or it is powered on all the time there is no crash.

I have a number of these boards, and some of them are not displaying this behavior.

Can anyone provide any insight into what would trigger a Secure Fault failure? Theres nothing mentioned on the Status LED and Device Modes - Photon | Troubleshooting | Particle page.

I'm pretty certain the issue is in my hardware, and I'm looking for any leads to help me find my issue.

SecureFault occurs when protected memory areas are accessed. It's almost certainly caused by accessing an invalid pointer.

The first step is to disconnect any libraries that process the data coming from the serial port to make sure the problem isn't on that side.

If it still crashes, then it could be in SC16IS7xx, in which case:

  • You're using I2C mode, correct?
  • Are you using buffered read mode, and what size buffer?
  • Is IRQ mode enabled? (This is almost never helpful to turn on.)
  • Are you able to run a powerOnCheck()? The GPS does not need to be on do this.

Good points, will try and let you know.

Interesting that it's happening on some boards but not others. I must have a race condition or something going on.