Mine works OK with ATtiny AVRs.
AVR Studio will tell you which programmers and debuggers work with a particular chip, when you select it.
I have a (band-aid) fix for the issue and two guesses for what might be the underlying cause. I'll give my fix first.
(Disclaimer: I'm not very knowledgeable about pyOCD or pyusb and my fix here was purely heuristically derived. This fix may very well screw up some other functionality of pyOCD or pyusb.)
Increase the pyusb serial write timeout. I'm not sure what the default timeout is, but I got roughly the same failure frequency when I set the write timeout to 1000ms. 2000ms seemed long enough to consistently succeed.
Here's where to change the timeout. Note that I installed pyusb and pyOCD with pip in the default locations on Ubuntu 14.04, which put the file at /usr/local/lib/python2.7/dist-packages/usb/core.py
.
Function self.device.write(), at core.py:349 (part of pyusb 1.0.0rcl).
Before (full function for context):
def write(self, data, timeout = None):
r"""Write data to the endpoint.
The parameter data contains the data to be sent to the endpoint and
timeout is the time limit of the operation. The transfer type and
endpoint address are automatically inferred.
The method returns the number of bytes written.
For details, see the Device.write() method.
"""
return self.device.write(self, data, timeout)
After (only change is default timeout value):
def write(self, data, timeout = 2000):
r"""Write data to the endpoint.
[ ... ]
"""
return self.device.write(self, data, timeout)
Now for my guesses about the underlying issue.
- I'm running Ubuntu 14.04 as a guest VM via VirtualBox 5.0.0, so it may be that there's some extra latency to the USB endpoint since the USB device has to be mounted through the VM framework.
- Some bug with pyusb, pyOCD, or the target firmware.
I suspect #1 more than #2. Testing a similar setup natively on Windows (pyocd_win), I don't have any loading timeout issues.
Best Answer
just test it with OpenOCD and Atmel ICE via CMSIS-DAP - and it's working fine.