Good news - have received a P2 Eval Board.
Bad news - it is proving hard to get anything working with Device OS 5.0.1 and CLI.
I had initially got it setup and connected to the cloud on OS 5.0.0. CLI usb commands can’t be used to do normal particle setup, rather particle serial must be used. When I had to change my WAP and clear the wifi credentials from the P2, I didn’t think to repeat this immediately.
I had setup Workbench and can compile and download sketches. This simple SerialLogHandler test didn’t produce any output!
// setup() runs once, when the device is first turned on.
Log.info("System version: %s", (const char*)System.version());
// loop() runs over and over again, as quickly as it can execute.
Log.info("This is info message %i", counter);
It wasn’t until I connected the P2 to the internet by using the
$ particle serial wifi command and then the update happened and hey presto it started to work.
How could I have avoided this - there does not appear to be any instructions about how to update the p2-prebootloader-mbr and p2-prebootloader-part1 binaries which I presume are the reason the sketch did not work?
PS. Could an optional tag for P2/Photon2 be added please?
How did you do the update to 5.0.1? Using Device Restore USB is the best way.
You definitely can’t do it with Particle Workbench as it does not upgrade the bootloader or prebootloader-part1. Without those dependencies, the device will go into safe mode to get them OTA.
However, if you have not yet configured Wi-Fi credentials, the device cannot get online to get them. Your user firmware never runs with missing dependencies, so the behavior you saw is expected. Not necessarily useful, but expected.
Under no circumstances should you flash prebootloader-mbr. You can only do it using SWD/JTAG, and if you do, the device will be rendered permanently inoperable and cannot be recovered. The reason is that the prebootloader-mbr that was flashed to your device in the factory is custom for your device only. It’s part of Secure Boot and contains device-specific encryption keys. It will never be upgraded.
I had loaded 5.0.1 via the workbench flash.
Can you highlight the device restore usb command please.
It would be useful if you could highlight where the warning about prebootloader-mbr is given - I had not tried fortunately. Why is this distributed as part of the device OS updates?
prebootloader-part1 is loaded the same way as bootloader using serial flash?
Good to know behaviour as expected and no damage done!
I haven’t made use of it yet but I am impressed that the P2 has 3.5MB of RAM is this a change made after the specification was written or a one-off?
Lastly, when can we expect some updates on the documentation for P2?
Device Restore USB is a web-based tool for flashing Device OS. Using it to change Device OS versions in Workbench is not specific to the P2, and there’s a section in the Workbench docs that explain why.
The warning about prebootloader-mbr is in the datasheet and also in the SWD/JTAG Guide. The reason the binary exists in the release is because that’s what’s used as the base for how the device-specific binary is created. There isn’t a good way to hide it in Github releases, unfortunately.
The prebootloader-part1 and bootloader can be flashed in
--serial mode like other devices.
We haven’t listed the exact amount of RAM that will be available. It’s currently 3.5 MB but we want to set the guaranteed amount somewhat lower than that, in case future versions of Device OS need more RAM for the system, which shares that amount. But it will still be still very, very large compared to other devices (around 80K on Gen 3 nRF52840).
The maximum user binary size flash size is 2 MB, and that will stay same in future versions.
The P2 module literally sits on the top of the Photon 2, so the Photon 2 is basically the same.
The P2 is the main MCU on the Tracker M though the Wi-Fi is only used for Wi-Fi geolocation and it has a cellular modem for its cloud connection.