SparkFun Inventor's Kit for Photon Experiment Guide
Appendix: Troubleshooting
Flashing in Safe Mode
Are you having trouble flashing new code to your Photon? Try booting it up into safe mode, and flashing again.
To put your Photon RedBoard into safe mode:
- Hold down RESET and MODE.
- Release RESET, but continue holding MODE down.
- When the RGB LED blinks pink, release the MODE button.
The Photon RedBoard will dance through its WiFi and Particle Cloud connecting process. Once connected, it will begin to breathe pink, indicating it's in safe mode.
In safe mode, the Photon won't run your application. All it does is maintain its connection to the Particle Cloud. Find out more about safe mode in Particle's Device Mode documentation.
If safe mode works, but uploading in run mode didn't, double check your application code to make sure there aren't any infinite loops. The Photon RedBoard maintains its communication with the Particle cloud during delay()
calls, or at the end of a loop()
. If you have any while(1)
-type loops in your code, sprinkle a Particle.process()
in to avoid any future flashing troubles.
Modifying the WiFi Configuration
If you've taken your Photon RedBoard somewhere new, and need to connect it to a different WiFi network, you can use the MODE button to enter new WiFi settings.
To erase stored WiFi credentials while the Photon is running, hold down the MODE button until the RGB LED begins to blink blue. At this point, the Photon will be back in listening mode. You can use the Particle app, serial terminal, or Particle CLI to update your WiFi credentials.
If, for any reason, the above method isn't working for you, try following these steps to get into listening mode:
- Hold down RESET and MODE.
- Release RESET, but continue holding MODE down.
- When the RGB LED blinks white, release the MODE button.
- It'll take about 10 seconds before it blinks white. The RGB will blink pink, yellow, and green before then.
Serial Monitor Locked Out
If your terminal program won't let you open the serial port -- citing an error like: COM port in use. Or if the COM port has disappeared from a selectable list, try following these steps:
- Close the serial terminal program.
- Reset your Photon RedBoard
- Wait for the Photon RedBoard to connect to WiFi
- Open the terminal program back up and try connecting.
This usually occurs when the Photon RedBoard resets while the terminal program is still open and connected. If you're uploading a new program to the Photon RedBoard, or just hitting the RESET button, ** manually disconnect your serial port** before doing so.
Serial Monitor Pausing
In some cases, particularly on Windows machines, your Photon or Photon RedBoard may cause your serial terminal to quit unexpectedly. The board will begin sending data to the serial port once it has an Internet connection, and the serial termninal may not be able to handle the incoming data.
To pause the sending of data until a serial connection has been made AND until the user sends any key press to the Photon RedBoard, add this code to your setup()
:
language:c
// Make sure your Serial Terminal app is closed before powering your device
// Now open your Serial Terminal, and hit any key to continue!
Serial.println("Press any key to begin");
//This line pauses the Serial port until a key is pressed
while(!Serial.available()) Particle.process();
It is worth noting that this line used to be: while(!Serial.available()) SPARK_WLAN_Loop();
. Should you ever come across an example using that line, you will need to update it to the Spark.proccess()
line above.
Firmware Updates
Periodically, Particle will release firmware updates for the Photon RedBoard's P1 module. These usually include bug fixes, or other changes that'll make your life easier.
You can use the Build IDE to view and control what firmware you're writing for. Navigate over to the device tab, and click the carrot next to your Photon. A dropdown will indicate the firmware you're building for. The latest is always recommended.
If you want to get a jump on running the latest firmware, the easiest method for updating to it is to go through Particle's command line interface -- Particle CLI.
With Particle CLI installed, place your Photon into DFU mode, by performing the MODE/RESET device mode switch and releasing MODE when the RGB blinks yellowish-orange. Then issue this command on the command line:
particle update
That's it! Your computer will download the latest firmware, then flash it over USB to your Photon RedBoard.