Photon not flashing correctly, or always flashing with tinker

I’ve had a chance to try building the modules, but am getting errors.

with photon attached in dfu mode, on OSX, in repo “firmware” branch “develop”, in folder “modules” as above. I ran:

make PLATFORM=photon clean all program-dfu

and got the following errors:

<path>/firmware-develop/modules > make PLATFORM=photon clean all program-dfu
`free' referenced in section `.text.mpi_grow' of /var/folders/c1/dt61zfs90816tqlxt_9s76m40000gn/T//ccmwYdRi.ltrans1.ltrans.o: defined in discarded section `.text' of ../../../build/target/system-part1/platform-6-m-lto/../../../modules/photon/system-part1/src/import_rt.o (symbol from plugin)
`free' referenced in section `.text.mpi_free' of /var/folders/c1/dt61zfs90816tqlxt_9s76m40000gn/T//ccmwYdRi.ltrans2.ltrans.o: defined in discarded section `.text' of ../../../build/target/system-part1/platform-6-m-lto/../../../modules/photon/system-part1/src/import_rt.o (symbol from plugin)
`free' referenced in section `.text._ZNSt14_Function_base13_Base_managerIZN13SparkProtocol20handle_function_callERNS1_3msgEEUlPKvN15SparkReturnType4EnumEE_E10_M_managerERSt9_Any_dataRKSA_St18_Manager_operation.5345' of /var/folders/c1/dt61zfs90816tqlxt_9s76m40000gn/T//ccmwYdRi.ltrans3.ltrans.o: defined in discarded section `.text' of ../../../build/target/system-part1/platform-6-m-lto/../../../modules/photon/system-part1/src/import_rt.o (symbol from plugin)
collect2: error: ld returned 1 exit status
make[1]: *** [../../../build/target/system-part1/platform-6-m-lto/system-part1.elf] Error 1
make: *** [<path>/firmware-develop/modules/photon/system-part1/makefile] Error 2

this is with a fresh copy of the repo.

@mdma I did the dfu-util flash, went baclk to the android, gave the WPA2 pass but I have the message that setup process couldn’t configure wifi.

Please check you are using version 4.9.x of gcc - the firmware docs have the details.

1 Like

Could you try to configure WiFi using particle CLI - http://docs.particle.io/core/cli/#running-from-source-advanced-particle-setup-wifi

Thanks! That did the trick. BTW, in the documentation it says:

OS X:

brew install gcc-arm-none-eabi-49

homebrew doesn't have that formula in its index, but I used this one with success.

I'm still wondering about the relationship of "system firmware" to "build components" and whether there's any way to flash system firmware OTA rather than just by dfu. This doesn't seem to be well described in the firmware docs.

There’s some info here: https://github.com/spark/firmware/releases/tag/v0.4.1

I think the OTA sequence for a system firmware upgrade is:

  • system part-1
  • system part-2
1 Like

The PC I'm using has no Wifi... went this way too...

Thanks @kennethlimcp, that’s super helpful. The files included here are just v1 of the firmware? @mdma suggested that we need v2. I assume that I’m building system parts 1 and 2 for v2 when I run ‘make’ in the modules folder locally, is that right?

In any case, even though this can be flashed OTA, we need physical access to the photon to put it into safe mode. So my current understanding is that flashing v2 of system firmware in order to allow local compilation to work needs to be done with each photon physically in hand, for now (possibly forever?).

Yes, that's correct. If you're building user firmware locally it's also important to update the system firmware so the versions match.

This is a temporary situation - as soon as 0.4.0 is released for the Core then we will move what is in develop to master and encourage everyone to build from there. From that point onwards, master will follow exactly what is available online.

2 Likes

@mdma still stuck…

It seems it connects to the wifi, gets an ip address, I can ping it, but still no cloud connexion.

I can do a identifyu and got an id, but on the build site I get :" could not claim core"

What can I do now ?

Is it breathing cyan?

yes

Can you send me your device ID. (PM if you want to.)

Just what I needed to know, thanks a ton @mdma!

1 Like

@mdma green -> cyan flash -> cyan high speed

it keeps looping between flashing and flashing high speed

Thanks for the update - flashing cyan at high speed indicates a problem with the keys.

We will save the current key and flash new keys to the device using particle-cli, so please install that first if not already done.

  1. Put your device in DFU mode.

  2. Save the current key (for diagnostics/troubleshooting)

particle keys save photon.key

Please send the key to me.

  1. Then create new keys:
particle keys new
particle keys load device.pem
particle keys send <device_id> device.pub.pem

