Flashing an F18

Posted on
Page
of 2
/ 2
Next
  • I have a DT No.1 F18, and I just came across the Bangle, which looks a lot alike. Can I flash Bangle firmware on my F18? If so, how?

  • Hi,

    Yes, it's the same hardware, so you can flash Bangle.js.

    I can't find it right now, but on this forum there are some earlier discussions about flashing firmware.

    But basically:

    • Wireless firmware updates are possible, but very difficult and can break the watch. It requires multiple flashes with a patched bootloader, new softdevice, and finally the firmware.
    • It's much easier to just open the watch (https://www.espruino.com/Bangle.js+Disas­sembly) and then attach an SWD programmer and program it using the programming header
  • Thanks for the response Gordon! I'm assuming a binary isn't available?

  • Not a full binary including the bootloader - but literally all you need is to follow the instructions in the GitHub repo, then run BOARD=BANGLEJS RELEASE=1 make and you'll get one.

    If you've got an nRF52DK attached for programming then run BOARD=BANGLEJS RELEASE=1 make flash and it'll even program the watch

  • If you don't want to open it then you need to build your own softdevice+espruino bootloader dfu upgrade package. This is the missing part. 3 steps = 1. update existing buggy bootloader with fixed one (there is package for that) 2. softdevice+bootloader package you make - this will upgrade from SDK11 to SDK12 and espruino bootloader 3. ordinary bangle firmware zip

    So if you build from source as @Gordon suggests above, you either flash it over SWD via nRF52DK (or $2 stlinkv2 clone) and you are done with all 3 steps or you learn how to make softdevice+bootloader upgrade package and do 3 steps. If you are lucky and won't brick it, your device stays closed. If not you need to open it and use SWD. In both ways you need to build from source as mentioned above.

  • I'm assuming a binary isn't available?

    No. Just buy bangle if you can't be bothered to learn and build it from source yourself :-)

  • Thanks for the help!

  • I've looked everywhere, but I must be missing it. Where are the SWD points inside the watch?

  • They're under the display - you have to lift the display up and separate the little bit of grey foam that's in there

  • Hello guys, I received 2 very particular gifts, gift number one is a Bangle JS and gift number two is an unbranded F18 smartwatch, fortunately they are different colors. I really really really love the bangle js an I started reading this forum a lot, I've done a bit of homework and thanks to the suggestions found on this post I have a compiled espruino firmware, I would like to flash it on the other F18 smartwatch on which I already soldered the swd connections. Right now I have firmware hex file, the stlink clone adapter and openocd installed on the machine. What should I do to flash the watch ? It is possible to have all the commands needed for the flashing ? I really would like to put Espruino even on this F18. Thank you everyone !

  • Out of interest what does an F18 look like ? Whats the spec?

    UPDATE: Its a Bangle JS1 by another name.

    https://www.youtube.com/watch?v=tpjtu02M­_DI

  • Hello @HughB actually it is the opposite, is the BangleJS that is based on the DTNO.I NO.1 F18 the main mcu is NRF52832QFAA thats why it is possible to flash it with Espruino. @Gordon I found something that maybe could work for flashing but i'm not sure:

    sudo openocd -f interface/stlink.cfg -f tcl/target/nrf52.cfg -c "init" -c "program espruino/firmware.hex" verify reset exit"
    

    I do not know if I'm supposed to do something before flashing

  • sudo openocd -f interface/stlink.cfg -f tcl/target/nrf52.cfg -c "init" -c "program espruino/firmware.hex" verify reset exit"

    or something like

    sudo openocd -f interface/stlink.cfg -f target/nrf52.cfg -c "init" -c "program espruino/firmware.hex verify  reset  exit"
    

    or you can simply start openocd

    sudo openocd -f interface/stlink.cfg -f target/nrf52.cfg 
    

    and then from another console run telnet localhost 4444 and you can enter commands interactively
    program espruino/firmware.hex verify reset exit

    You can also run nrf51 mass_erase to clear flash completely before programming but it is not needed when flashing full firmware hex (which includes softdevice, bootloader and uicr).

    If the device is protected / has SWD locked then stlink can't unlock it but maybe F18 is not locked.

    Also beware that there are cheaper F18 that has no GPS and some stuff is wired in different way, there was a thread here about it. So maybe test GPS with original firmware first to verify you have the one which is same as Bangle 1

  • Hello Guys, I've also tried with openocd v11 on windows but it is not working, this is the error I'm having:

    Open On-Chip Debugger 0.11.0 (2021-03-07-12:52)
    Licensed under GNU GPL v2
    For bug reports, read
            http://openocd.org/doc/doxygen/bugs.html­
    WARNING: interface/stlink-v2.cfg is deprecated, please switch to interface/stlink.cfg
    Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
    Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
    
    nRF52 device has a CTRL-AP dedicated to recover the device from AP lock.
    A high level adapter (like a ST-Link) you are currently using cannot access
    the CTRL-AP so 'nrf52_recover' command will not work.
    Do not enable UICR APPROTECT.
    
    Info : clock speed 1000 kHz
    Info : STLINK V2J34S7 (API v2) VID:PID 0483:3748
    Info : Target voltage: 3.151546
    Warn : target nrf52.cpu examination failed
    Error: jtag status contains invalid mode value - communication failure
    Polling target nrf52.cpu failed, trying to reexamine
    Examination failed, GDB will be halted. Polling again in 100ms
    Info : Previous state query failed, trying to reconnect
    Error: jtag status contains invalid mode value - communication failure
    Polling target nrf52.cpu failed, trying to reexamine
    Examination failed, GDB will be halted. Polling again in 300ms
    Info : starting gdb server for nrf52.cpu on 3333
    Info : Listening on port 3333 for gdb connections
    Info : Listening on port 6666 for tcl connections
    Info : Listening on port 4444 for telnet connections
    Info : Previous state query failed, trying to reconnect
    Error: jtag status contains invalid mode value - communication failure
    Polling target nrf52.cpu failed, trying to reexamine
    Examination failed, GDB will be halted. Polling again in 700ms
    Info : Previous state query failed, trying to reconnect
    Error: jtag status contains invalid mode value - communication failure
    

    I'm using a stlink v2 clone by the way

    P.S. I tried even with stlink.cfg as interface, the result is the same, consider that the VDD pad on pcb is connected to the 3.3v on the adapter

  • you can have swd pins wrong, also try to wake up the watch (enter e.g. HR measurement) or attach charger, also try shorter cables

  • It is the same tried everything ...

  • consider that the VDD pad on pcb is connected to the 3.3v on the adapter

    If you still have battery in or even have charger attached I would not do that, just 3 wires GND,SWCLK,SWDIO. Also some stlink dongles have bad label on case - some go like SWDIO,GND,SWCLK. some are SWCLK,SWDIO,GND and few may have case not matching the pcb - so you may try if GND pin is really GND (is zero ohm to second GND and to USB GND).

  • Ok, so I've opened the case of the st-link and labels on the pcb match the one on the case, I also tried to swap the swdio and swclk with vdd disconnected of course but as soon as i entered the openocd command the lcd screen went off and it is not turning on anymore, maybe i need to disconnect the battery from the pcb and attach it again, I also found a j-link edu mini debugger i will also try this one. It will be good to know it is mandatory to do some sort of unlock of the mcu before I can actually use the swd port to reprogram it. Anyway @fanoush thank you so much for your time !!

  • if disconnecting is not easy then you may very briefly shortcut the battery to reset or power it off, then if it is off try to attach charger and it may wake.

    btw if you have two stlink v2 clones you can reprogram one with the other to test openocd, there are swd pins on pcb near usb connector. also you can reflash it with cmsis-dap debugger firmware which can also unlock protected nrf52, I do have some binary of cmsis-dap for stlink v2 clone that puts additional uart (usb to serial) on rst/swim pins so one could debug and have serial console via same dongle.

    EDIT:
    actually you can even run espruino on stlink v2 clone :-) For more info see https://github.com/fanoush/EspruinoBoard­s/tree/master/STLINKV2 , I have also uploaded cmsis-dap build for the dongle there.

  • Hi, a bit of progress has been made, after the soldering of bigger battery the device turned back on, as @fanoush suggested I started the hr measure and connected the pcb to my sagger jlink edu mini with openocd now I can connect to the device:

    Open On-Chip Debugger 0.11.0 (2021-07-29) [https://github.com/sysprogs/openocd]
    Licensed under GNU GPL v2
    libusb1 09e75e98b4d9ea7909e8837b7a3f00dda4589dc3­
    For bug reports, read
            http://openocd.org/doc/doxygen/bugs.html­
    swd
    Info : Listening on port 6666 for tcl connections
    Info : Listening on port 4444 for telnet connections
    Info : J-Link EDU Mini V1 compiled Sep 24 2021 16:44:11
    Info : Hardware version: 1.00
    Info : VTarget = 1.584 V
    Info : clock speed 1000 kHz
    Info : SWD DPIDR 0x2ba01477
    Error: Could not find MEM-AP to control the core
    ****** WARNING ******
    nRF52 device has AP lock engaged (see UICR APPROTECT register).
    Debug access is denied.
    Use 'nrf52_recover' to erase and unlock the device.
    
    Warn : target nrf52.cpu examination failed
    Info : starting gdb server for nrf52.cpu on 3333
    Info : Listening on port 3333 for gdb connections
    

    now, should I use the nrf52_recover command as openocd suggested ? Or I should try directly to flash the device with Espruino firmware ?

    P.S. The sagger j-link is much more capable that the st-link clone by the way even if the problem I had yesterday was a very low battery on the watch I will try again the stlink tomorrow

  • yes this is locked device, without unlocking(=>erasing) you canot do anything over swd. if you have j-link you can also reflash stlink with the cmsis-dap, that one is also better than stlink and can unlock locked devices

    maybe the stlink could not find it because it was locked, forgot how it behaves in such case, after unlocking you may retry with stlink, then it may work.

  • Ok, so what kind of unlock command did you suggest to use ? nrf52_recover ? nrf5 mass_erase ? Or just the programm command ?

  • I never used nrf52_recover, just try it. I do it by directly writing the ERASEALL register, see https://wiki.pine64.org/wiki/Reprogrammi­ng_the_PineTime#Unlocking_the_device

    then run 'reset halt' and then you can hopefully use program command

  • Hello, after the use of nrf52 recover everything went well, as you can see in the picture below. jlink is a piece of cake to use on those watches I was considering documenting the procesess on my github so people can do things more easily. I uploaded even some apps in the watch and everything went fine. Thanks a lot for the help !!


    1 Attachment

    • 20211223_170919.jpg
  • hi,
    may i ask,
    why everyone use the slim st link v2 clone instead of the bulky original St link/clone or the jlink-clone?

    everyone use this:

    original st link v2, or the clone:

    jlink OB clone:

    i am blank newbie, thanks

    although pinetime now come with firmware unlocked, i would like to keep the ability to do so. I read from atc1411's utube that i can flash the slim st link v2 clone as a DAP? to unlock the firmware if needed? thanks

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Flashing an F18

Posted by Avatar for user126639 @user126639

Actions