JTAG programmer

Board

BOM

  • ATSAMD11C14A x1
  • 3.3V100MA LDO VREG SOT23 x1
  • RES 0.0 OHM x1
  • CAP 1UF x1
  • HEADER SMD 10POS 1.27MM x2

Programmer

  • Atmel-ICE

Connection

  • MacBookPro ===(USB-C to USB)=== Atmel-ICE
  • Atmel-ICE ===(SAM to J1 SWD by Atmel- ICE-cabel)=== hello.CMSIS-DAP.10.D11C board
  • hello.CMSIS-DAP.10.D11C board ===(USB-Female to USB-c)=== MacbookPro

Direction


Atmel-ICE datasheet

Set up Atmel-ICE on Mac

EDBG:Embedded Debugger

  • Download edbg
  • unzip downloaded .zip such as edbg-master
  • move the folder to home directry
  • and $ make all

install libhidapi will be required

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null
$ brew install hidapi
$ cd edbg-master
$ make all
gcc -I/usr/local/include/hidapi -W -Wall -Wextra -O2 -std=gnu11 dap.c edbg.c target.c target_atmel_cm0p.c target_atmel_cm3.c target_atmel_cm4.c target_atmel_cm7.c target_atmel_cm4v2.c target_mchp_cm23.c target_st_stm32g0.c target_gd_gd32f4xx.c  dbg_mac.c /usr/local/lib/libhidapi.a -framework IOKit -framework CoreFoundation -o edbg

Programming

Atmel-ICE is ready to use

$ lsusb
Bus 020 Device 005: ID 03eb:2141 Atmel Corporation Atmel-ICE CMSIS-DAP  Serial: J41800075942

if you don’t have lsusb, $ brew install lsusb

Download program from class page

class page: Embedded Programming
binary

$ cd Downloads/
$ ls
free_dap_d11c_mini.bin

This is how to program
program: edbg -b -t target_type -pv -f binary_file

$ edbg -b -t samd11 -pv -f free_dap_d11c_mini.bin
-bash: edbg: command not found

Get edbg PATH

$ cd
$ ls
edbg-master
$ cd edbg-master
$ ls
edbg
$ pwd
/Users/yuichitamiya/edbg-master

PATH through

$ cd
-rw-r--r--@   1 yuichitamiya  staff    1055  9  9 14:52 .bash_profile
$ printenv PATH
/usr/local/bin:/usr/bin
$ open .bash_profile

On text edditer, add edbg path and save

export PATH="/Users/yuichitamiya/edbg-master:$PATH"

On Terminal

$ source ~/.bash_profile
$ printenv PATH
/Users/yuichitamiya/edbg-master:/usr/local/bin:/usr/bin

programme again

$ cd
$ cd Downloads/
$ ls
free_dap_d11c_mini.bin
$ edbg -b -t samd11 -pv -f free_dap_d11c_mini.bin
Debugger: ATMEL Atmel-ICE CMSIS-DAP J41800075942 01.27.0082 (SJ)
Clock frequency: 16.0 MHz
Target: SAM D11C14A (Rev B)
Programming............................. done.
Verification............................. done.

recognised device
(before)

$ lsusb
Bus 020 Device 011: ID 03eb:2141 Atmel Corporation Atmel-ICE CMSIS-DAP  Serial: J41800075942

(now)

Bus 020 Device 013: ID 6666:6666 6666 Generic CMSIS-DAP Adapter  Serial: 774E439B
Bus 020 Device 011: ID 03eb:2141 Atmel Corporation Atmel-ICE CMSIS-DAP  Serial: J41800075942

if you have 2 programmers in your computer, then want to use one of them to programme, use a Serial number

$ edbg -b -t samd11 -pv -f free_dap_d11c_mini.bin
Error: more than one debugger found, please specify a serial number
$ edbg -b -t samd11 -pv -f free_dap_d11c_mini.bin -s J41800075942

bootloaderを書く

$ make -f hello.D11C.blink.make bootlader

.inoから .binを作る Arduino IDE Open hello.D11C.blink.ino

Add json file

https://www.mattairtech.com/software/arduino/package_MattairTech_index.json

Tools > board > Boards Manager > Search d11c and install

Tools>

Board: general D11C14A
Clock: INTERNAL_USB_CALIBRATED_OSCILLATOR …

Click compile button
should not open hello.D11C.blink.c, otherwise will get error when compile hello.D11C.blink.ino.bin will be save

$ cd ~/Arduino/build/
$ ls
hello.D11C.blink.ino.bin

wright to the board

$ lsusb
Bus 020 Device 008: ID 03eb:2141 Atmel Corporation Atmel-ICE CMSIS-DAP  Serial: J41800075942

$ edbg -b -t samd11 -pv -f hello.D11C.blink.ino.bin
Debugger: ATMEL Atmel-ICE CMSIS-DAP J41800075942 01.27.0082 (SJ)
Clock frequency: 16.0 MHz
Target: SAM D11C14A (Rev B)
Programming........................................ done.
Verification........................................ done.

hello echo

Bootloader

downlad bootlaoder from class site Embedded Programming > ATSAMD11C > bootloader > find bootloaders/zero/binaries/sam_ba_Generic_D11C14A_SAMD11C14A.bin and download also download from here

$ cd Downlads
$ edbg -b -t samd11 -pv -f sam_ba_Generic_D11C14A_SAMD11C14A.bin
Debugger: ATMEL Atmel-ICE CMSIS-DAP J41800075942 01.27.0082 (SJ)
Clock frequency: 16.0 MHz
Target: SAM D11C14A (Rev B)
Programming......................................... done.
Verification......................................... done.

program

$ cd ~/Arduino/build
$ ls
hello.D11C.echo.ino.bin
$ edbg -b -t samd11 -pv -f hello.D11C.echo.ino.bin
Debugger: ATMEL Atmel-ICE CMSIS-DAP J41800075942 01.27.0082 (SJ)
Clock frequency: 16.0 MHz
Target: SAM D11C14A (Rev B)
Programming......................................... done.
Verification......................................... done.

echo

$ sudo python -m serial.tools.miniter, /dev/シリアルで接続しないと続きができない

Tips

Question

Note