Photon and Bluz firmware updating issues


#1

So I’m currently working on trying to restore gateway functionality to my Photon that will be mounted on a Bluz Gateway Shield. I had been having lots of problems many months ago and had walked away.

So I started by reflashing the Photon using the CLI and I thought things were going ok because I have been able to setup wifi and I can I see it show up in the particle dashboard when it’s plugged in.

My current issues are that when I try to compile and flash the gateway code onto the Photon I get errors on everything I try. It seems like the errors also change depending on what System Firmware Target I select. Of course I want to get on the latest firmware 2.2.50. I also have never seen the Photon respond to the Signal request.

So I started with this similar issue and was following along:
https://neighborhood.bluz.io/t/errors-in-gateway-library/706
When I noticed that the Photon is showing up as a Bluz device and it have a Bluz Device:

But this is a Photon device. How could that have been messed up? What can I do to restore it to be the photon that it is?


#2

Hmmmm, so I do see a device with that ID listed under bluz, it says it was last online last June. Interestingly, it seems to indicate it is still online.

Are you sure that his is the Photon device? If you unplug and power off the Photon, does the device with this name in the Web IDE stop the breathing cyan graphic next to the name?

It shouldn’t be possible to transfer an ID from one device to another. And if that did somehow happen, the keys would be wrong so the device shouldn’t be able to get online. It is possible this is still the bluz device, but that the cloud thinks it is still online, and still shows you the cyan graphic. This could definitely lead to confusion about which device is which.

If possible, can you screenshot the Particle console showing the device coming online?


#3

The USB cable is plugged into the Photon and only the Photon. There are no other Bluz devices turned on.

This is part of the problem with this whole setup through the particle dashboard. I have no idea how to confirm anything that it thinks it’s talking to.

I have to agree that I’ve never seen it show up here although I did use the device id to remove IATBluzGateway from my account and re-add it so I thought that I had some success, but now I’m questioning that.

$ particle list
IATBluz01 [b1e24439xxxxxxxxxxxxxxxx] (Product 103) is offline
IATBluzGateway [b1e2443cxxxxxxxxxxxxxxxx] (Product 103) is offline

Earlier today I did see devices come online in the dashboard console, but since it never keeps it’s history I can’t recall that and I’ve been unable to recreate the situation.

All the CLI flashing that I’ve done has restored the LED functionality on the Photon to conform to what this article shows:
https://docs.particle.io/guide/getting-started/modes/photon/#dfu-mode-device-firmware-upgrade-
It used to be just a white LED with white patterns from its previously screwed up state, so I figured I must be getting somewhere with it.

When I use particle setup wifi --usb it works just as I would expect it to on both of the Photons I own.

When I use the Particle Device Updater app I can update the firmware for each Photon to 0.6.0

When I use particle identify I do get two difference device identifiers that don’t seem to be on my account.

It seems I’ve once again landed in a thoroughly confused position. The Photon is just as pictured here and it is pulsing cyan in what I would think would say that it is “connected”. But I have no way to prove that it really is. Maybe it’s device id is just sitting out there waiting to be claimed. I think that’s what your assessment is as well.


#4

I think it is probably best to go through the setup procedure again on the Particle app for the Photon. So if you hold the SETUP button down on the Photon for 3-5 seconds, the LED will start to blink on/off blue.

You can then open the Particle app and go through the process of re-setting it up and claiming it here: https://docs.particle.io/guide/getting-started/start/photon/#step-2-connect-with-your-smartphone

This should get the Photon back to a known and working state. Once that works, we can work on getting the rest of the items connected in order. Let me know if that helps.

One question: Is it possible that you have multiple Particle accounts? Could it be that you are signed into the CLI with one account but into the app or Web IDE with another? It seems maybe the Photon may not be on your current account, the bluz boards look like they are properly setup.


#5

Thanks. So far I have had success bringing both of the Photon devices back into my account. One of them was a real pain to try and get Particle Device Updater to complete a firmware update from 0.4.9 to 0.6.0. I had to keep pressing the setup button for 3 seconds to get the update to start, and then once again later to get the update to continue. It finally completed and I was able to reflash Tinker.

