- Notifications
You must be signed in to change notification settings - Fork 276
Make target reset functionality work out-of-the-box #123
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
Conversation
- Correct GPIO direction logic error in `probe_assert_reset` - Remember to de-assert nRESET on deinit
| I'd be reluctant to move the UART pins as it'd make the wiring instructions in https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf invalid. |
| Understood. What pin should I assign it then? |
| That's a question that @P33M is probably better-placed to answer than I am. |
| GPIO6 is un-levelshifted uart RX input on the Debug Probe. Unfortunately only GPIO0 and 1 are the only unassigned pins broken out to somewhere accessible on that board. Why doesn't GPIO0 or 1 work as a reset output? |
| No idea, GP0/1 just doesn't respond to the code, it always stays high. When I change it to GP4 it works as expected (after all the other changes, of course). |
| I don't know how / when / where the "debug pins" are used, but I wonder if it might be clashing with |
| I've added some patches on top of the ones by @geekman. The big change is to move I've also made a minor change in that I disable the pullup for the reset pin, under the assumption that the target already has a pull one way or the other. The pull request there is https://github.com/geekman/debugprobe-dev/pull/1 and includes this nice screenshot of a reset working well from openocd using GP1 as the target: It's possible there is still some interference going on if you use GP0, but overall I'm happy with this result. |
This is the pin pair used in documentation. Signed-off-by: Sean Cross <sean@xobs.io>
This pin is normally used for UART debug output, but that is undocumented. Repurpose it as reset output. Signed-off-by: Sean Cross <sean@xobs.io>
When using GP1 as a reset line, this is necessary to overwrite the stdio function call from reusing the pin as a debug output. Signed-off-by: Sean Cross <sean@xobs.io>
| Thanks for chasing this down. I've added your commits onto the PR. |
| Merged, thanks - ignore the spurious revert message. |
| So in hindsight, perhaps the problem was that the @P33M Should there be a |
Was previously rolling with the Debug Probe default of GPIO1, but that definition appears to be due to Debug Probe's limited pinout [1]. This schematic will read easier if GPIO1 isn't shared. (Plus UART0 probably wouldn't have worked if this firmware needed to be debugged when it was shared with nRST) [1]: <raspberrypi/debugprobe#123 (comment)>
* Fix up target reset functionality. - Correct GPIO direction logic error in `probe_assert_reset` - Remember to de-assert nRESET on deinit * board_pico_config: use pin 1 for reset This pin is normally used for UART debug output, but that is undocumented. Repurpose it as reset output. Signed-off-by: Sean Cross <sean@xobs.io> * main: move stdio_uart_init() before DAP_Setup() When using GP1 as a reset line, this is necessary to overwrite the stdio function call from reusing the pin as a debug output. Signed-off-by: Sean Cross <sean@xobs.io> --------- Signed-off-by: Sean Cross <sean@xobs.io> Co-authored-by: Sean Cross <sean@xobs.io>
There are multiple problems that prevent target reset functionality from working properly:
GP1 doesn't seem to work, haven't really dug into why.
Moving to GP4 works, but this also means having to shift the UART to GP8/9.
gpio_set_dir()for the reset pin is opposite to what was intended:state = 0means assert reset, but the current logic inprobe_assert_resetpassesstatedirectly togpio_set_dir, which when0actually meansGPIO_IN. When the pin is an input state, it is pulled-up high, so reset is actually not assserted.Reset pin also needs to be de-asserted in
probe_deinit.Otherwise when a connection is first attempted and failed, nRESET will be stuck in an asserted state subsequently.
With multiple issues stacked together, target reset functionality could not be enabled easily by tweaking some
#defines,as evidenced by issue #120.
This PR should make target reset work properly now.