TheThingsProducts / gateway

The Things Kickstarter Gateway
https://www.thethingsindustries.com/docs/gateways/models/thethingskickstartergateway
54 stars 20 forks source link

Bootloader code or image availability? #11

Closed cyberjunky closed 6 years ago

cyberjunky commented 6 years ago

My gateway stopped working all together it seems, no lights lit up other than the power circuit ones (2) , no working firmware updates via SD card or responses on mode button presses can be seen. Will the bootloader code and/or image (hex file) be made available? Either public in this repo or privately disclosed/shared so I can try to get it running again by re-flashing it via ISCP port using a debugger tool like PicKit3 or ICD3.

cyberjunky commented 6 years ago

@rish-c Rich-c are you able to supply me the bootloader or memory hex to be flashed using a debugger tool so my gw boots again? Maybe even via PM. This way I can perhaps get it up and running again and start helping to debug the timing issues together with @avbentem

cyberjunky commented 6 years ago

Yes, I managed to unbrick my gateway (which was bricked due to my own fault) I flashed the bootloader.hex from the feature/merging_bootloader branch using my ICD3 and it came to life again with bootloader r2, it didn't reboot with reason 0x10 ever since! I also flashed the firmware from the same branch and for the first time ever I got my devices to use the gateway, it has traffic! Some prove... gw_icd 2 1b

cyberjunky commented 6 years ago

I forgot to ask; what is the use case of the firmware-with-bootloader.hex file? Flashing it using the ICD3 didn't result in a working gateway, only after I flashed the bootloader.hex it started to run. This morning it still runs without a glitch, before this the longest run period was 3-4 minutes.

martinichka commented 6 years ago

Hi Rob,

The firmware-with-bootloader.hex is a combination of the bootloader with the latest application. Such a file is used during production, and should only be programmed using an external programmer (so no via SD card).

So the fact that it did not work when you flashed the with-bootloader image using ICD is blocking this PR.

We will look in to it.

The fact that it did reboot after since is due to the corrected clock settings. For now only possible to change by an external programmer. As you know we are working on a solution that does not require an external programmer.

Marten

Op za 24 feb. 2018 08:27 schreef Ron Klinkien notifications@github.com:

I forgot to ask; what is the use case of the firmware-with-bootloader.hex file? Flashing it using the ICD3 didn't result in a working gateway, only after I flashed the bootloader.hex it started to run. The next morning it still runs without a glitch, before this the longest run period was 3-4 minutes.

— You are receiving this because you were assigned.

Reply to this email directly, view it on GitHub https://github.com/TheThingsProducts/gateway/issues/11#issuecomment-368207665, or mute the thread https://github.com/notifications/unsubscribe-auth/AJnOlYRaGJrS6ROE7zJGU-B5eKcuZ7qQks5tX7nRgaJpZM4SFVOH .

cyberjunky commented 6 years ago

Marten, I noticed the clock setting changes in the commit. About the firmware-with-bootloader file I flashed it with the default settings like in the screenshot above. But I noticed with this file and with bootloader.hex that the programmer gave a warning about code that is located at addresses that do not exist when loading the hex, this seems bogus for at least one of them as flashing with bootloader.hex file succeeded anyway. This the message I'm referring too:

2018-02-23 20:01:17 +0100 - Loading hex file. Please wait... Warning: /home/ron/gateway/firmware/bootloader.hex contains code that is located at addresses that do not exist on the PIC32MZ2048EFM144. Code incompletely loaded. 2018-02-23 20:01:17 +0100 - Hex file loaded successfully.

2018-02-23 20:01:25 +0100 - Programming... Device Erased... Programming... The following memory area(s) will be programmed: boot config memory configuration memory Programming/Verify complete 2018-02-23 20:01:30 +0100 - Programming complete Pass Count: 2

If you want me to re-test something let me know.

martinichka commented 6 years ago

If you could re-test with a full erase and flash the firmware-with-bootloader.hex, to see if that is running, that would be a great help. On the devices here it is working and it is the standard procedure at production. The contains code that is located at addresses that do not exist on the PIC32MZ2048EFM144 we also noticed. It is not new, but I will look in to that.

cyberjunky commented 6 years ago

What I did to brick it (if i remember correctly) is flashing the firmware.hex to the device using the ICD3, when all the lights went out and stayed out then I realized (a bit late) that the bootloader was missing in the file and gone from my gateway. I didn't test re-flashing after the bootloader.hex succeeded. I fully erased and re-flashed with firmware-with-bootloader.hex just now 5 times in a row, and it worked flawlessly. So you can unblock this PR, probably the wrong state without erase first was the cause.

2018-02-24 12:15:14 +0100 - Completed loading IPE.


Connecting to MPLAB ICD 3...

Currently loaded firmware on ICD 3 Firmware Suite Version.....01.45.41 Firmware type..............PIC32MZ

Target voltage detected Target device PIC32MZ2048EFM144 found. Device ID Revision = A1 DEVSN0 = ec412447 DEVSN1 = 34875410 2018-02-24 12:15:36 +0100 - Erasing...

Erasing... Erase successful 2018-02-24 12:15:38 +0100 - Erase device complete

2018-02-24 12:15:45 +0100 - Loading hex file. Please wait... Warning: /home/ron/gateway/firmware/firmware-with-bootloader.hex contains code that is located at addresses that do not exist on the PIC32MZ2048EFM144. Code incompletely loaded. 2018-02-24 12:15:45 +0100 - Hex file loaded successfully.

2018-02-24 12:15:47 +0100 - Programming...

Device Erased...

Programming...

The following memory area(s) will be programmed: program memory: start address = 0x0, end address = 0xeffff boot config memory configuration memory Programming/Verify complete 2018-02-24 12:16:06 +0100 - Programming complete Pass Count: 7

martinichka commented 6 years ago

That is great news. Thanks for retesting.

htdvisser commented 6 years ago

We added the bootloader in PR #16; Links to hex files with firmware + bootloader are added to the README in firmware dir (currently only in develop, expected be merged to master soon)