pix / heystack-nrf5x

A openhaystack compatible firmware for NRF51 and NRF52 devices
5 stars 3 forks source link

nRF51822 seems to not work after flashing #10

Open KlausMu opened 1 week ago

KlausMu commented 1 week ago

I went through the README to flash a nRF51822. To my understanding, everything worked as expected. But after flashing, I can't see the tag, neither in "Android nRF Connect", nor can the tag being added to "Find My" in an iPhone.

The tag is from AliExpress (HolyIoT) and looks like this: image image image

The command for flashing was

make stflash-nrf51822_xxac-patched ADV_KEYS_FILE=/home/klaus/projects/airtag/heystack-nrf5x/tools/output-nrf51822-2/nrf51822-2_keyfile ADVERTISING_INTERVAL=2000 KEY_ROTATION_INTERVAL=3600*12 MAX_KEYS=50 HAS_DEBUG=1

Log while flashing was:

merging application and softdevice... : nrf51822_xxac
mergehex -m _build/nrf51822_xxac.hex ../../nrf-sdk/nRF5_SDK_12.3.0_d7731ad/components/softdevice/s130/hex/s130_nrf51_2.0.1_softdevice.hex -o _build/nrf51822_xxac_s130.hex
Parsing input files.
Merging file "nrf51822_xxac.hex" into output.
Merging file "s130_nrf51_2.0.1_softdevice.hex" into output.
Storing merged file.
hex2bin.py _build/nrf51822_xxac_s130.hex _build/nrf51822_xxac_s130.bin
Patching nrf51822_xxac
cp _build/nrf51822_xxac_s130.bin _build/nrf51822_xxac_s130_patched.bin
xxd -p -c 100000 /home/klaus/projects/airtag/heystack-nrf5x/tools/output-nrf51822-2/nrf51822-2_keyfile | xxd -r -p | dd of=_build/nrf51822_xxac_s130_patched.bin skip=1 bs=1 seek=116704 conv=notrunc
1400+0 records in
1400+0 records out
1400 bytes (1.4 kB, 1.4 KiB) copied, 0.00267036 s, 524 kB/s
xxd -p -c 100000 _build/nrf51822_xxac_s130_patched.bin | grep -q 454e444f464b455953454e444f464b455953454e444f464b45595321 || (echo "The key was not patched correctly!"; exit 1)
"/home/klaus/projects/airtag/heystack-nrf5x/nrf-sdk/gcc-arm-none-eabi-6-2017-q2-update/bin/arm-none-eabi-objcopy" -I binary -O elf32-littlearm -B arm _build/nrf51822_xxac_s130_patched.bin _build/nrf51822_xxac_s130_patched.elf
flashing application and softdevice...␍
openocd -f openocd.cfg -c "init; halt; nrf51 mass_erase; program _build/nrf51822_xxac_s130_patched.bin verify; reset; exit";
Open On-Chip Debugger 0.12.0
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : clock speed 1000 kHz
Info : STLINK V2J37S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.098182
Info : [nrf51.cpu] Cortex-M0 r0p0 processor detected
Info : [nrf51.cpu] target has 4 breakpoints, 2 watchpoints
Info : starting gdb server for nrf51.cpu on 3333
Info : Listening on port 3333 for gdb connections
[nrf51.cpu] halted due to debug-request, current mode: Thread 
xPSR: 0x61000000 pc: 0x00011434 msp: 0x20003fd8
Info : nRF51822-QFAA(build code: H0) 256kB Flash, 16kB RAM
Info : Mass erase completed.
Info : A reset or power cycle is required if the flash was protected before.
[nrf51.cpu] halted due to debug-request, current mode: Thread 
xPSR: 0xc1000000 pc: 0xfffffffe msp: 0xfffffffc
** Programming Started **
Warn : Adding extra erase range, 0x0001ce20 .. 0x0001cfff
** Programming Finished **
** Verify Started **
** Verified OK **

Log from strtt is:

