This issue does not affect the -B option. The selected clock with -B should always work.
This is an issue with auto SCK clock selection.
My philosophy is that when using auto SCK clock selection "just works" is a higher priority than clocking as fast as possible.
This is because when using the Arduino IDE, you can't easily insert a -B option to fine tune the clock.
And when not using the IDE using -B is an easy option to use to ensure you get what you want.
There are a few coding issues in both avrdude and the USBasp code.
I'll take the detailed discussion offline with Peter but here is the high level summary:
When flashing new code, avrdude tells the USBasp device to initialize everything,
- set SCK clock to "auto"
- connect to target ISP signals
- Enter ISP programming mode.
It then reads the fuses, sends some ISP bytes using a passthrough command to erase the flash.
All this works, and the USBasp auto SCK code properly picks a 1Khz clock.
(It could work faster but that is currently the only clock rate available in the auto selection code)
After waiting a small period of time, avrdude calls some code to re-initialize the USBasp device,
which does the same sequence above which sets the clock back to auto select, and does a "CONNECT" again, even though the ISP signals are already connected.
The connect code then ends up picking 16Khz clock this time.
Then when the Enter ISP programming mode command comes in, it fails to sync with the target which is running at about 32768 Hz.
The odd part is that in order for the auto SCK code to pick a clock it had to enter programming mode using the selected clock.
The auto SCK code then resets the target to allow the next enter programming mode to work.
I think what is happening is that the sequence that avrdude is using is triggering something in the USBasp f/w that is not properly handling the ISP signals. There may be an issue with unreset in that the timing may be too short at such a slow clock, or it could be that avrdude is not waiting long enough after sending the chip erase using a pass through command.
Anyway, I'm about to start digging into it.
I've got gdb up and running on avrdude, which is quite helpful to see what is happening.
The reason I asked about what the popular clock rates were is that if 32768 is used more often than clocks between 64Khz and 375Khz, the auto select table could be altered to make things work for 32khz if it turns out that the auto sck code can't be made robust for this frequency.
At this point, I still believe that the auto sck code can be made better to handle it.
--- bill