Forcing events in firmware

Hi All-
I’m working through some very intermittent SD card connection issues. I have been monitoring the events logged to the console to see if there are any patterns of things that could cause a failure to try and find a ‘smoking gun.’ On a recent failure, the events showed the SD card working fine, then what looks like a loss of connection, followed by the typical diagnostic/system events:

  • particle/device/updates/enabled
  • particle/device/updates/forced
  • particle/device/updates/pending
  • spark/device/diagnostics/update

As part of my troubleshooting/experimentation, I’d like to trigger these events intentionally in the firmware to see if they might cause an issue with the way I’m using the SD card.

Here is the very simple firmware that I’m using for testing:

I saw another forum post asking a similar question, but their solution was different than what I’m trying to do.

Any ideas on how I might accomplish this? Thanks!