Custom SAMD51j18a appears to program successfully in Arduino as Adafruit FeatherM4 but then fails

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

I had hoped to treat my custom board as an Adafruit Feather, which uses the SamD51J19a (I'm using the 18a). The only difference is in the amount of program memory. I originally hoped this wouldn't matter but now thinking that maybe it does. Or is there another issue? 

 

Burning bootloader appears to succeed

I use Atmel Studio to burn Adafruit's bootloader (bootloader-feather_m4-v3.13.0.bin) which I took from here: https://github.com/adafruit/uf2-...

It burned without issue and shows up as a mass storage device that is also recognized in Arduino as a feather. 

 

Programming blink in Arduino appears to succeed

I then attempt to upload a bare-minimum blink sketch or a bare-minimum serial write sketch, and in both cases uploads successfully.

 

Device no longer recognized as soon as any code is uploaded, until bootloader reburned

HOWEVER, as soon as any code is uploaded, the device is no longer recognized, even after power cycling, restarting Arduino, etc. The only thing I am able to do is go back to Atmel Studio, reburn the bootloader, and then the device appears again. 

 

What's going on here? I've never had a case where it thinks it programmed successfully without any warnings or errors but then clearly gets itself into an error state. I'm pretty new to firmware dev so please ELI18. 

 

Arduino debug output below: (reminder: I am using the samd51j18a whereas a true feather has a samd51j19a. I am not sure if this matters. Maybe the memory locations are different). 

Sketch uses 11008 bytes (2%) of program storage space. Maximum is 507904 bytes.
Forcing reset using 1200bps open/close on port COM3
PORTS {COM3, } / {COM3, } => {}
PORTS {COM3, } / {COM3, } => {}
PORTS {COM3, } / {COM3, } => {}
PORTS {COM3, } / {COM3, } => {}
PORTS {COM3, } / {COM3, } => {}
PORTS {COM3, } / {COM3, } => {}
PORTS {COM3, } / {COM3, } => {}
PORTS {COM3, } / {COM3, } => {}
PORTS {COM3, } / {COM3, } => {}
PORTS {COM3, } / {COM3, } => {}
PORTS {COM3, } / {COM3, } => {}
PORTS {COM3, } / {COM3, } => {}
PORTS {COM3, } / {COM3, } => {}
PORTS {COM3, } / {COM3, } => {}
PORTS {COM3, } / {COM3, } => {}
PORTS {COM3, } / {COM3, } => {}
PORTS {COM3, } / {COM3, } => {}
PORTS {COM3, } / {COM3, } => {}
PORTS {COM3, } / {COM3, } => {}
PORTS {COM3, } / {COM3, } => {}
Uploading using selected port: COM3
C:\Users\jmc12\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.8.0-48-gb176eee/bossac -i -d --port=COM3 -U -i --offset=0x4000 -w -v C:\Users\jmc12\AppData\Local\Temp\arduino_build_759177/Blink.ino.bin -R 
Set binary mode
version()=v1.1 [Arduino:XYZ] Feb 21 2021 21:10:09
Connected at 921600 baud
readWord(addr=0)=0x2000d6a0
readWord(addr=0xe000ed00)=0x410fc241
readWord(addr=0x4)=0x575
readWord(addr=0x41002018)=0x60060006
write(addr=0x20004000,size=0x34)
writeWord(addr=0x20004030,value=0x80)
writeWord(addr=0x20004020,value=0x20008000)
version()=v1.1 [Arduino:XYZ] Feb 21 2021 21:10:09
readByte(addr=0x804000)=0x39
readByte(addr=0x804001)=0x92
readByte(addr=0x804008)=0xff
readByte(addr=0x804009)=0xff
readByte(addr=0x80400a)=0xff
readByte(addr=0x80400b)=0xff
Device       : ATSAMD51x18
Version      : v1.1 [Arduino:XYZ] Feb 21 2021 21:10:09
Address      : 0x0
Pages        : 512
Page Size    : 512 bytes
Total Size   : 256KB
Planes       : 1
Lock Regions : 32
Locked       : none
Security     : false
BOD          : false
BOR          : true
Write 11264 bytes to flash (22 pages)
[                              ] 0% (0/22 pages)write(addr=0x20004034,size=0x1000)
writeWord(addr=0x41004014,value=0x4000)
readByte(addr=0x41004012)=0x11
readByte(addr=0x41004013)=0xf
writeWord(addr=0x41004004,value=0xa501)
readByte(addr=0x41004012)=0x11
readByte(addr=0x41004013)=0xf
readByte(addr=0x41004010)=0x1
readByte(addr=0x41004011)=0
writeBuffer(scr_addr=0x20004034, dst_addr=0x4000, size=0x1000)
[==========                    ] 36% (8/22 pages)write(addr=0x20004034,size=0x1000)
writeBuffer(scr_addr=0x20004034, dst_addr=0x5000, size=0x1000)
[=====================         ] 72% (16/22 pages)write(addr=0x20004034,size=0xc00)
writeWord(addr=0x41004014,value=0x6000)
readByte(addr=0x41004012)=0x11
readByte(addr=0x41004013)=0xf
writeWord(addr=0x41004004,value=0xa501)
readByte(addr=0x41004012)=0x11
readByte(addr=0x41004013)=0xf
readByte(addr=0x41004010)=0x1
readByte(addr=0x41004011)=0
writeBuffer(scr_addr=0x20004034, dst_addr=0x6000, size=0xc00)
[==============================] 100% (22/22 pages)
Done in 0.218 seconds
Verify 11264 bytes of flash
checksumBuffer(start_addr=0x4000, size=0x200) = 190e
[=                             ] 4% (1/22 pages)checksumBuffer(start_addr=0x4200, size=0x200) = c65f
read(addr=0x4200,size=0x200)
[==                            ] 9% (2/22 pages)checksumBuffer(start_addr=0x4400, size=0x200) = 754b
read(addr=0x4400,size=0x200)
[====                          ] 13% (3/22 pages)checksumBuffer(start_addr=0x4600, size=0x200) = f6c3
read(addr=0x4600,size=0x200)
[=====                         ] 18% (4/22 pages)checksumBuffer(start_addr=0x4800, size=0x200) = 645
read(addr=0x4800,size=0x200)
[======                        ] 22% (5/22 pages)checksumBuffer(start_addr=0x4a00, size=0x200) = 7e8b
read(addr=0x4a00,size=0x200)
[========                      ] 27% (6/22 pages)checksumBuffer(start_addr=0x4c00, size=0x200) = 9f8c
read(addr=0x4c00,size=0x200)
[=========                     ] 31% (7/22 pages)checksumBuffer(start_addr=0x4e00, size=0x200) = b8af
read(addr=0x4e00,size=0x200)
[==========                    ] 36% (8/22 pages)checksumBuffer(start_addr=0x5000, size=0x200) = e47e
read(addr=0x5000,size=0x200)
[============                  ] 40% (9/22 pages)checksumBuffer(start_addr=0x5200, size=0x200) = 8562
read(addr=0x5200,size=0x200)
[=============                 ] 45% (10/22 pages)checksumBuffer(start_addr=0x5400, size=0x200) = a849
read(addr=0x5400,size=0x200)
[===============               ] 50% (11/22 pages)checksumBuffer(start_addr=0x5600, size=0x200) = c094
read(addr=0x5600,size=0x200)
[================              ] 54% (12/22 pages)checksumBuffer(start_addr=0x5800, size=0x200) = af0
read(addr=0x5800,size=0x200)
[=================             ] 59% (13/22 pages)checksumBuffer(start_addr=0x5a00, size=0x200) = 5c5b
read(addr=0x5a00,size=0x200)
[===================           ] 63% (14/22 pages)checksumBuffer(start_addr=0x5c00, size=0x200) = ec42
read(addr=0x5c00,size=0x200)
[====================          ] 68% (15/22 pages)checksumBuffer(start_addr=0x5e00, size=0x200) = c5d1
read(addr=0x5e00,size=0x200)
[=====================         ] 72% (16/22 pages)checksumBuffer(start_addr=0x6000, size=0x200) = c9e0
read(addr=0x6000,size=0x200)
[=======================       ] 77% (17/22 pages)checksumBuffer(start_addr=0x6200, size=0x200) = a072
read(addr=0x6200,size=0x200)
[========================      ] 81% (18/22 pages)checksumBuffer(start_addr=0x6400, size=0x200) = 6b5e
read(addr=0x6400,size=0x200)
[=========================     ] 86% (19/22 pages)checksumBuffer(start_addr=0x6600, size=0x200) = 9317
read(addr=0x6600,size=0x200)
[===========================   ] 90% (20/22 pages)checksumBuffer(start_addr=0x6800, size=0x200) = bf95
read(addr=0x6800,size=0x200)
[============================  ] 95% (21/22 pages)checksumBuffer(start_addr=0x6a00, size=0x200) = 75d1
read(addr=0x6a00,size=0x200)
[==============================] 100% (22/22 pages)
Verify successful
Done in 0.100 seconds
writeWord(addr=0xe000ed0c,value=0x5fa0004)
 

Attachment(s): 

Last Edited: Mon. Jul 5, 2021 - 12:19 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

samd51_new wrote:
The only difference is in the amount of program memory.

The size of SRAM differs also.

/Lars