Hello Everyone,
I have recently attempted to use the Feather M4 Can from Adafruit to replace a Teensy microcontroller on one of my projects. Before I designed a board around it I bought a breakout and began testing it at home. I started by using arduino ide to test various things, spi flash, neopixel and others. When I tried to move over to platformio I was unable to make it past the upload command. Here is the output of platformio when I try to upload:
Linking .pio\build\adafruit_feather_m4_can\firmware.elf
Checking size .pio\build\adafruit_feather_m4_can\firmware.elf
Building .pio\build\adafruit_feather_m4_can\firmware.bin
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [ ] 2.1% (used 4224 bytes from 196608 bytes)
Flash: [= ] 8.0% (used 40792 bytes from 507904 bytes)
Configuring upload protocol...
AVAILABLE: atmel-ice, jlink, sam-ba
CURRENT: upload_protocol = sam-ba
Looking for upload port...
Auto-detected: COM4
Forcing reset using 1200bps open/close on port COM4
Waiting for the new upload port...
Uploading .pio\build\adafruit_feather_m4_can\firmware.bin
and it just hangs like that for around a minute before displaying this:
No device found on COM5
*** [upload] Error 1
I have gone through a similar thread about the same issue and was unable to fix the problem.
Here is the verbose output:
Building in release mode
MethodWrapper(["checkprogsize"], [".pio\build\adafruit_feather_m4_can\firmware.elf"])
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [ ] 2.1% (used 4224 bytes from 196608 bytes)
Flash: [= ] 8.0% (used 40792 bytes from 507904 bytes)
.pio\build\adafruit_feather_m4_can\firmware.elf :
section size addr
.text 40520 16384
.canram 0 536870912
.data 272 536870912
.hsram 1024 536871184
.bss 3952 536872208
.ARM.attributes 48 0
.comment 67 0
.debug_frame 2940 0
.stab 204 0
.stabstr 441 0
Total 49468
<lambda>(["upload"], [".pio\build\adafruit_feather_m4_can\firmware.bin"])
AVAILABLE: atmel-ice, jlink, sam-ba
CURRENT: upload_protocol = sam-ba
BeforeUpload(["upload"], [".pio\build\adafruit_feather_m4_can\firmware.bin"])
Auto-detected: COM4
Forcing reset using 1200bps open/close on port COM4
Waiting for the new upload port...
bossac --info --debug --port "COM5" --write --verify --reset --erase -U true .pio\build\adafruit_feather_m4_can\firmware.bin
and here is the verbose arduino output (however arduino actually uploads properly):
Sketch uses 11136 bytes (2%) of program storage space. Maximum is 507904 bytes.
Forcing reset using 1200bps open/close on port COM4
PORTS {COM4, } / {} => {}
PORTS {} / {COM5, } => {COM5, }
Found upload port: COM5
C:\Users\Bowen Everitt\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.8.0-48-gb176eee/bossac -i -d --port=COM5 -U -i --offset=0x4000 -w -v C:\Users\BOWENE~1\AppData\Local\Temp\arduino_build_401573/upload-fixing.ino.bin -R
Set binary mode
version()=v1.1 [Arduino:XYZ] Dec 1 2020 23:34:37
Connected at 921600 baud
readWord(addr=0)=0x2000d6a0
readWord(addr=0xe000ed00)=0x410fc241
readWord(addr=0x4)=0x575
readWord(addr=0x41002018)=0x61810302
write(addr=0x20004000,size=0x34)
writeWord(addr=0x20004030,value=0x80)
writeWord(addr=0x20004020,value=0x20008000)
version()=v1.1 [Arduino:XYZ] Dec 1 2020 23:34:37
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 : ATSAME51x19
Version : v1.1 [Arduino:XYZ] Dec 1 2020 23:34:37
Address : 0x0
Pages : 1024
Page Size : 512 bytes
Total Size : 512KB
Planes : 1
Lock Regions : 32
Locked : none
Security : false
BOD : false
BOR : true
Write 11392 bytes to flash (23 pages)
[ ] 0% (0/23 pages)write(addr=0x20004034,size=0x1000)
writeWord(addr=0x41004014,value=0x4000)
readByte(addr=0x41004012)=0x11
readByte(addr=0x41004013)=0xd
writeWord(addr=0x41004004,value=0xa501)
readByte(addr=0x41004012)=0x11
readByte(addr=0x41004013)=0xd
readByte(addr=0x41004010)=0x1
readByte(addr=0x41004011)=0
writeBuffer(scr_addr=0x20004034, dst_addr=0x4000, size=0x1000)
[========== ] 34% (8/23 pages)write(addr=0x20004034,size=0x1000)
writeBuffer(scr_addr=0x20004034, dst_addr=0x5000, size=0x1000)
[==================== ] 69% (16/23 pages)write(addr=0x20004034,size=0xe00)
writeWord(addr=0x41004014,value=0x6000)
readByte(addr=0x41004012)=0x11
readByte(addr=0x41004013)=0xd
writeWord(addr=0x41004004,value=0xa501)
readByte(addr=0x41004012)=0x11
readByte(addr=0x41004013)=0xd
readByte(addr=0x41004010)=0x1
readByte(addr=0x41004011)=0
writeBuffer(scr_addr=0x20004034, dst_addr=0x6000, size=0xe00)
[==============================] 100% (23/23 pages)
Done in 0.240 seconds
Verify 11392 bytes of flash
checksumBuffer(start_addr=0x4000, size=0x200) = 243e
[= ] 4% (1/23 pages)checksumBuffer(start_addr=0x4200, size=0x200) = c4ea
read(addr=0x4200,size=0x200)
[== ] 8% (2/23 pages)checksumBuffer(start_addr=0x4400, size=0x200) = ed8c
read(addr=0x4400,size=0x200)
[=== ] 13% (3/23 pages)checksumBuffer(start_addr=0x4600, size=0x200) = da38
read(addr=0x4600,size=0x200)
[===== ] 17% (4/23 pages)checksumBuffer(start_addr=0x4800, size=0x200) = cc75
read(addr=0x4800,size=0x200)
[====== ] 21% (5/23 pages)checksumBuffer(start_addr=0x4a00, size=0x200) = 106d
read(addr=0x4a00,size=0x200)
[======= ] 26% (6/23 pages)checksumBuffer(start_addr=0x4c00, size=0x200) = d4ae
read(addr=0x4c00,size=0x200)
[========= ] 30% (7/23 pages)checksumBuffer(start_addr=0x4e00, size=0x200) = 2a2
read(addr=0x4e00,size=0x200)
[========== ] 34% (8/23 pages)checksumBuffer(start_addr=0x5000, size=0x200) = a042
read(addr=0x5000,size=0x200)
[=========== ] 39% (9/23 pages)checksumBuffer(start_addr=0x5200, size=0x200) = 6701
read(addr=0x5200,size=0x200)
[============= ] 43% (10/23 pages)checksumBuffer(start_addr=0x5400, size=0x200) = fa5d
read(addr=0x5400,size=0x200)
[============== ] 47% (11/23 pages)checksumBuffer(start_addr=0x5600, size=0x200) = 4602
read(addr=0x5600,size=0x200)
[=============== ] 52% (12/23 pages)checksumBuffer(start_addr=0x5800, size=0x200) = 943e
read(addr=0x5800,size=0x200)
[================ ] 56% (13/23 pages)checksumBuffer(start_addr=0x5a00, size=0x200) = 7e1d
read(addr=0x5a00,size=0x200)
[================== ] 60% (14/23 pages)checksumBuffer(start_addr=0x5c00, size=0x200) = 3207
read(addr=0x5c00,size=0x200)
[=================== ] 65% (15/23 pages)checksumBuffer(start_addr=0x5e00, size=0x200) = 9b7c
read(addr=0x5e00,size=0x200)
[==================== ] 69% (16/23 pages)checksumBuffer(start_addr=0x6000, size=0x200) = 10a2
read(addr=0x6000,size=0x200)
[====================== ] 73% (17/23 pages)checksumBuffer(start_addr=0x6200, size=0x200) = 337f
read(addr=0x6200,size=0x200)
[======================= ] 78% (18/23 pages)checksumBuffer(start_addr=0x6400, size=0x200) = 8bd7
read(addr=0x6400,size=0x200)
[======================== ] 82% (19/23 pages)checksumBuffer(start_addr=0x6600, size=0x200) = b410
read(addr=0x6600,size=0x200)
[========================== ] 86% (20/23 pages)checksumBuffer(start_addr=0x6800, size=0x200) = 2df1
read(addr=0x6800,size=0x200)
[=========================== ] 91% (21/23 pages)checksumBuffer(start_addr=0x6a00, size=0x200) = c2ed
read(addr=0x6a00,size=0x200)
[============================ ] 95% (22/23 pages)checksumBuffer(start_addr=0x6c00, size=0x80) = 352f
read(addr=0x6c00,size=0x200)
[==============================] 100% (23/23 pages)
Verify successful
Done in 0.067 seconds
Any help is appreciated, I am also happy to answer any questions or provide any information or data I missed.