B524 misbehaving D1 and cloud connection

Hello,

I received from my client a B524 (from B523) on a board I designed for them a year or so back.

I got it with the problem description that D1 using pinMode(D1, OUTPUT) and digitalWrite(D1, n) does not work on any of the board since switching to B524, while other pins D2-D6 work as expected and was asked to troubleshoot.

However, while I was able to download code to the board (DFU) without error, the new code did not seem to take effect whatever I tried, so I generated new keys, claimed the board to my account and updated the firmware to attempt cloud compile/upload instead of DFU, but noticed that the cloud connection was very sketchy - sometimes it connects fast, sometimes it’s stuck in green flashing, alot of the time it connects but quickly goes back to green flashing several times over until it sometimes becomes stable, sometimes not until rebooted a few times. Initiating the device using the Particle app often fails in various ways and sometimes takes a very long time.

Right now, it reports being connected to the cloud (tinker sketch programmed) and is reported as connected and “heard from” just now - but during my hours of troubleshooting it has never responded to ping, signal, tinker commands or firmware download attempts.

Since I am unable to download my own code for testing I would like to know if anyone has any ideas on why D1 might not be working as an output? The sample sketch I sent them does nothing beyond pinMode and digitalWrite (no serial, no other peripherals used).

I would also love to hear your thoughts on why it might (unstably) connect to the cloud but not respond to any commands and not reporting vitals?

Best,
Dave

My guess is that the B524 has SystemPowerFeature::PMIC_DETECTION enabled on it. If it was set up in the eval board, it probably does have this set.

The problem is that the PMIC and Fuel Gauge connect by I2C, so if you enable PMIC detection, it will enable I2C on Wire, which is pins D0 and D1, which prevent those pins from working as GPIO.

I’d also put the device in listening mode (blinking dark blue) and do a

particle serial inspect

If there’s a system dependency missing, this will show it. That’s the most common reason for user firmware not running. The other is that the device is in a product and not marked as a development device, so as soon as it connects to the cloud, it gets flashed the default product firmware.