Cannot connect with flashed firmware

I am in the process of building some custom hardware and forking the firmware.

To get started I cloned the firmware [45f4b99] (https://github.com/Garadget/firmware/commit/45f4b99f59d9addf21c6cfcc9eb34a14b209f7cb).

It compiled and uploaded cleanly to my Photon named “N” using CLI:
particle flash N firmware-master

With the firmware loaded, there is a regular red LED blinking pattern, occasionally interrupted with short periods of solid white LED. When holding down the SETUP button for a bit makes the LED breath magenta, which is the indicator for entering safe mode. I was hoping for blue blink so that I could register the device as a door with my garadget account.

Happy for help getting past this, and obviously to provide any info needed for clues.

What is the system version you have on your Photon?
While compiling, make sure you set target for Photon and not P1.

Device OS: 1.2.1.

Here is te exact sequence I am using to clone, compile and flash the repo:

> git clone https://github.com/Garadget/firmware.git
Cloning into 'firmware'...
remote: Enumerating objects: 438, done.
remote: Total 438 (delta 0), reused 0 (delta 0), pack-reused 438
Receiving objects: 100% (438/438), 217.43 KiB | 985.00 KiB/s, done.
Resolving deltas: 100% (295/295), done.
> particle compile photon firmware --saveTo firmware.bin

Compiling code for photon

Including:
    firmware/config.h
    firmware/door.h
    firmware/global.h
    firmware/sensor.h
    firmware/timeout.h
    firmware/timezones.h
    firmware/config.cpp
    firmware/door.cpp
    firmware/garadget.cpp
    firmware/sensor.cpp
    firmware/timeout.cpp
    firmware/timezones.cpp
attempting to compile firmware 
downloading binary from: /v1/binaries/5d4d9f217f2dc1000101ac3b
saving to: firmware.bin
Memory use: 
   text	   data	    bss	    dec	    hex	filename
  29844	    288	   3580	  33712	   83b0	/workspace/target/workspace.elf

Compile succeeded.
Saved firmware to: /Users/kristian/Downloads/firmware.bin
> particle flash N firmware.bin
Including:
    firmware.bin
attempting to flash firmware to your device N
Flash device OK:  Update started

It may be worth trying re-uploading system binaries and the boot loader the same way (via USB/DFU programmer).

If that doesn’t work, another option is to try web programmer at https://build.particle.io/build/new

https://github.com/particle-iot/device-os/releases/latest redirects to v1.2.1. So I have grabbed the bootloader and the two OS binaries from github.

Flashing OS over USB in DFU (yellow blink) mode:

> particle flash --usb photon-system-part1\@1.2.1.bin

Flash success!
> particle flash --usb photon-system-part2\@1.2.1.bin

Flash success!

Flashing the bootloader over USB in listening (blinking blue) mode:

> particle flash --serial photon-bootloader\@1.2.1.bin
! PROTIP: Hold the SETUP button on your device until it blinks blue!
? Press ENTER when your device is blinking BLUE
sending file: photon-bootloader@1.2.1.bin

Flash success!

Next, I went through the steps in my previous post to download, compile and flash the garadget firmware. It produces the same LED blinking pattern as described previously. I found out that the bli k is actually morse alphabet SOS, indicating a firmware issue (https://docs.particle.io/tutorials/device-os/led/electron I also tried to compile with --target 1.2.1 to make sure, but same problem.

The above outcome was reproducable on two separate Photon devices.

Not sure how to use the web IDE at particle.io/build for this. Apparently apps can be shared with a link (according to https://docs.particle.io/tutorials/developer-tools/build/core/ under “Sharing your app”), but I do not have such link for garadget.

Another way, I guess, would be for me to manually copy the content of each *.cpp and *.h file of the firmware into correspondingly named files in te IDE. Not quite sure how to go about with this though, as the IDE seems to define its projects through an *.ino file, which does not exist in the firmware folder.

Do you get the same result from this branch?

Ok, great. That firmware works, thanks!

'I get through all of the steps of the add door process using the iOS app (latest version grabbed from app store), except the last one, where it fails to claim ownership of the device. I made sure to unclaim the device via https://console.particle.io/devices prior to entering the .

Very thankful for any clue as to why ownership cannot be claimed. (Tried to search the forum, without any luck)… :slight_smile:

Also for own understanding am a bit curious why the mqtt branch compiles into working software, while I cannot get the master branch to do so…

What is the device ID of your unit? Maybe it needs to be added to the product explicitly.
Also: what is the LED indication at the end of the process?

Re. firmware: the mqtt branch is the most recent, we just need to merge it into the main branch.

Will send you IDs in message shortly.

Device is breathing cyan while trying to verify ownership, and continues to breath cyan after this fails. I’ve tried this on two separate wifi networks…

Do I need to unclaim the device from console.particle.io first, or can I still have it registered with the particle cloud? (I’ve tried both, verifying ownership fails in both cases).

Great to know about the branches. I’ll base my design on the mqtt branch then. Will study the branch code in closer detail, and hoping the device is still connected to the particle cloud (so that for instance subscribe and publish can be used).