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 RP2040 fails if NRST pin is connected #1013

Closed
PetteriAimonen opened this issue May 5, 2022 · 8 comments · Fixed by #1045
Closed

Flashing RP2040 fails if NRST pin is connected #1013

PetteriAimonen opened this issue May 5, 2022 · 8 comments · Fixed by #1045

Comments

@PetteriAimonen
Copy link

When I connect NRST pin to RP2040, flashing fails with error Error erasing flash with vFlashErase packet:

(gdb) mon s
Target voltage: 2.93V
Available Targets:
No. Att Driver
 1      Raspberry RP2040 M0+
 2      Raspberry RP2040 M0+
 3      Raspberry RP2040 Rescue(Attach to reset!) 
(gdb) att 1
...
(gdb) load
Sending packet: $vFlashErase:10000000,0001d000#f0...Ack
Packet received: EFF
Error erasing flash with vFlashErase packet

But without NRST connected, everything works fine.

The problem seems to happen at line 553 in gdb_main.c:

		if (!flash_mode) {
			/* Reset target if first flash command! */
			/* This saves us if we're interrupted in IRQ context */
			target_reset(cur_target);
			flash_mode = 1;
		}

If I comment out the target_reset() call, flashing works ok. But even then run seems flaky.
It seems the reset by NRST pin causes black magic probe to lose connection to the RP2040, requiring new scan and attach.

I'm not sure what is the correct way to fix this, apart from just disabling NRST pin usage when connected to RP2040.

@dragonmux
Copy link
Member

Before we jump to any conclusions, could you share which version of the firmware you're using and on what hardware platform?

@PetteriAimonen
Copy link
Author

Newest git (c4869a5) on ST-LINK/V2 hardware (installed natively to the STM32F103 flash, with BMP bootloader).

@PetteriAimonen
Copy link
Author

@jamesturton @UweBonnes Have either of you tried NRST with RP2040 and BMP by any chance? It seems that it is quite common to only connect SWDIO/SWCLK in RP2040 tutorials.

@dragonmux
Copy link
Member

Thank you for the extra information - as for the issue you're hitting.. we'll be able to do some diagnosis work the start of next week when our RP2040 boards arrive specifically to check for this kind of problem.

@PetteriAimonen
Copy link
Author

Great :)

It's not a big issue and BMP seems to be working well for RP2040 development - it was surprisingly difficult to find a debug probe that supports it.

@UweBonnes
Copy link
Contributor

Can you please add "t->target_options |= CORTEXM_TOPT_INHIBIT_SRST;" at the end of rp_probe(), compile, test and report back?

@dragonmux
Copy link
Member

Uwe, we recreated this issue, it's not quite that simple and this interacts with some other things. Please let us handle it.

@UweBonnes
Copy link
Contributor

UweBonnes commented May 21, 2022

Can you please explain what the issue(s) is/are?

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

Successfully merging a pull request may close this issue.

3 participants