Flashing the Samr21 xpro

Hey everyone,

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.

Cheers, Lucas

Hi,

does anyone know if it's possible to flash this board faster in principal?

Cheers, Ludwig

we’ve used this board but don’t remember the speeds, can update monday. the speeds are quite reasonable AFAIK.

-Akshay

Hi Lucas,

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?

Best, Thomas

We get about 2KiB/s on the SAMD21 which is the same MCU.

-Akshay

Hi Thomas,

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.

Cheers, Lucas

A couple of days ago.

Flashing is slow for us too, how do you get the speed?

Hi,

my flashing speed is roughly equal to Thomas’ for the Samr21-xpro:

wrote 65536 bytes from file RIOT/tests/pnet/bin/samr21-xpro/pnet.hex in 32.083557s (1.995 KiB/s)
verified 49688 bytes in 4.114729s (11.793 KiB/s)

My openocd version: Open On-Chip Debugger 0.9.0-dev-00186-g30203b3 (2014-11-12-11:49)

Best regards, Martin

Hi again,

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)

Cheers, Lucas

Hi again,

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.

Best, Thomas

[1] http://sourceforge.net/p/openocd/mailman/message/32496519/

HI again,

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)

[1] http://openocd.zylin.com/#/c/2356/

Thanks! I will definitely give this a try.

Cheers, Lucas

Hi,

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)

I mean, how do you print those values?

Cheers,

Hi Baptiste,

these lines are copied from openocd’s shell output when executing make flash.

Best, Thomas

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)’