'Atmel SAM D21 set fuses via ELF file

AVR processors can have their fuses programmed via the ELF file (see http://www.nongnu.org/avr-libc/user-manual/group__avr__fuse.html).

Is there a way to do the same for the SAM D21 ARM-based controller in AtmelStudio 6.2?



Solution 1:[1]

According to Atmel, the answer is no:

Question

Is it possible to include fuse information in elf production file for SAMDx devices?

Answer

No it is not possible to include fuse information in elf production file for SAMDx devices. Please see http://atmel.force.com/support/articles/en_US/FAQ/SAMD20-SAMD21-Programming-the-fuses-from-application-code on the recommended procedure to program the fuses from application code.

Your options appear to be:

  1. Program fuses from application code, as Atmel suggests above.
  2. Manually flip bits in the Fuses tab of Atmel Studio's Device Programming tool.
  3. Program the fuses using atprogram.exe:

Question

How to set fuse bits for SAMR21 device using atprogram.exe?

Answer

Refer to the below command for overwriting the fuses bits.

atprogram.exe -t edbg -i SWD -d ATSAMR21G18A write -fs -o 0x804000 --values 0xEFCDAB8967452301

For fuse bit details in the NVM user row refer to Table 8-3. NVM User Row Mapping, SAMR21 datasheet.

Note:

  • "-o" mentions the offset, NVM user row starts at 0x804000
  • Reverse the value byte order: for example if 0x123456789ABCDEF has to be written, pass the value as 0xEFCDAB8967452301
  • Same procedure is applicable for SAM D/L/C Cortex M0+ devices as well.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 smammy