I have a device with two variants: one is E-series based and the other is Electron based.
The application is the same except for a few hardware & software differences. For e.g.: In my E-series design, I am storing the device keys in an SPI flash chip while it is stored in the EEPROM in the case of an Electron.
My Electron variant is already out in the field and my E-series variant is in the process of being rolled out.
Is there a way to identify the current hardware is an Electron or an E-series module in code? It would make my code backwards compatible and make it easy for future firmware updates etc.
I did some cursory search and the closest thing is a PLATFORM_ID but that is meant to identify a Photon vs Electron.
The Electron and E series have the same PLATFORM_ID of 10. They also use the same Device OS/system firmware binaries.
One way you can tell, for now, is by the u-blox modem module. The AT+CGMM command returns a string like “SARA-G350”, “SARA-U260” or “SARA-U270” for an Electron and “SARA-U201” for an E-series E310. You can use a library like CellularHelper or just do it manually with Cellular.command.
Another way would be to probe for your SPI flash chip and see if it’s there. If you’re using a WinBond SPI flash chip, there are 3x 256-byte security registers that are preserved even if you erase the flash chip. This is a great place to put a board identifier so you can differentiate different versions of your board.