What version of Device OS did you install? 6.3.0 is recommended.
Are you running your own firmware, or just the default Tinker app? That panic can also be caused by a bug in user firmware. It's rarely a hardware failure.
When does the fault occur, right at boot or later? I presume since you're getting fault events, it's after cloud connection. A constant amount of time later? Does it coincide with a network change (Wi-Fi disconnection, for example).
And does it occur if you flash the default Tinker firmware instead of your firmware?
Hi, there are differences in hw and MCU from Argon to Photon 2, have you checked the migration guide just in case there is a pin that changed or something else?
The device is rebooting, so trying to figure out when that occurs would be helpful. The first step is to add
SerialLogHandler logHandler(LOG_LEVEL_TRACE);
and monitor the USB serial debug log and see what happens before it disconnects. That might help isolate where the problem is.
In any case, bus fault typically occurs when you are using invalid memory: overwriting a block of memory, using freed memory, using a null pointer. The problem with these bugs is that you will often crash later, not when the corruption occurred, and there's a certain randomness to it.
I have the same problem with a Photon 2 (OS version 5.9.0, which is the latest default). I get bus errors pretty randomly, even with the tinker firmware.
It seems to be happening when the Photon is trying to connect to the wifi network (looking at the serial logs with the TRACE log level):
See picture. In red, the last log I see when I get the bus error. I can reset the Photon a couple of time, and once in a while, it will connect to the wifi network correctly, then to the particle cloud, and then the firmware works well.
EDIT: I also get the bus error when I boot the photon in safe mode (magenta led).
I downgraded to OS version 5.6.0 (random version) and don't have the bus error anymore... Seems something related to more recent versions...
Yesterday evening I used 5.6.0, flashed the photon 2 about 30 times (during development) and never had the issue. Connection to wifi was ok everytime. Tried 5.9.0 again, crashed right away
Based on what @gxbene2025 said, 6.3.0 seems to have the same behavior as 5.9.0, this is why I downgraded the version instead of upgrade while trying to solve the issue
I can still try 6.3.0 tonight to clear this out, will report back
I confirm that 6.3.0 has the same behavior. As soon as I updated to 6.3.0, photon 2 is crashing in a loop while trying to connect to wifi (multiple times in a row).
Reverting to 5.6.0 fixes this problem. I will stay at 5.6.0 for now.
This should still be investigated for other users. Let me know if I can help with that.
EDIT: The problem seems to be related to the toolchain version, not the OS version itself. When setting the toolchain to 5.6.0, but with the Photon being at OS version 6.3.0, I don't have any issue (same for OS version 5.9.0)
That is somewhat surprising, thanks! That points to a problem in the ABI, the connection between the user firmware and Device OS, which can lead to a hard fault if there is a bug.