Skip to content

Adding adapter speed 5000 to target/rp2040.cfg #78

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

Closed
wants to merge 1 commit into from

Conversation

topherbuckley
Copy link

Following up on issue presented here.

This takes a simple approach of wrapping the working existing cmsis-dap.cfg into the existing named raspberrypi-swd.cfg file and adds the adapter speed 5000 line on top of that. This make the steps in the existing documentation work without issue. In order to move forward without such a wrapper the documentation would have to be modified in MANY places, in addition to adding several steps to cover the use of this in VS Code. I find this to be the cleanest solution.

If one still wants to modify the adapter speed to deal with long wiring/etc. one can simply overwrite the adapter speed in the raspberrypi-swd.cfg with the -c "adapter speed 1000" parameter as discussed in the linked thread above.

@lurch
Copy link

lurch commented Feb 10, 2023

I don't think this change does what you think it does - raspberrypi-swd.cfg is for when you're connecting the SWD pins on a Pico directly to the GPIO pins on a Raspberry Pi, as shown on page 19 of https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf

@topherbuckley topherbuckley changed the title Wrap cmsis-dap.cfg into raspberrypi-swd.cfg Add adapter speed 5000 to cmsis-dap.cfg file Feb 13, 2023
@topherbuckley
Copy link
Author

@lurch ahh! Thank you for pointing that out. Yes I had misunderstood the intent of that file. I've pushed an alternative now. This should allow the picoprobe to work as explained in the current Getting Started Guide via:

src/openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -s tcl

@topherbuckley
Copy link
Author

Alternatively, we could modify the picoprobe.cfg to wrap the cmsis-dap and update the picoprobe user guide section to use this (if cmsis-dap was intended for a more general use case).

e.g. this commit

@topherbuckley
Copy link
Author

I'm not familiar enough with the cmsis-dap and picoprobe jtag drivers to know why the picoprobe tcl/interface no longer works, but it seems the picoprobe driver hasn't seen nearly as much work as the cmsis-dap one based on the git log. Regardless, since the cmsis-dap works with the picoprobe, I don't see why not to use it (as specified in the Getting Started Guide).

@hathach
Copy link

hathach commented Feb 16, 2023

I can confirm that adapter speed 5000 is required otherwise, I will get Error: CMSIS-DAP command CMD_DAP_SWJ_CLOCK failed.. since interface/cmsis-dap.cfg is generic, we should either

  1. add new cmsis-dap-picoprobe.cfg
  2. add adapter speed 5000 to target/rp2040.cfg
  3. add -c "adapter speed 5000" as part of command (it is a bit inconvenient though).
Open On-Chip Debugger 0.11.0-g228ede43d-dirty (2022-12-23-00:38)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.
Info : Hardware thread awareness created
Info : Hardware thread awareness created
Info : RP2040 Flash Bank Command
Warn : could not read product string for device 0x239a:0xcafe: Input/Output Error
Info : Using CMSIS-DAPv2 interface with VID:PID=0x2e8a:0x000c, serial=E660C06213513538
Info : CMSIS-DAP: SWD  Supported
Info : CMSIS-DAP: FW Version = 2.0.0
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 0 SWDIO/TMS = 0 TDI = 0 TDO = 0 nTRST = 0 nRESET = 0
Error: CMSIS-DAP command CMD_DAP_SWJ_CLOCK failed.
Error: No Valid JTAG Interface Configured.
Error: No Valid JTAG Interface Configured.

@topherbuckley
Copy link
Author

2. add adapter speed 5000 to target/rp2040.cfg

@hathach I didn't consider that. That sounds more appropriate as it wouldn't modify the more generic cmsis-dap.cfg and keeps the current documentation accurate. I've force pushed that change here and reverted the change to cmsis-dap.cfg.

@topherbuckley topherbuckley changed the title Add adapter speed 5000 to cmsis-dap.cfg file Adding adapter speed 5000 to target/rp2040.cfg Feb 17, 2023
@P33M
Copy link
Contributor

P33M commented Jul 7, 2023

Openocd 0.12 will now not error out on a missing adapter speed, but will warn you (and run the interface purposefully slowly).

Warn : An adapter speed is not selected in the init scripts. OpenOCD will try to run the adapter at the low speed (100 kHz)
Warn : To remove this warnings and achieve reasonable communication speed with the target, set "adapter speed" or "jtag_rclk" in the init scripts.

Putting a default speed in rp2040.cfg isn't the right place, as the achievable speed is a function of the actual board which may have slow level shifters, line resistances etc. The command line is the right place (and the guide now reflects this), which also means users don't have to modify files in /usr/share/local if they need to reduce it.

@P33M P33M closed this Jul 7, 2023
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 this pull request may close these issues.

4 participants