zilluss / Open-Nuki-Fob

Open Source Nuki Fob based on the the NRF52832 SoC
GNU General Public License v3.0
26 stars 8 forks source link

Help with flashing #3

Closed thbiela closed 2 years ago

thbiela commented 2 years ago

I have now bought two NRF52832 ibeacons. I am trying to flash them using a STLinkV2.

I used the tagged v.0.3 branch. I have downloaded the build files and the nRF5 SDK.

My openocd directory looks like this:

image

Then I use the following commands to flash the data:

.\openocd.exe -d2 -f openocd.cfg -c 'init_reset halt; init; halt; nrf5 mass_erase; reset; exit'
.\openocd.exe -d2 -f openocd.cfg -c 'init_reset halt; init; halt; program s132_nrf52_7.2.0_softdevice.hex verify; reset; exit'
.\openocd.exe -d2 -f openocd.cfg -c 'init_reset halt; init; halt; program nrf52832_xxaa.hex verify; reset; exit'

This is the output:

 .\openocd.exe -d2 -f openocd.cfg -c 'init_reset halt; init; halt; nrf5 mass_erase; reset; exit'
xPack OpenOCD x86_64 Open On-Chip Debugger 0.11.0+dev (2021-10-16-21:19)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
debug_level: 2

WARNING: interface/stlink-v2.cfg is deprecated, please switch to interface/stlink.cfg
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 V2J37S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.146009
Info : nrf52.cpu: Cortex-M4 r0p1 processor detected
Info : nrf52.cpu: target has 6 breakpoints, 4 watchpoints
Info : starting gdb server for nrf52.cpu on 3333
Info : Listening on port 3333 for gdb connections
target halted due to debug-request, current mode: Handler SVCall
xPSR: 0x6100000b pc: 0x00025278 msp: 0x2000fef0
Info : nRF52832-QFAA(build code: E1) 512kB Flash, 64kB RAM
Info : Mass erase completed.
 .\openocd.exe -d2 -f openocd.cfg -c 'init_reset halt; init; halt; program s132_nrf52_7.2.0_softdevice.hex verify; reset; exit'
[...]
Info : clock speed 1000 kHz
Info : STLINK V2J37S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.161583
Info : nrf52.cpu: Cortex-M4 r0p1 processor detected
Info : nrf52.cpu: target has 6 breakpoints, 4 watchpoints
Info : starting gdb server for nrf52.cpu on 3333
Info : Listening on port 3333 for gdb connections
target halted due to debug-request, current mode: Handler HardFault
xPSR: 0x01000003 pc: 0xfffffffe msp: 0xffffffd8
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
** Programming Started **
Info : nRF52832-QFAA(build code: E1) 512kB Flash, 64kB RAM
Info : Padding image section 0 at 0x00000b00 with 1280 bytes
Warn : Adding extra erase range, 0x0002596c .. 0x00025fff
** Programming Finished **
** Verify Started **
** Verified OK **
.\openocd.exe -d2 -f openocd.cfg -c 'init_reset halt; init; halt; program nrf52832_xxaa.hex verify; reset; exit'
[...]
Info : clock speed 1000 kHz
Info : STLINK V2J37S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.144452
Info : nrf52.cpu: Cortex-M4 r0p1 processor detected
Info : nrf52.cpu: target has 6 breakpoints, 4 watchpoints
Info : starting gdb server for nrf52.cpu on 3333
Info : Listening on port 3333 for gdb connections
target halted due to debug-request, current mode: Thread
xPSR: 0x61000000 pc: 0x00025316 msp: 0x200013b8
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00000a80 msp: 0x20000400
** Programming Started **
Info : nRF52832-QFAA(build code: E1) 512kB Flash, 64kB RAM
Warn : Adding extra erase range, 0x00039df0 .. 0x00039fff
** Programming Finished **
** Verify Started **
** Verified OK **

So it seems that everything has been flashed fine. But the ibeacon stays dead, the led does not light up after holding the button. Any idea what I could try? I also tried to change to order of flashing operations, unfortunately it did not help.

Thanks.

kyto247 commented 2 years ago

I actually have same issue after flashing the .hex file. The NRF52832 stays dead and does not light up after the flashing . It would be great to get this working, any input would be great. Tks

thbiela commented 2 years ago

@kyto247 have you made any progress?

kyto247 commented 2 years ago

@kyto247 have you made any progress?

It was probably a good few weeks back now that I last tried flashing the NRF52832. It seemed to flash fine on openocd with the ST link, but the beacon just stayed dead to me. I previously tried the NRF51822 beacon firmware, but had no success either. Maybe I did not do it right but I think I probably did. I used openocd successfully few years back reviving a bricked linkstation nas via JTAG.

thbiela commented 2 years ago

@zilluss could you help us, please?

zilluss commented 2 years ago

@thbiela Can you upload a photo of the Beacon? Radioland Shenzhen updated the PCB with different pins for the LED and button. I'll upload a new firmware (along with some improvements) for the PCB you have.

thbiela commented 2 years ago

Hi zilluss,

that would be wonderful! Is this picture ok?

IMG_20220530_071511

Best regards, Thomas

zilluss commented 2 years ago

nrf52832_xxaa.hex.zip

Please try this file (This is the new version I didn't get to push to GH, it supports up to 50 locks and unlocks much faster).

thbiela commented 2 years ago

You are my hero! It works perfectly. Thank you very much.