Pocket Programmer Slow

Now that Swift for Arduino has added support for the Sparkfun Pocket Programmer I’ve started using it to burn “bootloader-free” onto my ATmega 328p’s. Everything works fine (I plug in the Pocket Programmer and “Upload”) but programs take a very long time to transfer (~4x slower than using FTDI). I am wondering where/how do I set the transfer speed for the Pocket Programmer?

I did some digging around and I found the answer.

Given the Sparkfun Pocket Programmer uses the SPI interface of the target MCU, the speed of the SPI clock significantly affects the upload speed. AVRDUDE has an option “-B” that allows setting the minimum SCK (SPI clock) period from 1 to 250 microseconds. Swift for Arduino (S4A) invokes AVRDUDE without the -B option, so the AVRDUDE default of 10 microseconds is used. I added “-B 1” to S4A’s makefile and my program that was taking 74.67 seconds to upload now takes 19.77 seconds (almost 4x faster).

From what I found, the “slow speed” SCK is only needed for target MCUs running below 4MHz. I connected with Swift for Arduino and they are going to change the default for SPI programming from 100kHz to 400kHZ in an upcoming release. In the meantime, anyone can modify the makefile by adding “-B 1” to the AVRDUDE_OPTS.

AVRDUDE_OPTS ?= -C "$(AVRDUDE_DIR)/etc/avrdude.conf" -c $(PROGRAMMER) -p $(MCU) -V -B 1

Good to know, thank you for sharing!