Feather M0 Remains in Bootloader Mode After Programming

When I program my Feather M0 with Rust, it remains in bootloader mode after programming with a slow blink of the LED, but says the programming was successful.

The method I followed for programming is described here:

I am trying to program it with the example found here:

My Feather M0 stays in bootloader mode after programming. I have verified I can program the board in Arduino with the basic "blink" sketch and my board does work, so I know it's not a board issue.

Does anybody know what I am missing?

I also pulled the command for programming from the verbose output of the Arduino IDE and plugged in the Rust binary. Also I programmed it with Bossac version 1.9 see next output section. Here is my output for programming, with Bossac version 1.7:

/home/beachbum/.arduino15/packages/arduino/tools/bossac/1.7.0-arduino3/bossac -i -d --port=ttyACM0 -U true -i -e -w -v /home/beachbum/projects/Feather1/feather1/target/thumbv6m-none-eabi/debug/feather1.bin
Set binary mode
readWord(addr=0)=0x20002dd8
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
version()=v1.1 [Arduino:XYZ] May 12 2018 18:17:10
chipId=0x10010005
Connected at 921600 baud
readWord(addr=0)=0x20002dd8
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
Atmel SMART device 0x10010005 found
write(addr=0x20004000,size=0x34)
writeWord(addr=0x20004030,value=0x10)
writeWord(addr=0x20004020,value=0x20008000)
Device       : ATSAMD21G18A
readWord(addr=0)=0x20002dd8
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
Chip ID      : 10010005
version()=v1.1 [Arduino:XYZ] May 12 2018 18:17:10
Version      : v1.1 [Arduino:XYZ] May 12 2018 18:17:10
Address      : 8192
Pages        : 3968
Page Size    : 64 bytes
Total Size   : 248KB
Planes       : 1
Lock Regions : 16
Locked       : readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
none
readWord(addr=0x41004018)=0
Security     : false
Boot Flash   : true
readWord(addr=0x40000834)=0x7000a
BOD          : true
readWord(addr=0x40000834)=0x7000a
BOR          : true
Arduino      : FAST_CHIP_ERASE
Arduino      : FAST_MULTI_PAGE_WRITE
Arduino      : CAN_CHECKSUM_MEMORY_BUFFER
Erase flash
chipErase(addr=0x2000)
done in 0.889 seconds

Write 17732 bytes to flash (278 pages)
write(addr=0x20005000,size=0x1000)
writeBuffer(scr_addr=0x20005000, dst_addr=0x2000, size=0x1000)
[======                        ] 23% (64/278 pages)write(addr=0x20005000,size=0x1000)
writeBuffer(scr_addr=0x20005000, dst_addr=0x3000, size=0x1000)
[=============                 ] 46% (128/278 pages)write(addr=0x20005000,size=0x1000)
writeBuffer(scr_addr=0x20005000, dst_addr=0x4000, size=0x1000)
[====================          ] 69% (192/278 pages)write(addr=0x20005000,size=0x1000)
writeBuffer(scr_addr=0x20005000, dst_addr=0x5000, size=0x1000)
[===========================   ] 92% (256/278 pages)write(addr=0x20005000,size=0x580)
writeBuffer(scr_addr=0x20005000, dst_addr=0x6000, size=0x580)
[==============================] 100% (278/278 pages)
done in 0.140 seconds

Verify 17732 bytes of flash with checksum.
checksumBuffer(start_addr=0x2000, size=0x1000) = b715
checksumBuffer(start_addr=0x3000, size=0x1000) = 5b60
checksumBuffer(start_addr=0x4000, size=0x1000) = 3de8
checksumBuffer(start_addr=0x5000, size=0x1000) = 588e
checksumBuffer(start_addr=0x6000, size=0x544) = ff80
Verify successful
done in 0.024 seconds

Programming using bossac version 1.9 output:

bossac -i -d -e -w -v -b -R --offset=0x2000 /home/beachbum/projects/Feather1/feather1/target/thumbv6m-none-eabi/debug/feather1.bin
Set binary mode
version()=v1.1 [Arduino:XYZ] May 12 2018 18:17:10
Connected at 921600 baud
readWord(addr=0)=0x20002dd8
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
write(addr=0x20004000,size=0x34)
writeWord(addr=0x20004030,value=0x10)
writeWord(addr=0x20004020,value=0x20008000)
version()=v1.1 [Arduino:XYZ] May 12 2018 18:17:10
readWord(addr=0x41004018)=0
readByte(addr=0x804001)=0xc7
readByte(addr=0x804001)=0xc7
readByte(addr=0x804006)=0xff
readByte(addr=0x804007)=0xff
Device       : ATSAMD21x18
Version      : v1.1 [Arduino:XYZ] May 12 2018 18:17:10
Address      : 0x0
Pages        : 4096
Page Size    : 64 bytes
Total Size   : 256KB
Planes       : 1
Lock Regions : 16
Locked       : none
Security     : false
BOD          : true
BOR          : true
Erase flash
chipErase(addr=0x2000)

