RIOT-OS and SAMR21-xpro

Sources/Links:


Operating system used on laptop/computer: Debian/Ubuntu Linux

  • Install necessary packages:
sudo apt install git openocd gcc-multilib build-essential python-serial libudev-dev
tar -xjvf gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz2
  • Add toolchain to PATH:
export PATH=$PATH:<path to unzipped folder>/gcc-arm-none-eabi-9-2020-q2-update/bin
  • Add toolchain permanently to PATH (otherwise it’s necessary to do it manually after every restart):

vim ~/.profile and/or vim ~/.bashrc

  • Add the following line to the bottom and save:
export PATH=$PATH:<path to unzipped folder>/gcc-arm-none-eabi-9-2020-q2-update/bin
  • Apply changes for current shell:
source ~/.profile
source ~/.bashrc
  • Download RIOT-OS:
git clone https://github.com/RIOT-OS/RIOT.git
  • Set the rights for your user to be able to flash applications on the board:
sudo usermod -a -G dialout <username>
  • Connect the SAMR21-xpro board to your laptop/computer via micro USB cable (USB EDBG interface):

Connect the SAMR21-xpro board to your laptop/computer

  • Test building and flashing an application (to SAMR21-xpro) with the provided hello-world example:
cd RIOT/examples/hello-world
make BOARD=samr21-xpro
make BOARD=samr21-xpro flash
  • Connect to SAMR21-xpro via term:
make BOARD=samr21-xpro term
  • Or via pyterm (which is shipped with RIOT-OS):
sudo pip3 install pyserial
cd RIOT/dist/tools/pyterm
./pyterm -p /dev/ttyACM0
  • To find out the correct tty:
$ cd RIOT/examples/hello-world
$ make list-ttys
/sys/bus/usb/devices/1-3: Atmel Corp. EDBG CMSIS-DAP, serial: 'ATMLXXXXXXX80000XXX1', tty(s): ttyACM0
/sys/bus/usb/devices/1-2: Atmel Corp. EDBG CMSIS-DAP, serial: 'ATMLXXXXXXX80000XXX2', tty(s): ttyACM1
  • If you have multiple boards connected to your computer it is necessary to provide the serial during flashing:
BOARD=samr21-xpro SERIAL="ATMLXXXXXXX80000XXX1" make flash