SAM D20, programming using Open OCD

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have just ordered the Atmel-ICE from Mouser and it will take a week to be delivered. So in the mean time, I had a spare Raspberry Pi 3 lying around which I decided to convert into an Open OCD SWD debugger using Adafruit's tutorial. So my question is, do I need to flash the SAM-BA bootloader before I flash the bin/hex/elf file of an application built on Atmel Studio 7 using ASF ? Or can I directly flash the hex/bin file ?

This topic has a solution.

Newbie to the world of Atmel SAM D microcontrollers.

Last Edited: Thu. Jan 19, 2017 - 12:23 PM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

you don't need sam-ba for swd loading or debugging. yes, you can directly flash the bin/hex file.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks Kartman for the quick reply. Am I better of flashing the hex file or the bin file ? This is using the Open OCD flash command right ? 

Newbie to the world of Atmel SAM D microcontrollers.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

** Wrong post - admin please delete **

Last Edited: Mon. Jan 30, 2017 - 10:56 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:

you don't need sam-ba for swd loading or debugging. yes, you can directly flash the bin/hex file.

 

Hey Russell,
 

I flashed the hex file onto the SAMD20G using OpenOCD. After which, I configure the OpenOCD to only init and targets.  If I run "sudo openocd", the state is shown as "running". But if I power cycle and run "sudo openocd", the state is shown as "reset". Does this mean a bootloader is necessary if there is going to be a powercycle after flashing the SAMD20 ? Or is it because the WatchDog hasn't been disabled ?

Newbie to the world of Atmel SAM D microcontrollers.

Last Edited: Mon. Jan 30, 2017 - 11:14 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

you shouldn't need a bootloader - openocd loads the code. I did a quick Google for samd21 openocd

https://community.atmel.com/forum...

samd20/21 are similar

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Cheers Russell, you have been very helpful mate.
I have a feeling the power cycle was leading to Reset which is active low, remaining in that state. Hardware guys haven't put a capacitor or pull resistor(100K) for that pin. I'll ask them to look into it and double check tomorrow. 

Newbie to the world of Atmel SAM D microcontrollers.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Kartman wrote:
samd20/21 are similar

Indeed; and, as far as debugging/programming, they are identical.

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...