Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
samd21:bootloader [2020/12/29 21:33]
admin [... with a Raspberry Pi]
samd21:bootloader [2020/12/30 21:15] (current)
admin [... with a Segger J-Link Programmer]
Line 5: Line 5:
 ==== ... with a Raspberry Pi ==== ==== ... with a Raspberry Pi ====
  
-One has to install OpenOCD on a Raspberry Pi:\\+One has to install OpenOCD on a Raspberry Pi (RaspbianBuster):\\
 Update and install some tools: Update and install some tools:
-  sudo apt-get update +  sudo apt-get update 
-  sudo apt-get install git autoconf libtool make pkg-config libusb-1.0-0 libusb-1.0-0-dev htop+  § sudo apt-get install git autoconf libtool make pkg-config libusb-1.0-0 libusb-1.0-0-dev htop
 Download OpenOCD from [[http://openocd.zylin.com/#/admin/projects/openocd]]: Download OpenOCD from [[http://openocd.zylin.com/#/admin/projects/openocd]]:
-  git clone http://openocd.zylin.com/openocd+  git clone http://openocd.zylin.com/openocd
 Compile: Compile:
-  cd openocd-code +  cd openocd-code 
-  ./bootstrap +  ./bootstrap 
-  ./configure --enable-sysfsgpio --enable-bcm2835gpio +  ./configure --enable-sysfsgpio --enable-bcm2835gpio 
-  make +  make 
-  sudo make install +  sudo make install 
-List of Interfaces: +List all Interfaces: 
-  cd /usr/local/share/openocd/scripts/interface +  cd /usr/local/share/openocd/scripts/interface 
-  ls +  ls 
-Downloading the Bootloader: +Make a Folder and Download the Bootloader: 
-  cd ~ +  cd ~ 
-  mkdir bootloader +  mkdir bootloader 
-  cd bootloader +  cd bootloader 
-  wget https://github.com/arduino/ArduinoCore-samd/raw/master/bootloaders/zero/samd21_sam_ba.bin +  wget https://github.com/arduino/ArduinoCore-samd/raw/master/bootloaders/zero/samd21_sam_ba.bin
-  wget https://github.com/Seeed-Studio/ArduinoCore-samd/blob/master/bootloaders/XIAOM0/bootloader-XIAO_m0-v3.7.0-33-g90ff611-dirty.bin+
 Make a Configuration File: Make a Configuration File:
-  nano openocd.cfg +  nano openocd.cfg 
-and add+and add:
   source [find interface/raspberrypi2-native.cfg]   source [find interface/raspberrypi2-native.cfg]
   transport select swd   transport select swd
Line 37: Line 36:
   reset_config  srst_nogate   reset_config  srst_nogate
      
-  adapter_nsrst_delay 100 +  adapter srst delay 400 
-  adapter_nsrst_assert_width 100 +  adapter srst pulse_width 100 
-     +   
 +  bcm2835gpio_swd_nums 25 24 
 +  bcm2835gpio_trst_num 7 
 +  bcm2835gpio_srst_num 18 
 +   
   init   init
   targets   targets
   reset halt   reset halt
 +  
 +  t91samd bootloader 0
 +  program samd21_sam_ba.bin verify
 +  at91samd bootloader 8192
 +  reset
 +  shutdown
 +
 +The GPIO pin numbers can be set here or in the raspberrypi2-native.cfg file. To do so change in:
 +  $ sudo nano /usr/local/share/openocd/scripts/interface/raspberrypi2-native.cfg
 +the following lines:
 +  bcm2835gpio_swd_nums 25 24
 +  bcm2835gpio_trst_num 7
 +  bcm2835gpio_srst_num 18
 +
 Connecting the SAMD21 Board: Connecting the SAMD21 Board:
    RasPi-GPIO  SAMD21    RasPi-GPIO  SAMD21
Line 54: Line 71:
  
 ==== ... with a Segger J-Link Programmer ==== ==== ... with a Segger J-Link Programmer ====
 +**UNDER CONSTRUCTION !**
  
 and [[https://github.com/adafruit/Adafruit_Adalink|Adalink ARM CPU Tool]]\\ and [[https://github.com/adafruit/Adafruit_Adalink|Adalink ARM CPU Tool]]\\
Line 70: Line 88:
 [[https://github.com/arduino/ArduinoCore-samd/tree/master/bootloaders/mkrzero|Arduino MKR ZERO]]\\ [[https://github.com/arduino/ArduinoCore-samd/tree/master/bootloaders/mkrzero|Arduino MKR ZERO]]\\
  
-[[https://github.com/Seeed-Studio/ArduinoCore-samd/blob/master/bootloaders/XIAOM0/bootloader-XIAO_m0-v3.7.0-33-g90ff611-dirty.bin|Seeeduino XIAO Bootloader]]\\+[[https://github.com/Seeed-Studio/ArduinoCore-samd/blob/master/bootloaders/XIAOM0/update-bootloader-XIAO_m0-v3.7.0-33-g90ff611-dirty.bin|Seeeduino XIAO Bootloader]]\\ 
 +This bootloader bever worked for me!\\
  
 ---- ----
Line 76: Line 95:
  
 [[https://learn.adafruit.com/programming-microcontrollers-using-openocd-on-raspberry-pi/compiling-openocd|Programming Microcontrollers using OpenOCD on a Raspberry Pi by Lady Ada]]\\ [[https://learn.adafruit.com/programming-microcontrollers-using-openocd-on-raspberry-pi/compiling-openocd|Programming Microcontrollers using OpenOCD on a Raspberry Pi by Lady Ada]]\\
 +
 +[[https://embeddedcomputing.weebly.com/seeeduino-xiao-m0.html|Seeeduino Xiao M0​ by Embedded Computing]]\\
  
 [[https://forum.seeedstudio.com/t/how-to-unbrick-a-dead-xiao-using-raspberry-pi-guide-openocd/253990|How to Unbrick a Dead XIAO Using Raspberry Pi by John Doe]]\\ [[https://forum.seeedstudio.com/t/how-to-unbrick-a-dead-xiao-using-raspberry-pi-guide-openocd/253990|How to Unbrick a Dead XIAO Using Raspberry Pi by John Doe]]\\
 +
 +[[http://openocd.org/doc/html/Flash-Commands.html|OpenOCD - Flash Commands]]\\
  
 ---- ----