Well, I finally managed to get it to program successfully, though it was far from consistent. But I'll explain what worked in case it's helpful to anyone else.
After looking at "official" USB Blaster prices, yeah, there's no way mine isn't a cheap clone. I paid more than $10, but not $300.
So based on a thread (that I think NoAffinity found first) which explained that OpenOCD will error out when it can't get latency timing because that's not a feature with USB Blaster clones, I wound up messing with the OpenOCD source code to "patch" out the check.
I also shorted the R4 resistor on the dejitter board per marqs' recommendation.
And finally, I switched to a higher-current 5V power supply. The one I was initially using was rated at 700mA - and it may not have even been that high. I switched to a 2400mA supply and the OpenOCD was able to program the chip on the first try.
Just to verify it was necessary, I replaced the R4 resistor and was back to getting failures during programming. When I re-shorted R4, it took a couple of tries before I could get it to work again.
The TL;DR version of "patching" OpenOCD to work with USB Blaster clones:
Some of this will be different if you're using a Debian-based distro like Ubuntu, or unnecessary if you prefer just to 'make install', but I thought I'd post it here because as far as I know this info is no longer available anywhere else.
Download and install the Source RPM for OpenOCD 0.10.0 for your distro.
This puts the source tarball at ~/rpmbuild/SOURCES/openocd-0.10.0.tar.bz2
Unpack it:
Code: Select all
cd ~/rpmbuild/SOURCES/
tar -xf openocd-0.10.0.tar.bz2
With the source tarball extracted, edit the source file that controls the latency timer check:
Code: Select all
vim ~/rpmbuild/SOURCES/openocd-0.10.0/src/jtag/drivers/usb_blaster/ublast_access_ftdi.c
Comment out lines 105-109 and save the file:
Code: Select all
105 /* if (ftdi_get_latency_timer(ftdic, &latency_timer) < 0)
106 LOG_ERROR("unable to get latency timer");
107 else
108 LOG_DEBUG("current latency timer: %u", latency_timer);
109 */
Then while still in the directory "~/rpmbuild/SOURCES", rename the old tarball and replace it with the edited source:
Code: Select all
mv openocd-0.10.0.tar.bz2 openocd-0.10.0.tar.bz2.old
tar -cf openocd-0.10.0.tar openocd-0.10.0
bzip2 openocd-0.10.0.tar
With that done build the RPM
Code: Select all
cd ~/rpmbuild/SPECS
rpmbuild -bb openocd.spec
Of course this requires that you have "rpm-build" installed, and will probably bug you for a bunch of dependencies.
When successful rpmbuild should give you the location of the RPM
Code: Select all
Wrote: /home/user/rpmbuild/RPMS/x86_64/openocd-0.10.0-2.fc26.x86_64.rpm
Wrote: /home/user/rpmbuild/RPMS/x86_64/openocd-debuginfo-0.10.0-2.fc26.x86_64.rpm
From there just install the newly-created RPM and it will no longer check for a latency timer on USB Blaster clones.