Is my device configuration corrupted?

Just a few minutes ago I made a separate, but perhaps related Troubleshooting post, Issues transferring device ownership.

This isn’t the first time that I’ve had issues claiming a device. While I was working on a user flow for getting devices onto wifi, my workflow largely consisted of:

  1. Removing and unclaiming a device from my account and product
  2. Resetting the device to factory settings
  3. Adding and claiming it to my account and product again with user flow

For step 2, I would use steps outlined in rickkas7/photonreset, but I often experienced issues getting the device online after this. The only consistent method I had for allowing my device to connect to wifi after being reset was having my business partner go through the particle CLI wifi setup again on his account. So in actuality, the flow was more like this:

  1. Removing and unclaiming a device from my account and product
  2. Resetting the device to factory settings
  3. Business partner claimed the photon to his account
  4. Business partner removed and unclaimed the device from his account
  5. Adding and claiming it to my account and productagain with user flow

Why was this step necessary? The two possible scenarios I can think of are:

  1. Something is wrong with my computer or particle CLI (it is using the latest version)
  2. I am corrupting the device configurations and switching accounts is somehow the antidote

Any advice on how to determine the root of my issue? Any help is greatly appreciated!

You should be able to do the following steps:

  • Unclaim Device from the product but do not Remove Device.
  • Reset the firmware to Tinker, or your firmware.
  • Use the last step in photonReset to reset the claim code on the device. This is important.

The reason for not removing is that under normal circumstances you should add all devices to a product when you build them. This is why you get a file of device IDs when you order in tray or reel quantities.

For claiming to work flawlessly, it’s best that the device ID already be added to the product.

For reused devices, the device should be unclaimed and the on-device claim code cleared. For brand new devices, this will already be the case.

1 Like

Thanks for the quick response, @rickkas7!

I’m glad to hear that adding larger quantities of product sounds relatively straightforward.

Good to know that I’m not removing the claim code in vein, but I’m worried that I may be doing it improperly. I’m getting the following error when I try to clear it:

Download	[                         ]   0%            0 bytesdfu-util: Error during download get_status

Here is the full error:

➜  photonreset git:(master) ✗ dfu-util -d 2b04:d006 -a 1 -s 1762:64 -D clear_claim.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!!!
Deducing device DFU version from functional descriptor length
Opening DFU capable USB device...
ID 2b04:d006
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #1 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 4096
DfuSe interface name: "DCT Flash   "
Downloading to address = 0x000006e2, size = 64
Download	[                         ]   0%            0 bytesdfu-util: Error during download get_status

That looks correct. However you can tell it worked if you get a warning that the device has already been claimed when you try to claim it with the mobile app after clearing it or not.

The reason for all this annoyance is this:

When you unclaim a device it only affects the cloud setting, not the device itself. There’s a flag on the device that doesn’t get cleared.

When you go to claim a device from the mobile apps, you’re logged into the account, but don’t yet know the device ID you’re claiming. That’s only known once you connect to SoftAP. But then you’re no longer connected to the Internet, and can’t check the claiming!

The workaround was to download the device list for the account to the mobile app before connecting to SoftAP. If the device ID is not in the list and the on-device has been claimed flag is set, you get the device is owned by someone else warning.

This is not fatal, as the device can still be claimed, but it’s confusing an it does seem like it’s less reliable when you go down that path, especially with product devices.

1 Like