[riot-devel] Working on port to SODAQ Autonomo (SAMD21)

Kees Bakker kees at sodaq.com
Mon Jun 13 20:55:21 CEST 2016

On 13-06-16 09:56, Peter Kietzmann wrote:
> Hi Kees,

Hi Peter,

> nice to see your interest in RIOT! Find some comments inline.
> Am 12.06.2016 um 21:14 schrieb Kees Bakker:
>> Hi,
>> This is a heads up to let you know I'm working on a port of
>> RIOT to SODAQ Autonomo, which has an Atmel samd21 (like
>> Arduino Zero).
>> First I moved the existing cpu/samd21 tree to cpu/samr21. Then
> Why? Well *if* there is a need to change the current RIOT code base, 
> you should open a separate PR for that.

That seems like a good aproach, but I asked  a related question before 
and I was
stuck with the answer. The answer was something like: the samr21 
processor is the same
as the samd21, so for RIOT that's good enough.

> This is a question to all: How comes the Atmel samr21-xplained pro 
> board has "samd21" CPU in RIOT?

I don't know the history of how it was added. I like to understand what 
when cpu/samd21 was added. Where did the files come from? I'm guessing 
from ASF 3.18 or 3.19. ASF => Atmel Software Framework

>> I added the samd21 CMSIS files from Arduino and the board files
>> for the SODAQ Autonomo. For that, I copied several files from
>> samr21-xpro.
> What was wrong with current CMSIS headers?
> https://github.com/RIOT-OS/RIOT/tree/master/cpu/samd21/include

Well, these files are from the samr21 tree in ASF, yes samr21, not samd21

SAMR21 and SAMD21 have the same cpu. But there are tens of derivatives. The
differences are in memory size (RAM, ROM), peripherals, etc. So if you 
select a
board, you also want to select the particular flavor of the SAMx21.

Another issue here is maintenance. How do we want to follow upgrades 
from Atmel?
New cpu variants, bug fixes, etc. The best would be to have the files in 
RIOT as close as
possible to the original. And a description somewhere how to do an upgrade.

To answer the question why I wanted to move cpu/samd21 to cpu/samr21, it is
basically driven by the need for SAMD21J18A.

>> In the process I learned how to use the Atmel-ICE and how to
>> debug via openocd. Nice :-)
> Yepp :-)
>> At the moment I can step through the hello world example. But
>> I have no idea where the output is going. That's my next challenge.
> By default the STDIO is mapped to UART_DEV(0) which will generally be 
> the first device defined in the periph_conf.h file of the board. E.g.:
> https://github.com/RIOT-OS/RIOT/blob/master/boards/samr21-xpro/include/periph_conf.h#L108 
> The driver used should be common for samX21 MCUs but is currently not.
> https://github.com/RIOT-OS/RIOT/blob/master/cpu/samd21/periph/uart.c
> For Kinetis there already is a great code reusability:
> https://github.com/RIOT-OS/RIOT/tree/master/cpu/kinetis_common/periph
> However, you could try to set up a different STDIO UART device and 
> connect an external UART/USB converter to see if it's about 
> conflicting pins.

That is more or less already what I did. I filled in uart_config[] with 
two devices
and I have a serial line connect to my PC. This configuration works with 
the Arduino
setup. But not yet with RIOT.

>> Meanwhile the changes and additions are available in my fork at
>>      git at github.com:keestux/RIOT-OS
>> Branch sodaq-autonomo.
> Best
> Peter

Kees Bakker
M. 0031617737165

More information about the devel mailing list