Done in 0.889 seconds
Write 17732 bytes to flash (278 pages)
[                              ] 0% (0/278 pages)write(addr=0x20004034,size=0x1000)
writeBuffer(scr_addr=0x20004034, dst_addr=0x2000, size=0x1000)
[======                        ] 23% (64/278 pages)write(addr=0x20004034,size=0x1000)
writeBuffer(scr_addr=0x20004034, dst_addr=0x3000, size=0x1000)
[=============                 ] 46% (128/278 pages)write(addr=0x20004034,size=0x1000)
writeBuffer(scr_addr=0x20004034, dst_addr=0x4000, size=0x1000)
[====================          ] 69% (192/278 pages)write(addr=0x20004034,size=0x1000)
writeBuffer(scr_addr=0x20004034, dst_addr=0x5000, size=0x1000)
[===========================   ] 92% (256/278 pages)write(addr=0x20004034,size=0x580)
writeBuffer(scr_addr=0x20004034, dst_addr=0x6000, size=0x580)
[==============================] 100% (278/278 pages)
Done in 0.128 seconds
Verify 17732 bytes of flash
checksumBuffer(start_addr=0x2000, size=0x40) = dc11
checksumBuffer(start_addr=0x2040, size=0x40) = 52e3
read(addr=0x2040,size=0x40)
checksumBuffer(start_addr=0x2080, size=0x40) = 701c
read(addr=0x2080,size=0x40)
checksumBuffer(start_addr=0x20c0, size=0x40) = 7d21
read(addr=0x20c0,size=0x40)
checksumBuffer(start_addr=0x2100, size=0x40) = ae1c
read(addr=0x2100,size=0x40)
checksumBuffer(start_addr=0x2140, size=0x40) = 24d5
read(addr=0x2140,size=0x40)
checksumBuffer(start_addr=0x2180, size=0x40) = 8794
read(addr=0x2180,size=0x40)
checksumBuffer(start_addr=0x21c0, size=0x40) = 632d
read(addr=0x21c0,size=0x40)
checksumBuffer(start_addr=0x2200, size=0x40) = c236
read(addr=0x2200,size=0x40)
checksumBuffer(start_addr=0x2240, size=0x40) = f73a
read(addr=0x2240,size=0x40)
[=                             ] 3% (10/278 pages)checksumBuffer(start_addr=0x2280, size=0x40) = 6225
read(addr=0x2280,size=0x40)
[=                             ] 3% (11/278 pages)checksumBuffer(start_addr=0x22c0, size=0x40) = 36c5
read(addr=0x22c0,size=0x40)
[=                             ] 4% (12/278 pages)checksumBuffer(start_addr=0x2300, size=0x40) = f283
read(addr=0x2300,size=0x40)
[=                             ] 4% (13/278 pages)checksumBuffer(start_addr=0x2340, size=0x40) = 734c
read(addr=0x2340,size=0x40)
[=                             ] 5% (14/278 pages)checksumBuffer(start_addr=0x2380, size=0x40) = e69
read(addr=0x2380,size=0x40)
[=                             ] 5% (15/278 pages)checksumBuffer(start_addr=0x23c0, size=0x40) = 4771
read(addr=0x23c0,size=0x40)
[=                             ] 5% (16/278 pages)checksumBuffer(start_addr=0x2400, size=0x40) = 40eb
read(addr=0x2400,size=0x40)
[=                             ] 6% (17/278 pages)checksumBuffer(start_addr=0x2440, size=0x40) = 8d7e
read(addr=0x2440,size=0x40)
[=                             ] 6% (18/278 pages)checksumBuffer(start_addr=0x2480, size=0x40) = 1fe
read(addr=0x2480,size=0x40)
[==                            ] 6% (19/278 pages)checksumBuffer(start_addr=0x24c0, 

...

[============================= ] 97% (271/278 pages)checksumBuffer(start_addr=0x63c0, size=0x40) = 87ef
read(addr=0x63c0,size=0x40)
[============================= ] 97% (272/278 pages)checksumBuffer(start_addr=0x6400, size=0x40) = 4111
read(addr=0x6400,size=0x40)
[============================= ] 98% (273/278 pages)checksumBuffer(start_addr=0x6440, size=0x40) = b0da
read(addr=0x6440,size=0x40)
[============================= ] 98% (274/278 pages)checksumBuffer(start_addr=0x6480, size=0x40) = f60e
read(addr=0x6480,size=0x40)
[============================= ] 98% (275/278 pages)checksumBuffer(start_addr=0x64c0, size=0x40) = 5a71
read(addr=0x64c0,size=0x40)
[============================= ] 99% (276/278 pages)checksumBuffer(start_addr=0x6500, size=0x40) = 9f9e
read(addr=0x6500,size=0x40)
[============================= ] 99% (277/278 pages)checksumBuffer(start_addr=0x6540, size=0x4) = 9e64
read(addr=0x6540,size=0x40)
[==============================] 100% (278/278 pages)
Verify successful
Done in 0.263 seconds
Set boot flash true
writeWord(addr=0xe000ed0c,value=0x5fa0004)

@BeachBum, you might get more help if you open an issue in the repo or join us on Matrix

https://matrix.to/#/#atsamd-rs_community:gitter.im

If you have access to SWD port this basic test should be a good start assuming you have openocd installed:

In atsamd/boards/feather_m0 directory run:

cargo build --example blinky_basic && openocd -f 'interface/cmsis-dap.cfg' -c 'transport select swd' -f 'target/at91samdXX.cfg' -c 'program target/thumbv6m-none-eabi/debug/examples/blinky_basic'

Then press RESET button on a Feather M0. It should start blinking.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.