I’ve been playing around with the Samr21 xpro and flashing
the device is _really_ slow, i.e. 0.481 KiB/s. Is this expected
or is there a way to improve it? I’m using the current OpenOCD
Git HEAD because the 0.8.0 release does not seem to contain the
configs for the board yet. I tried to flash the hello-world
example.
I was playing with the openocd configuration a bit, mainly
`adapter_speed`, back when support for this was added without
any significant outcome.
Problem is, the EDBG chip, on the bottom of the board, handling
communication with the MCU is specified to run on 1MHz and the
openocd docs mention, for CMSIS-DAP, it is not advised to let
signal frequency exceed half of the operating frequency.
(I’d guess Nyquist-Shannon applies)
That said, 0.481KiB/s still seems slow for this. I’m at least
reaching 1.787KiB/s for flashing and 11.190KiB/s for verification.
When did you check out the OpenOCD code?
verification was much faster as 0.4KiB/s, I think around 10 or so for me.
I checked out OpenOCD on the 9th. I’m also running Linux inside VMware
though, so maybe it’s just caused by the virtualization. I’ll see how fast
it is on the host.
so it seems that the slowness was caused by virtualization after all. My previous VM was an Ubuntu 13.10 running inside an older version of VMware Fusion, which resulted in the ~0.5KiB/s speed. After installing an Ubuntu 14.10 that went up to ~1.5KiB/s and running OpenOCD directly on the host gets me close to 2KiB/s when flashing.
On OS X 10.9:
wrote 32768 bytes from file hello-world.hex in 16.164614s (1.980 KiB/s)
verified 16892 bytes in 1.463347s (11.273 KiB/s)
On Ubuntu 14.10:
wrote 32768 bytes from file /home/lucas/RIOT/examples/hello-world/bin/samr21-xpro/hello-world.hex in 22.042933s (1.452 KiB/s)
verified 16892 bytes in 1.505869s (10.955 KiB/s)
after some research I found this post [1] on the openocd mailing list
explaining why flashing the samr21-xpro is unbearably slow.
tl;dr
The openocd cmsis-dap driver operates in synchronous operation
and is not ported to a new asynchronous API yet.
Fingers crossed they port it soon.
with this patch [1] time needed to flash the samr21 gets divided
by factor 3. (numbers below) For someone doing it very often this
could be very interesting. It is still worked on but I tested it
without error for now.
Please provide feedback if you use this, as openocd guys are desperately
looking for EDBG testers.
Best, Thomas
with patch:
wrote 32768 bytes from file hello-world.hex in 5.071708s (6.310 KiB/s) │
verified 16600 bytes in 1.374114s (11.797 KiB/s)
without patch
wrote 32768 bytes from file hello-world.hex in 16.532793s (1.936 KiB/s)
verified 16600 bytes in 1.432996s (11.313 KiB/s)
I tried the patch Thomas mentioned, it works great! Much faster.
I only wonder how you get this:
wrote 32768 bytes from file hello-world.hex in 5.071708s (6.310 KiB/s) │
verified 16600 bytes in 1.374114s (11.797 KiB/s)
Do you add any arguments?
I don’t see those output with a ‘make flash BOARD=samr21-xpro’
I use
‘Open On-Chip Debugger 0.9.0-dev-00186-g30203b3-dirty (2014-11-07-18:38)’