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).

Hello.

First, let me thank you for making this open to the community. I am in the process to build my own device and followed your post to build the garage device.
I have burned the 1.2.1 proton firmware, compiled the MQTT garage firmware and uploaded to the device.
Pushing the mode button gives me a slowly flashing blue light and I can see the Photon-XXXXXX (6 letters, not 4) as an AP.
Now the point where I am stuck: I am unable to register the device both on the iOS APP and the garage web interface.
On the APP, the last step to register the device fails; on the web interface (adding a door), I am stuck on the “Waiting for WiFi connection to garadget” (I do connect to the Photon_XXXXXX AP but the registration does not move forward).

Any advise/help will be greatly appreciated. Thank you.
Carlos

Yup, what you describe is exactly what I am facing too.

If you have a generic Particle account, try registering a Garadget specific account with a different email address. Make sure the device is released from the generic account first. Let me know if you still experience the issue.

BTW: I’ve merged the code so you can try compiling/flashing the master branch now. Also the directories are re-structured to work with Particle Workbench.

Morning Denis.
Thank you for the reply.
I do have a Garadget account with a different email address. My photon is not registered on particle’s cloud.
I cloned the new repo and the device is now running software 1.22 using Particle’s workbench; thank you for that.
Issue still shows up, both on garadget web site and with the app; on web site, it hangs on waiting for the connection to the device forever (as before); on the app, it fails on registering the device.
Any advise?
Thank you. Have a great day. Rgds,
Carlos

One more info: on the web site, debugging the script, the registration process hangs because of this error:
InvalidAsn1Error: Expected 0x2: got 0x30 - http://setup.garadget.com/my/js/softap-browser-min.js (line 304)

In case it may give you some light … Thank you again.
Carlos

Please PM me your device ID and I’ll check if it was added to the list.

Thanks a lot for helping out with the debugging.

I just pulled from the github repo and built the new master branch. Then I did a particle “device remove [device ID]” and confirmed that the device had been removed from the particle cloud by invoking “particle list” (which returned “No devices found”.) After flashing the binary over USB, I tried to add it to a newly created garadget account, associated with an e-mail address, which I also newly registered with gmail (and which has not been associated with the particle device in any way).

As before, the app fails to claim ownership.

With web interface I am having even less success. With either of Firefox, Safari or Chrome, I follow the instructions and put the Particle in blue blink mode, then connect to it over wifi. After this the little animation and “Waiting for WiFi connection with Garadget” text at the bottom of the page disappears and nothing else happens. The device remains blinking blue.

@talmansgatan51,
Please direct message me your unit’s device ID and I’ll try explicitly adding it on the server.

Thanks, just sent them over (thought I managed to do it recently as well, but I might have failed with it somehow. /K