Eventually I was able to claim the gateway into my account as well. And I have started an update on the gateway but here is where I’ve always had questions on the process. When http://staging-console.bluz.io says “This will update the firmware of your gateway shield. Multiple files may be downloaded and the device may reboot. The process may take several minutes, please do not power off or reboot the device or close your browser window.”, how are we supposed to know when the process is completed?


#6

Great!

There is a toastr notification when the process completes. Also, the Claim button will disappear. It should only take 1-2 minutes total.

If the device does seem to get stuck and the process is taking more like 3-4 minutes, you can safely reset the gateway shield and try again. There was a bug that would sometimes stall OTA updates, it is now fixed in 2.2.50 though. So once you update this one time, you should no longer have the problem. This is also true when updating the system firmware of bluz DK as well.


#7

Okay, moving on the two BluzDK’s that I have. They were blinking green slow and they are showing up in the particle console with firmware 1.0.47. I’d like to flash them with something that updates their firmware 2.2.50, but I seem to be stuck in the situation described here: https://neighborhood.bluz.io/t/bluzdk-slow-blinking-magenta/292/35

I can see that when I connect to them using the Bluz App, they automatically enter into a spark/status/safe-mode then spark/flash/status started right after coming online and sending their module-info. The problem is that they never get anywhere. I have done it enough times already that I’ve seen spark/safe-mode-updater/aborted Too many tries which ends the safe mode auto update attempts. Unfortunately the process just begins again as soon as I try to flash and update again.

It always ends in spark/flash/status failed.

In this current attempt I got a spark/flash/status started at 12:08:25, but the module now has a constant magenta LED and there has not been any other logged results for 10 minutes now. What’s going on here? Actually at 10minutes exactly it failed again.

“coreid”:“b1e24439xxxxxxxxxxxxxxxx”


#8

A bluz system firmware update can take a few minutes, BLE is slow compared to WiFi.

If the device is blinking green on power up, then it shouldn’t be in safe mode. Once connected, you can go to the Web IDE and try to flash an app built with 2.2.50. When you do, you will see a pop-up asking if you would like to update to 2.0, click Yes and the system will start updating to the latest 2.2.50 firmware. This is the part that can take a few minutes.

If it does get stuck, if the LED stays either solid magenta or just off for more than 30 seconds, you can reset the device and try again. This is the OTA stall issue and it is fixed in 2.2.50, so once you do get the upgrade done it won’t be a problem anymore.

If the system automatically starts downloading a firmware version when it comes online, even if the LED was green at startup, then something strange may be happening. Did you create a Product and assign the device to it? You can simply try factory resetting and bringing the device online, you should not see any update start in the Dashbord if you do this.

Sorry for the hassle, once you get 2.2.50 on the board I believe things will be much smoother.


#9

Yes this is the frustration I am stuck in. I have tried and tried for many hours and I cannot get the upgrade to complete.

When I power on the Bluz it blinks slow Magenta. When I connect to it using the app it blinks fast magenta, then it blinks slow magenta. The app shows it is connected with 1 service, it shows its name, and it shows its device id.

Here is the log from connecting to it now:

event: spark/status
data: {"data":"online","ttl":"60","published_at":"2017-02-14T16:51:13.234Z","coreid":"b1e24439xxxxxxxxxxxxxxxx"}

event: module-info
data: {"data":"{\"m\":[{\"f\":\"b\",\"n\":\"0\",\"v\":\"6}{\"f\":\"s\",\"n\":\"1\",\"v\":\"3}{\"f\":\"u\",\"n\":\"2\",\"v\":\"5}]}!P\u0002","ttl":"60","published_at":"2017-02-14T16:51:14.268Z","coreid":"b1e24439xxxxxxxxxxxxxxxx"}