The last step may not work for a device that you’ve not claimed. In which case PM me with your device_id and I will register the key.

1 Like

Hello,

the second step seems not possible:

particle keys load device.pem
[...]
Found DFU: [2b04:d006] ver=0200, devnum=64, cfg=1, intf=0, alt=1, name="@DCT Flash /0x00000000/01016Kg", serial="00000000010C"
Found DFU: [2b04:d006] ver=0200, devnum=64, cfg=1, intf=0, alt=0, name="@Internal Flash /0x08000000/03
016Ka,01016Kg,01064Kg,07*128Kg", serial="00000000010C"
[...]
running dfu-util -d 2b04:d006 -a 1 -s 34:612 -U pre_device.der
running openssl rsa -in pre_device.der -inform DER -pubout -out pre_device.pub.pem
Error saving key from device... Error: Command failed: unable to load Private Key
140185425147536:error:0D07209B:asn1 encoding routines:ASN1_get_object:too long:asn1_lib.c:145:
140185425147536:error:0D068066:asn1 encoding routines:ASN1_CHECK_TLEN:bad object header:tasn_dec.c:1332:
140185425147536:error:0D06C03A:asn1 encoding routines:ASN1_D2I_EX_PRIMITIVE:nested asn1 error:tasn_dec.c:832:
140185425147536:error:0D08303A:asn1 encoding routines:ASN1_TEMPLATE_NOEXP_D2I:nested asn1 error:tasn_dec.c:729:
140185425147536:error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag:tasn_dec.c:1345:
140185425147536:error:0D06C03A:asn1 encoding routines:ASN1_D2I_EX_PRIMITIVE:nested asn1 error:tasn_dec.c:849:
140185425147536:error:0D08303A:asn1 encoding routines:ASN1_TEMPLATE_NOEXP_D2I:nested asn1 error:tasn_dec.c:769:Field=iqmp, Type=RSA
140185425147536:error:04093004:rsa routines:OLD_RSA_PRIV_DECODE:RSA lib:rsa_ameth.c:115:
140185425147536:error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag:tasn_dec.c:1345:
140185425147536:error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error:tasn_dec.c:388:Type=X509_ALGOR
140185425147536:error:0D08303A:asn1 encoding routines:ASN1_TEMPLATE_NOEXP_D2I:nested asn1 error:tasn_dec.c:769:Field=pkeyalg, Type=PKCS8_PRIV_KEY_INFO

Error saving key to device... Error: Command failed: unable to load Private Key
140185425147536:error:0D07209B:asn1 encoding routines:ASN1_get_object:too long:asn1_lib.c:145:
140185425147536:error:0D068066:asn1 encoding routines:ASN1_CHECK_TLEN:bad object header:tasn_dec.c:1332:
140185425147536:error:0D06C03A:asn1 encoding routines:ASN1_D2I_EX_PRIMITIVE:nested asn1 error:tasn_dec.c:832:
140185425147536:error:0D08303A:asn1 encoding routines:ASN1_TEMPLATE_NOEXP_D2I:nested asn1 error:tasn_dec.c:729:
140185425147536:error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag:tasn_dec.c:1345:
140185425147536:error:0D06C03A:asn1 encoding routines:ASN1_D2I_EX_PRIMITIVE:nested asn1 error:tasn_dec.c:849:
140185425147536:error:0D08303A:asn1 encoding routines:ASN1_TEMPLATE_NOEXP_D2I:nested asn1 error:tasn_dec.c:769:Field=iqmp, Type=RSA
140185425147536:error:04093004:rsa routines:OLD_RSA_PRIV_DECODE:RSA lib:rsa_ameth.c:115:
140185425147536:error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag:tasn_dec.c:1345:
140185425147536:error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error:tasn_dec.c:388:Type=X509_ALGOR
140185425147536:error:0D08303A:asn1 encoding routines:ASN1_TEMPLATE_NOEXP_D2I:nested asn1 error:tasn_dec.c:769:Field=pkeyalg, Type=PKCS8_PRIV_KEY_INFO

Thank you. This confirms my suspicion that the private key was defective somehow.

As an alternative, could you try this instead of step 2 above:

dfu-util -d 2b04:d006 -a 1 -s 34:768 -U private.key

Thanks! :smile:

Thanks @mdma! I finally got around to fixing it. Updating with the new firmware worked!

1 Like

Great to hear! Could you please email me the private key that you saved so I can investigate why it wouldn’t work? Thanks! :smile: