virtualabs / btlejack

Bluetooth Low Energy Swiss-army knife
MIT License
1.88k stars 195 forks source link

Firmware Question #31

Closed thisguy23 closed 5 years ago

thisguy23 commented 5 years ago

Can you revert back to the original firmware after flashing with btlejack?

virtualabs commented 5 years ago

You mean the original Micro:Bit firmware ? Simply download it from https://microbit.org/guide/firmware/ and drag/drop into your Micro:Bit's mass storage device. And you should be good to go :).

thisguy23 commented 5 years ago

That's what i figured, just wanted to be certain. thanks!

thisguy23 commented 5 years ago

I think you should clarify. BTLEJack doesn't actually alter the true firmware of the device. i.e. doesn't go into maintenance mode, as required for an actual firmware update. Unless there is something I am missing.

virtualabs commented 5 years ago

I have no idea what you are talking about. The BBC Micro:Bit embeds a programmer for the main nRF51822 chip. This programmer is in fact another chip on the PCB, that handles all the flashing procedure from mass storage write to nRF51822 programming through SWD. This chip may go into "maintenance mode" because of many possible issues it may encounter while programming the nRF51822.

Btlejack's firmware is designed to be run on a nRF51822 chip, so yes you will overwrite the original Micro:Bit firmware (the one with MicroPython) with Btlejack's firmware, and you won't be able to code in Python with your Micro:Bit until you reprogram it with Micro:Bit's firmware binary.

Or maybe I don't really understand what you mean ?

thisguy23 commented 5 years ago

when you do a true DAPlink firmware update on the microbit you must do the following

Then with the battery pack removed and a USB lead connected, hold the reset button at the back of the micro:bit and plug the USB lead into your computer. You should see a drive appear in your file manager called MAINTENANCE.

this doesn't happen when you do the install from btlejack. it just drops the hex file into the microbit which just programs it, and doesn't alter the underlying firmware, which is DAPlink... maybe I'm way off base on this though. I am no expert.

virtualabs commented 5 years ago

From https://github.com/ARMmbed/DAPLink:

DAPLink runs on a secondary MCU that is attached to the SWD or JTAG port of the application MCU.

So DAPLink and its maintenance mode runs on a custom chip, not Micro:Bit's nRF51822. When you drag and drop a HEX file into the mass storage device spawned when the Micro:Bit is connected, DAPLink programs the nRF51822 with this firmware i.e. resets and writes nRF51822 flash memory with the provided HEX file. That's no magic, and that's how DAPLink handles it.

Of course, the DAPLink firmware is not erased nor removed as it resides in a secondary MCU internal flash.

thisguy23 commented 5 years ago

Thanks for the clarification, and information.