event: spark/status/safe-mode
data: {"data":"{\"f\":[],\"v\":{},\"p\":103,\"m\":[{\"s\":16384,\"l\":\"m\",\"vc\":30,\"vv\":28,\"f\":\"b\",\"n\":\"0\",\"v\":6,\"d\":[]},{\"s\":126976,\"l\":\"m\",\"vc\":30,\"vv\":28,\"f\":\"s\",\"n\":\"1\",\"v\":3,\"d\":[]},{\"s\":20480,\"l\":\"m\",\"vc\":30,\"vv\":26,\"u\":\"EA6D948674752A86BEF14243C5A2A0CFEE5A7A24E7CD38366967E3B7CEB3CF4C\",\"f\":\"u\",\"n\":\"2\",\"v\":5,\"d\":[{\"f\":\"s\",\"n\":\"1\",\"v\":4,\"_\":\"\"}]},{\"s\":126976,\"l\":\"f\",\"vc\":0,\"vv\":0,\"d\":[]}]}","ttl":"60","published_at":"2017-02-14T16:51:16.088Z","coreid":"b1e24439xxxxxxxxxxxxxxxx"}

event: spark/safe-mode-updater/aborted
data: {"data":"Too many tries","ttl":"60","published_at":"2017-02-14T16:51:12.004Z","coreid":"particle-internal"

Here is the code I’m trying to use to cause the firmware update:

void setup() {
    //setup code
}

void loop() {
    System.sleep(SLEEP_MODE_CPU);

    //non-blocking code goes here
}

I click Flash, then I click Proceed with Upgrade. It immediately says “Upgrade has failed. Is your device connected? Try Again / Cancel”. The thing is, even though the particle site says the upgrade failed, the log shows that an update started and the device LED is constant magenta. The longest I have seen an update attempt to take is 10minutes exactly. It seems that it always fails at 10minutes. Can I go directly from 1.0.47 to 2.2.50?

The console log from starting says:

event: spark/flash/status
data: {"data":"started ","ttl":"60","published_at":"2017-02-14T16:59:22.656Z","coreid":"b1e24439xxxxxxxxxxxxxxxx"}

Sometimes this status stays for 1 minute like this, most of the time this status stays for 10 minutes. Then it fails:

event: spark/status
data: {"data":"offline","ttl":"60","published_at":"2017-02-14T17:01:00.387Z","coreid":"b1e24439xxxxxxxxxxxxxxxx"}

event: spark/flash/status
data: {"data":"failed ","ttl":"60","published_at":"2017-02-14T17:01:00.389Z","coreid":"b1e24439xxxxxxxxxxxxxxxx"}

At this point I then have to press Connect in the app again. The device now has a blue fast blinking LED. But the device never connects and the console log shows no events.

A short while later the device returns to a fast magenta blink.

At this point I then have to press Connect in the app again. The device now has a slow magenta blink. I try to start a flash / upgrade as described above and the whole process repeats itself again. There is no blinking light on the module during this period of time.

I understand that you think there is some magic that makes it somehow complete sometimes, and once I’m on 2.2.50 everything will be roses, but I’m not seeing what I could possibly change here to get it to update. This is a huge time sink, quite literally hours and hours spent getting the same result. Would it be easier to flash this from the command line?


#10

I decided to switch to attempt to update the Bluz through the gateway shield instead of using the app and I seem to have proceeded further.

{"data":"success ","ttl":"60","published_at":"2017-02-14T18:49:22.123Z","coreid":"b1e24439xxxxxxxxxxxxxxxx","name":"spark/flash/status"}

What does this mean? Hash undefined.

{"data":"undefined","ttl":"60","published_at":"2017-02-14T18:56:31.092Z","coreid":"b1e24439xxxxxxxxxxxxxxxx","name":"spark/device/app-hash"}

Finally!! I flashed it two times more using the gateway shield. The second flash did result in the firmware reporting 2.2.50, and the final flash resulted in the app being loaded and a valid hash being reported.


#11

Great, glad it is working, and sorry for the troubles. You are up-to-date now though and these issues should be in the past.