OpenOCD Troubleshooting: Adapter Speed Not Selected

You run OpenOCD, and you see this error:

Error: An adapter speed is not selected in the init script. Insert a call to adapter_khz or jtag_rclk to proceed.

You will most likely see this error with the original TinCanTools Flyswatter an OpenOCD build that supports the Flyswatter2. OpenOCD now expects the flyswatter.cfg file to specify an adapter speed, and throws an error when it doesn't. This guide will demonstrate how to fix the problem.

Step 1: Find Your Interface Config File
Find the config file for your interface device. For the Flyswatter this file is called flyswatter.cfg located in your interface folder. Open this file in a text editor.

Step 2: Look for a Line Reading jtag_khz
Search the file for a line reading jtag_khz followed by a number. The jtag_khz call has been replaced by adapter_khz in the latest version is no longer supported by OpenOCD. Replace the word jtag_khz with the word adapter_khz, leaving the number unchanged.

If the file does not contain a jtag_khz call, proceed to Step 3. (You may skip Step 2 with the Flyswatter. The flyswatter.cfg file distributed with OpenOCD does not contain a jtag_khz line.)

Step 3: Specify an Adapter Speed
If you found a jtag_khz line in Step 2, skip this step. If you did not find a jtag_khz line, add a line at the bottom of the file specifying an adapter speed (in kHz). For the flyswatter, use 6000 kHz. The line should read like this:

adapter_khz 6000

See the image to the right. For other hardware, contact the manufacturer to obtain the correct clock speed.

OpenOCD should now be able to communicate with your hardware correctly.