Infinitime 1.2-0 on PineTime, from scratch

It seems that it is normal for me to buy stuff/parts/devkits and let them accumulate some dust before getting back to the project pile …

Just recently I read on the Pine64 Blog June update that Infinitime 1.2 was coming soon… Then I remembered I had ordered a PineTime devkit (part of the first batch ever actually) so I decided to find it and flash working firmware on it…

I attempted to flash it with a STM bluepill Black Magic Probe first:

wiring diagram

Image taken from this forum thread

Guide to program using arm-noneabi-gdb and BMP here

Apparently I managed to delete the application firmware because the dummy GUI that showed the charging state was gone…but I didn’t manage to make it show anything, I was left with a paperweight, just for fun, here’s the log:

╰─ arm-none-eabi-gdb                                                         ─╯
GNU gdb (GDB) 10.2
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=x86_64-pc-linux-gnu --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) target extended-remote /dev/ttyACM0
Remote debugging using /dev/ttyACM0
(gdb) monitor swdp_scan
Target voltage: 2.96V
Available Targets:
No. Att Driver
 1      Nordic nRF52 M4
 2      Nordic nRF52 Access Port 
(gdb) attach 1
Attaching to Remote target
warning: No executable has been specified and target does not support
determining executable automatically.  Try using the "file" command.
0xfffffffe in ?? ()
(gdb) mon erase_mass
erase..
(gdb) mon hard_srst
(gdb) detach
Detaching from program: , Remote target
[Inferior 1 (Remote target) detached]
(gdb) monitor swdp_scan
Target voltage: 2.94V
Available Targets:
No. Att Driver
 1      Nordic nRF52 M4
 2      Nordic nRF52 Access Port 
(gdb) attach 1
Attaching to Remote target
warning: No executable has been specified and target does not support
determining executable automatically.  Try using the "file" command.
0xfffffffe in ?? ()
(gdb) file ~/Downloads/Infinitime/1.2.0/merged-internal.hex
A program is being debugged already.
Are you sure you want to change the file? (y or n) y
Reading symbols from ~/Downloads/Infinitime/1.2.0/merged-internal.hex...
(No debugging symbols found in ~/Downloads/Infinitime/1.2.0/merged-internal.hex)
(gdb) load
Loading section .sec1, size 0x54a0 lma 0x0
Loading section .sec2, size 0x8000 lma 0x8000
Loading section .sec3, size 0x10000 lma 0x10000
Loading section .sec4, size 0x10000 lma 0x20000
Loading section .sec5, size 0x10000 lma 0x30000
Loading section .sec6, size 0x10000 lma 0x40000
Loading section .sec7, size 0x9970 lma 0x50000
Start address 0x00000000, load size 355856
Transfer rate: 39 KB/sec, 969 bytes/write.
(gdb) compare-sections
Section .sec1, range 0x0 -- 0x54a0: matched.
Section .sec2, range 0x8000 -- 0x10000: matched.
Section .sec3, range 0x10000 -- 0x20000: matched.
Section .sec4, range 0x20000 -- 0x30000: matched.
Section .sec5, range 0x30000 -- 0x40000: matched.
Section .sec6, range 0x40000 -- 0x50000: matched.
Section .sec7, range 0x50000 -- 0x59970: matched.
(gdb) mon hard_srst
(gdb) detach
Detaching from program: /home/lopeztel/Downloads/Infinitime/1.2.0/merged-internal.hex, Remote target
[Inferior 1 (Remote target) detached]
(gdb) quit

After consulting with the guys at the PineTime-dev Matrix channel, I was glad to confirm I was flashing the right file: merged-internal.hex from the releases page in InfiniTime github repo actually contains both the bootloader and the application firmware in a single file, so no complaints there…

But, someone also pointed out that the first devices to ship had locked bootloaders, so turns out I had to unlock it with a Segger J-Link Debug Probe (aka NRF52DK I had around here)

Pin connections:

Pin on PineTimePin on NRF52DK P20
SWDIOSWDIO
SWDCLKSWDCLK
3.3V VCCVTG
GNDGND DETECT

Then it was just a matter of issuing a couple of nrfjprog commands as stated in the wiki article Reprogramming the PineTime:

nrfjprog -f NRF52 --recover
nrfjprog -f NRF52 --program <path-to-hex>/merged-internal.hex --sectorerase
nrfjprog -f NRF42 -f NRF52 --reset

Which finally did the trick:

Now, I only need to do something about the stuck button…I attempted to seal the device with superglue and it spilled everywhere

Huge shoutout to the nice people in the PineTime-dev Matrix channel, they were very patient and helpful!


Day 14 of my 2020’s

Join 100DaysToOffload!

By lopeztel

Mexican, wannabe maker and overall linux distro enthusiast. I enjoy playing around with electronics, running, painting and reading. I started blogging as therapy and got more invested recently.

1 comment

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.