pico-examples icon indicating copy to clipboard operation
pico-examples copied to clipboard

Recommended launch.json is slow to connect due to no "adapter speed" setting

Open recursivenomad opened this issue 2 years ago • 0 comments

Although the Getting Started documentation suggests that you should launch OpenOCD with adapter speed 5000, the launch.json examples included here (and subsequently recommended in the Getting Started guide) do not pass an adapter speed to OpenOCD, and as a result the debugger is very slow to connect and OpenOCD will output the warning:

Warn : An adapter speed is not selected in the init scripts. OpenOCD will try to run the adapter at the low speed (100 kHz)

This is 50 times slower (!) than the suggested speed of 5000 kHz, and 200 times slower (!!) than the seemingly maximum adapter speed able to be set of 20000 kHz.

Side note: The RP2040 datasheet recommends a maximum of 24 MHz. 20 MHz appears to be a consistently stable value for me, but the RP2040 datasheet does mention that cable length and quality can influence what is stable.

A simple solution to this problem would be to add the following lines to the example launch.json files (and documentation):

"openOCDLaunchCommands": [
    "adapter speed 5000"
],

Another place that may benefit from such a change could be the launch.json created by raspberrypi/pico-project-generator.

recursivenomad avatar Feb 02 '24 16:02 recursivenomad