SAM D21 Custom Board Bootloader & Programming

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

I am creating my own custom board using the ATSAMD21J18A chip. I am interested in being able to program it over the USB port with minimal additional pins needed. 

 

I am considering the "AT07175: SAM-BA Bootloader for SAM D21", which I understand I have to get preloaded on my chip or program myself over SWD (meaning I need to expose RESET, SWCLK, SWDIO, and GND through a header for one-time use). 

 

Once that is done, I either need to expose pin PA15 to force the chip into bootloader or erase the application or reset vector. The Arduino Zero or Due does a soft erase over USB by "Opening and closing the Native port at the baud rate of 1200 bps triggers a “soft erase” procedure". Is this a feature of the Arduino or the chip? I.E. Is this an alternative to exposing pin PA15 to get into the bootloader? If so, what are the risks of bricking my chip if this operation fails during a reset attempt?

 

Thanks!

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

AT07175: SAM-BA Bootloader for SAM D21 configures SAM D21 in USB CDC so that it enumerates as comport when connected to PC.

Once it is enumerated as COM port, it can be programmed using SAM-BA tool.

 

At present, AT07175: SAM-BA Bootloader for SAM D21 checks PA15 pin and application memory configure SAM D21 in USB CDC.

If no code is present in application memory or PA15 is asserted, then it configure device to USB CDC and stays in boot loader.

Otherwise it just continues to execute application code.

 

To have soft erase option,

- Bootloader should always configure the device in USB CDC and wait for any fixed command (say any character) from host.

- If host did not sent any command in fixed time (say 1~5 seconds), then it can execute application code (if present).

 

To do this, you need to modify boot loader as well as use custom tool in PC.

Your PC tool should always be polling for COM port and should send the character in the given time frame.

Also, since we wait to receive some character during reset, there is a delay in application startup.

 

Comparing to all of this, it is very simple to use one GPIO and connect it to tactile switch in enclosure.

If user press the switch and power the device, then the bootloader can be enabled.

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

how can i do a firmware update for samr21 using usb i could able to flash  application code .what are the usb function for data transmission and wait