I am very new to Photon but large experience with arduino (duecimilia, Uno and YUN). After digging to try to help on internet connectivity and MQTT I found Particle Photo.
I immediatelly bought a pair of it and started to play with. Wondefull recognition on the android app, fast connection to the WiFi in both place. Perfect so far.
Then I tried a few sample from the web site before going on my own sketch. A simple sketch which take temperature and humidity from a DHT11 sensore (library from adafruit), and then sending both mesures on 2 topics on a mosquitto MQTT server (sitting in a raspberry pi) and with 2 Particle.publish as debug stream.
It worked fine for several minutes (except for the MQTT) then it started connecting and discinnecting and then going crazy.
I started to reset the Photon, but nothing !! I wanted to upload a new sketch (blink_led) and everything goes OK apparently except that it does not upload anything. Reboot the Photon, same story. Unable to upload any new sketch. And going crazy with the current sketch (going on and off line).
I did a safe mode (both reset + mode button, release mode when magenta blinking) nothing changed. After several trial, the Photon started blinking red. I then downloaded the latest firmware from the web site, putted the Photon in DFU mode and reflashed the 2 files. Everything went OK, no errors, rebooted the Photon. It worked for 3 minutes with the blink-led sketch and then started blinking the red SOS then 5 times.
Unfortunatelly, not at all. Just get the temperature and humidity using the standard library methods and sendig them to MQTT and Particle.publish. A fairly simple sketch. A sketch that works well on a YUN.
I have’nt been though the cpp and .h files, expecting that they where working fine. I used the adafruit:dht library and the standard MQTT library. The one provided by the build.particle.io interface.
The YĂşn copes differently with DIV/0 than the STM32F does. So that's not a valid argument against DIV/0 to be the possible cause of your troubles.
Also user contributed libraries may contain bugs.
Possible reasons for a Usage Fault (SOS+5) are
Could you post your code?
What syste, version are you targeting?
Basically, I mess up with the code, the save, save as, and automatic save on compiling. Therefore I need to retype the code. Basically, this sketch was
2 include for MQTT.h and adafruit_DHT
Declaring analog port for DHT
Declaring DHT type
Define MQTT server and callback
Declaring 2 str variable
In setup
MQTT.begin
-DHT. begin
In loop
dht.readHumidity();
-dht.readTemperature();
Particle.publish Temperature // Logging
Particle.publish Humidity //Logging
client.publish temperature // MQTT
client.publish humidity //MQTT
That’s it.
The version used was the default web editor with a 0.6.0 firmware.
To post code here, just wrap your code block in between a set of these
```cpp
// code here
I've added a set of these at the end of your post which you can use to place your code in via the edit :pencil2: feature for your own posts
Without your own code we may not be able to help any further.
As I mentioned above, while trying to reload a sketch, I messed up with the interface and the blink_led sketch override my previous sketch.
With my experience, since I re-flashed the firmware, I don’t understand why this is still continue to blink red !!! I don’t believe that my previous sketch was still in memory after a firmware reflash !!!
My personnal opinion is that the Photon will be a great stuff and can seriously compete against arduino family. But, not today.
I will bin this Photon since I believe he is dead for God knows what reason. I will keep having an eye on the development and will try again later.
In the mean time, I will continue with my Yun and Uno WiFi.
Many thanks for your help and your time that I really appreciated.
You cannot break the Photon with code only.
If you haven’t done anything that fried it in hardware, I’m pretty sure it’s not dead and shall not be binned.
You can always take off any external circuitry and try this in DFU Mode
particle update
particle flash --usb tinker
then clear the credentials by holding down SETUP for 10+ seconds till you get rapid blue flashing and reenter the creds.
This way you should have a Photon that’s as good as new (if there was no undisclosed HW lapse that led to this originally )
In fact I have not binned the photon yet. What I am the most surprised of, is that I have a second one, just exactly the same, and this one behave “normally” still I have no MQTT feed but I will check my code.
And, to be frankly honest, I am still convinced that the Photon is still the best micro controller.
I will try to DFU it but need to order the programmer. Will let you know.
Unfortunately, I have not been so far on how to completely reflash the Photon. I did a firmware reflash twice usinf dfu-util and pressing the buttons accordingly. I could reflash the firmware with absolutely no error messages but once rebooted, the Photon was still complaining and blinking this SOS + 5.
fxleytens@fxlmain /usr/local/bin $ sudo ./particle update
> Your device is ready for a system update.
> This process should take about 30 seconds. Here goes!
! System firmware update successfully completed!
> Your device should now restart automatically.
> You may need to re-flash your application to the device.
fxleytens@fxlmain /usr/local/bin $
After that, it rebbot and start blinking SOS +5 red again.
The output of : particle flash --usb tinker
fxleytens@fxlmain /usr/local/bin $ sudo particle flash --usb tinker
Found DFU device 2b04:d006
spawning dfu-util -d 2b04:d006 -a 0 -i 0 -s 0x080A0000:leave -D /usr/local/lib/node_modules/particle-cli/binaries/photon_tinker.bin
dfu-util 0.8
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2014 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to dfu-util@lists.gnumonks.org
dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 2b04:d006
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 4096
DfuSe interface name: "Internal Flash "
Downloading to address = 0x080a0000, size = 3952
Download [=========================] 100% 3952 bytes
Download done.
File downloaded successfully
Flash success!
fxleytens@fxlmain /usr/local/bin $
And it stopped the red SOS + 5 blinking.
It lok like that my Photon is back to life !!!
Many many thanks.