Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flashing NRF52832Y #4

Open
jrperson opened this issue Oct 7, 2024 · 4 comments
Open

Flashing NRF52832Y #4

jrperson opened this issue Oct 7, 2024 · 4 comments

Comments

@jrperson
Copy link

jrperson commented Oct 7, 2024

I am having an issue trying to flash the NRF52832Y board and was wondering if anyone has configurations for successfully doing so.

I tried flashing it using an ST-Link V2 with the default Openocd.cfg

source [find interface/stlink-v2.cfg]
source [find target/nrf52.cfg]

This results in an error

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.

I then tried flashing it using a Raspberry Pi

source [find interface/raspberrypi-native.cfg]
transport select swd
source [find target/nrf52.cfg]

This get me an error as well

Error: Error connecting DP: cannot read IDR

I also tried "transport select hla_swd" but get error

Debug adapter doesn't support 'hla_swd' transport

@pix
Copy link
Owner

pix commented Oct 10, 2024

Yup. Some NRF52 are locked. You either need a real stlink (not a cheap clone) or another programmer (a jlink, a genuine stlink, a black magic probe, a daplink...)

Alternatively, you can flash Black Magic Probe firmware on your stlink (eg: what I've done):

  • Get the black magic probe source firmware (master branch)
  • Modify the stlink.ini file:
[binaries]
c = 'arm-none-eabi-gcc'
cpp = 'arm-none-eabi-g++'
ld = 'arm-none-eabi-gcc'
ar = 'arm-none-eabi-ar'
nm = 'arm-none-eabi-nm'
strip = 'arm-none-eabi-strip'
objcopy = 'arm-none-eabi-objcopy'
objdump = 'arm-none-eabi-objdump'
size = 'arm-none-eabi-size'

[host_machine]
system = 'bare-metal'
cpu_family = 'arm'
cpu = 'arm'
endian = 'little'

[project options]
probe = 'stlink'
targets = 'cortexm,nrf,nxp,rp,sam,stm'
rtt_support = true
stlink_swim_nrst_as_uart = false
bmd_bootloader = true
  • Flash the resulting firmware on your stlink:
  14045   st-flash write build/blackmagic_stlink_bootloader.bin 0x8000000                                                                                                                                                                     
  14046   st-flash write build/blackmagic_stlink_firmware.bin 0x8002000  

Once flashed, you can flash it using the makefile:

make bmpflash-nrf52832_xxaa-patched ....

@pix
Copy link
Owner

pix commented Oct 13, 2024

Have you manage to flash it ?

@jrperson
Copy link
Author

I haven't. I have been struggling with building BMP for the stlink. In the current version when I make and compile I get the firmware.bin, but I do not get the bootloader.bin. I get a bootloader.elf.p file when I do the make.

I ordered a BMP v2.3 board so I can just use it without having to fiddle with things. I'll update when I get the board and try to flash the nrf52832

@pix
Copy link
Owner

pix commented Oct 15, 2024

If I recall correctly, you can built it like that:

❯ meson setup build --cross-file cross-file/stlink.ini --reconfigure
❯ meson compile -C build boot-bin bin
❯ find -iname '*.bin'
./build/blackmagic_stlink_firmware.bin
./build/blackmagic_stlink_bootloader.bin

I can send them to you if you need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants