is there a way to list all the "secret" persistent settings (such as FEATURE_DISABLE_LISTENING_MODE, FEATURE_ETHERNET_DETECTION) on a p2? or is there a way to get it all default again?
i am working on getting the factory testing for our p2 product ready and sometime weird stuff happens (unable te restore old device-os with device-restore-over-usb, unable to get it to listen-modes, red flashing)
the p2's we got from particle have "3.2.1-p2.3" but i only have a few assembled devices. after testing our factory process i like to restore back to this version (to repeat...)
@boddeke, have you seen this section of the documentation?
Also, version 3.2.1-p.2.3 is likely an internal release only. For the P2, it is a good idea to update to either the latest LTS (4.0.x) or prerelease (5.3.x) versions.
Yes, I would not attempt to restore the devices to 3.2.1-p2.3. The binaries are not in the public Github, and that version was only on the initial engineering samples. However if you really want to, you can use Device Restore USB to do so.
the problem is that the p2s we got from particle have this version on it. i need to make sure our factory software works very robust and got only a few boards to get this done. so i test the factory software (which upgrades to device-os 5.3.2 and flashes our application) and afterwards i need to restore the "virgin" state of the p2 to test again (and again..)
using the "device resture usb" actually gave me problems: restoring 3.2.1-p2.3 made it flash red. i needed to manually enter it dfu mode and flash it to recover. this is why i thought that probably one of the settings in config flash screws up?
the restoring is successful, the p2 restarts, flashes couple times green and purple (getting bootloader?) and then connects breathing cyan (not in setup mode... although selected)
pressing "mode" for 5s gives a red flash. seems listen-mode is disabled (reason for my original question how to reset config flash)
i am still trying to get the fresh-from-particle-factory p2 to upgrade over usb. the "device restore over usb"works fine. but i cannot get it to work with separate particle-cli commands. (initially we wanted to use the underlying node.js code).
below are the command and the result (from "device restore over usb"). after flashing prebootloader, system and application i cannot get it to "listen" to flash the bootloader.
there most be something preventing it to enter listen-mode. hence my question about persistent settings in config flash... is there more info somewhere?
can somehow use the "device restore over usb"-method?
thanks
frank
G:\factory\site-controller\assets>particle identify
Your device id is 0a10aced202194944a006158
Your system firmware version is 3.2.1-p2.3
G:\factory\site-controller\assets>particle usb listen
Done.
G:\factory\site-controller\assets>particle flash --serial p2-prebootloader-part1@5.3.1.bin
! PROTIP: Hold the SETUP button on your device until it blinks blue!
? Press ENTER when your device is blinking BLUE
sending file: p2-prebootloader-part1@5.3.1.bin
Flash success!
Flash success!
G:\factory\site-controller\assets>particle usb dfu
Done.
G:\factory\site-controller\assets>particle flash --usb p2-system-part1@5.3.1.bin
Flash success!
G:\factory\site-controller\assets>particle flash --usb tinker.bin
Flash success!
G:\factory\site-controller\assets>particle usb listen
Invalid state
G:\factory\site-controller\assets>particle usb reset
Done.
G:\factory\site-controller\assets>particle usb listen
No devices found
G:\factory\site-controller\assets>particle usb listen
Invalid state
G:\factory\site-controller\assets>particle identify
Your device id is 0a10aced202194944a006158
Your system firmware version is 5.3.1
G:\factory\site-controller\assets>particle usb listen
Invalid state
G:\factory\site-controller\assets>particle usb listen
Invalid state
G:\factory\site-controller\assets>
I think you're you're missing p2-bootloader@5.3.1.bin. You must flash both that and p2-prebootloader-part1@5.3.1.bin.
You must never flash p2-prebootloader-mbr@5.3.1.bin! If you flash that, or flash anything to address 0 by SWD/JTAG, the device will be permanently unbootable and non-recoverable because the encryption keys for SecureBoot will be overwritten.
bootloader should be flashed after the application and over serial, right? at that point i cannot get it to go to listen mode, see below (and above...).
G:\factory\site-controller\assets>particle usb listen
Invalid state
we are getting a bit lost and it is getting a bit urgent as we need to deliver flash&test software to our factory
at this point we cannot (offline) flash a (from-the-particle-factory) p2 to device os 5.3.2. we can only do this with your device-restore-usb. we cannot use this in the factory as this is an online tool and cannot be automated.
I think you may need to do both bootloaders first, and yes in --serial mode. However, I never use the --serial mode because the Device Restore USB tool uses a completely different technique (flashing to the OTA sectors in DFU, setting a flag in the DCT, and rebooting), so there could be some issue that I am not aware of.
You also may want to look into using device-os-flash-util. The first time it needs to retrieve the binaries from the network, but it caches them so it can be run offline and scripted. It's the recommended way of flashing devices over USB on a production setting.
regarding the "Device Restore USB tool" (which seems to work very well all the time): is this a method we can adapt to off-line use? is it documented somewhere?
after removing nodejs and nvm and doing a clean install of the lts nodejs and then installing device-os-flash it all seems to work (still "not allowed"):
C:\Users\User>device-os-flash --all-devices 5.3.2
Initializing module cache
Downloading release binaries
Updating cached binaries
Initializing flash interface
Enumerating local devices
Flashing target devices
Target devices:
1. 0a10aced202194944a004d3c (P2)
[Device 1] Skipping p2-prebootloader-mbr@5.3.2.bin. It's required to be encrypted
[Device 1] Preparing device for flashing
[Device 1] Flashing p2-system-part1@5.3.2.bin
[Device 1] Flashing p2-tinker@5.3.2.bin
[Device 1] Resetting device
[Device 1] Using control requests to flash remaining modules
[Device 1] Preparing device for flashing
[Device 1] Not allowed
[Device 1] Flashing p2-prebootloader-part1@5.3.2.bin
[Device 1] Preparing device for flashing
[Device 1] Not allowed
[Device 1] Flashing p2-bootloader@5.3.2.bin
[Device 1] Flashed successfully
Done
C:\Users\User>