./strtt -v 4
Debug: 1 0 stlink.c:4163 stlink_open(): stlink_open
Debug: 2 0 stlink.c:4177 stlink_open(): transport: 4 vid: 0x0483 pid: 0x3748 serial: not provided
Debug: 3 0 stlink.c:4177 stlink_open(): transport: 4 vid: 0x0483 pid: 0x374b serial: not provided
Debug: 4 0 stlink.c:4177 stlink_open(): transport: 4 vid: 0x0483 pid: 0x3752 serial: not provided
Debug: 5 0 stlink.c:4177 stlink_open(): transport: 4 vid: 0x0483 pid: 0x374d serial: not provided
Debug: 6 0 stlink.c:4177 stlink_open(): transport: 4 vid: 0x0483 pid: 0x374e serial: not provided
Debug: 7 0 stlink.c:4177 stlink_open(): transport: 4 vid: 0x0483 pid: 0x374f serial: not provided
Debug: 8 0 stlink.c:4177 stlink_open(): transport: 4 vid: 0x0483 pid: 0x3753 serial: not provided
Debug: 9 0 stlink.c:4177 stlink_open(): transport: 4 vid: 0x0483 pid: 0x3754 serial: not provided
Info : 10 3 stlink.c:1507 stlink_usb_version(): STLINK V2J37S7 (API v2) VID:PID 0483:3748
Debug: 11 4 stlink.c:1735 stlink_usb_exit_mode(): MODE: 0x00
Info : 12 58 stlink.c:1543 stlink_usb_check_voltage(): Target voltage: 3.099327
Debug: 13 58 stlink.c:1808 stlink_usb_init_mode(): MODE: 0x01
Debug: 14 58 stlink.c:3479 stlink_dump_speed_map(): Supported clock speeds are:
Debug: 15 58 stlink.c:3482 stlink_dump_speed_map(): 4000 kHz
Debug: 16 58 stlink.c:3482 stlink_dump_speed_map(): 1800 kHz
Debug: 17 58 stlink.c:3482 stlink_dump_speed_map(): 1200 kHz
Debug: 18 58 stlink.c:3482 stlink_dump_speed_map(): 950 kHz
Debug: 19 58 stlink.c:3482 stlink_dump_speed_map(): 480 kHz
Debug: 20 58 stlink.c:3482 stlink_dump_speed_map(): 240 kHz
Debug: 21 58 stlink.c:3482 stlink_dump_speed_map(): 125 kHz
Debug: 22 58 stlink.c:3482 stlink_dump_speed_map(): 100 kHz
Debug: 23 58 stlink.c:3482 stlink_dump_speed_map(): 50 kHz
Debug: 24 58 stlink.c:3482 stlink_dump_speed_map(): 25 kHz
Debug: 25 58 stlink.c:3482 stlink_dump_speed_map(): 15 kHz
Debug: 26 58 stlink.c:3482 stlink_dump_speed_map(): 5 kHz
Debug: 27 62 stlink.c:1876 stlink_usb_init_mode(): MODE: 0x02
Debug: 28 62 stlink.c:4356 stlink_usb_init_access_port(): init ap_num = 0
Debug: 29 63 stlink.c:4503 stlink_usb_open_ap(): AP 0 enabled
Debug: 30 65 stlink.c:4261 stlink_open(): Using TAR autoincrement: 1024
Debug: 31 186 strtt.cpp:160 findRtt(): RTT addr = 0x200029e8
Debug: 32 186 strtt.cpp:186 findRtt(): Max number of buffers UP: 2 and DOWN: 2
Info : 33 188 strtt.cpp:215 getRttDesc(): 0. Channel name: Terminal     size: 512       mode: 0
Info : 34 188 strtt.cpp:221 getRttDesc(): 1. Channel name: -------      size: 0 mode: 0
Info : 35 189 strtt.cpp:215 getRttDesc(): 2. Channel name: Terminal     size: 16        mode: 0
Info : 36 189 strtt.cpp:221 getRttDesc(): 3. Channel name: -------      size: 0 mode: 0
Debug: 37 199 strtt.cpp:326 readRtt(): Chanel: 0 readed: 440
:INFO:[KEYS] Last filled index: 48
:INFO:[TIMING] Full key rotation interval: 2073600 seconds (576.00 hours)
:INFO:[TIMING] Rotation per Day: 0.04
:INFO:Starting advertising
:INFO:ble_set_mac_address: eb:fe:8c:1b:xx:xx
:INFO:ble_set_max_tx_power: 8 dBm failed
:INFO:ble_set_max_tx_power: 7 dBm failed
:INFO:ble_set_max_tx_power: 6 dBm failed
:INFO:ble_set_max_tx_power: 5 dBm failed
:INFO:ble_set_max_tx_power: 4 dBm
:INFO:Rotating key: 46
pix commented 5 days ago

I'll take a look, It seems https://github.com/pix/heystack-nrf5x/issues/7 has the same problem. I have these tags on a previous firmware version.