ATSAMD21G18A no code working

Hey Guys.

I made a Devboard with the ATSAMD21G18A Microcontroller. The schematic is attached and its quite similar to the original Arduino Zero Schematic but way simpler as I only want to use the µC and not the onboard debugger.

For uploading firmware I use an Atmel ICE Programmer.

As Board in Arduino I've chosen: Arduino SAMD Boards (32-bits ARM Cortex-M0+) > Arduino Zero (programming port)

I can burn the bootloader onto the chip without a problem, and I also can upload any sketch I want without a problem but the µC does simply said: nothing.
Even the simpliest blink sketch does not work. When I set any pin to high for example:

const int LED_STATE = 13;

void setup() {
  pinMode(LED_STATE, OUTPUT);
}

void loop() {
  digitalWrite(LED_STATE, HIGH);
}

the pin stays low, every pin the same problem.

I used this chip https://www.digikey.at/de/products/detail/microchip-technology/ATSAMD21G18A-AU/5056473

Does anyone know what am I doing wrong?

Best regards

SCH_DEV_ATSAMD21G18_00-00.pdf (293.1 KB)

The schematic I found for the MKR Zero has the LED on PB08. Your schematic has an LED on PA17.

Yes but thats obviously not the problem, the real problem is, that I can set no state on no pin

Hi @s-fr

Looking at your schematic, VDDCORE should be connected to (digital) ground via a 1uF capacitor (and not to +3.3V). This is the decoupling capacitor for the microcontroller's own internal voltage supply, regulated to between +1.6 and +1.8V.

The image below is taken from the SAMD21 datasheet, Section 42. Schematic Checklist:

Um. When using the "programming port" on an Arduino Zero, the IDE will use the on-board debugging chip to do the programming, with no bootloader. I'm not sure what "burn bootloader" will do under such circumstances.

If you've actually burnt a bootloader, your sketches will need to be compiled with that in mind (different start address for the .text segment.) But I'd think that the upload using the same board type would already take that into account.

Could you post a log (after turning on verbose) of a compile/upload attempt?

Thanks for all your replies. What I did so far was to connect the vddcore right just as @MartinL said. That was obviously a mistake but did not the trick.

And here's my verbose output:

For Bootloader:

"C:\Users\Keller\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.10.0-arduino7/bin/openocd.exe" -d2 -s "C:\Users\Keller\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.10.0-arduino7/share/openocd/scripts/" -f "interface/cmsis-dap.cfg" -c "set telnet_port 0"  -f "target/at91samdXX.cfg" -c "telnet_port disabled; init; halt; at91samd bootloader 0; program {C:\Users\Keller\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.13/bootloaders/zero/samd21_sam_ba.bin} verify reset; shutdown"
Open On-Chip Debugger 0.10.0+dev-gf0767a31 (2018-06-11-13:36)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
debug_level: 2
0
Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.
none separate
adapter speed: 400 kHz
cortex_m reset_config sysresetreq
Info : CMSIS-DAP: SWD  Supported
Info : CMSIS-DAP: JTAG Supported
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : CMSIS-DAP: FW Version = 1.0
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 400 kHz
Info : SWD DPIDR 0x0bc11477
Info : at91samd.cpu: hardware has 4 breakpoints, 2 watchpoints
Info : Listening on port 3333 for gdb connections
target halted due to debug-request, current mode: Thread 
xPSR: 0x61000000 pc: 0x000006f4 msp: 0x20007fdc
target halted due to debug-request, current mode: Thread 
xPSR: 0x61000000 pc: 0x0000060c msp: 0x20007ffc
** Programming Started **
auto erase enabled
Info : SAMD MCU: SAMD21G18A (256KB Flash, 32KB RAM)
wrote 6656 bytes from file C:\Users\Keller\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.13/bootloaders/zero/samd21_sam_ba.bin in 0.599527s (10.842 KiB/s)
** Programming Finished **
** Verify Started **
verified 6504 bytes in 0.563289s (11.276 KiB/s)
** Verified OK **
** Resetting Target **
shutdown command invoked

And here's for the sketch

FQBN: arduino:samd:arduino_zero_edbg
Using board 'arduino_zero_edbg' from platform in folder: C:\Users\Keller\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.13
Using core 'arduino' from platform in folder: C:\Users\Keller\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.13

Verwendete Bibliotheken erkennen ...
"C:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10607 -DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD -D__SAMD21G18A__ -DUSB_VID=0x2341 -DUSB_PID=0x804d -DUSBCON "-DUSB_MANUFACTURER=\"Arduino LLC\"" "-DUSB_PRODUCT=\"Arduino Zero\"" "-IC:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS\\4.5.0/CMSIS/Include/" "-IC:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS-Atmel\\1.2.0/CMSIS/Device/ATMEL/" "-IC:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.13\\cores\\arduino/api/deprecated" "-IC:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.13\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.13\\cores\\arduino" "-IC:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.13\\variants\\arduino_zero" "C:\\Users\\Keller\\AppData\\Local\\Temp\\arduino\\sketches\\174330956B9CB2314DE94F0F7B0DC7CE\\sketch\\sketch_jun17a.ino.cpp" -o nul
Funktionsprototypen werden generiert ...
"C:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10607 -DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD -D__SAMD21G18A__ -DUSB_VID=0x2341 -DUSB_PID=0x804d -DUSBCON "-DUSB_MANUFACTURER=\"Arduino LLC\"" "-DUSB_PRODUCT=\"Arduino Zero\"" "-IC:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS\\4.5.0/CMSIS/Include/" "-IC:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS-Atmel\\1.2.0/CMSIS/Device/ATMEL/" "-IC:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.13\\cores\\arduino/api/deprecated" "-IC:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.13\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.13\\cores\\arduino" "-IC:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.13\\variants\\arduino_zero" "C:\\Users\\Keller\\AppData\\Local\\Temp\\arduino\\sketches\\174330956B9CB2314DE94F0F7B0DC7CE\\sketch\\sketch_jun17a.ino.cpp" -o "C:\\Users\\Keller\\AppData\\Local\\Temp\\arduino\\sketches\\174330956B9CB2314DE94F0F7B0DC7CE\\preproc\\ctags_target_for_gcc_minus_e.cpp"
"C:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\builtin\\tools\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\Keller\\AppData\\Local\\Temp\\arduino\\sketches\\174330956B9CB2314DE94F0F7B0DC7CE\\preproc\\ctags_target_for_gcc_minus_e.cpp"
Sketch wird kompiliert ...
"C:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -mcpu=cortex-m0plus -mthumb -c -g -Os -Wall -Wextra -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD -DF_CPU=48000000L -DARDUINO=10607 -DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD -D__SAMD21G18A__ -DUSB_VID=0x2341 -DUSB_PID=0x804d -DUSBCON "-DUSB_MANUFACTURER=\"Arduino LLC\"" "-DUSB_PRODUCT=\"Arduino Zero\"" "-IC:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS\\4.5.0/CMSIS/Include/" "-IC:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS-Atmel\\1.2.0/CMSIS/Device/ATMEL/" "-IC:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.13\\cores\\arduino/api/deprecated" "-IC:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.13\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.13\\cores\\arduino" "-IC:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.13\\variants\\arduino_zero" "C:\\Users\\Keller\\AppData\\Local\\Temp\\arduino\\sketches\\174330956B9CB2314DE94F0F7B0DC7CE\\sketch\\sketch_jun17a.ino.cpp" -o "C:\\Users\\Keller\\AppData\\Local\\Temp\\arduino\\sketches\\174330956B9CB2314DE94F0F7B0DC7CE\\sketch\\sketch_jun17a.ino.cpp.o"
Bibliotheken werden kompiliert ...
Kern wird kompiliert ...
"C:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -mcpu=cortex-m0plus -mthumb -c -g -Os -Wall -Wextra -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD -DF_CPU=48000000L -DARDUINO=10607 -DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD -D__SAMD21G18A__ -DUSB_VID=0x2341 -DUSB_PID=0x804d -DUSBCON "-DUSB_MANUFACTURER=\"Arduino LLC\"" "-DUSB_PRODUCT=\"Arduino Zero\"" "-IC:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS\\4.5.0/CMSIS/Include/" "-IC:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS-Atmel\\1.2.0/CMSIS/Device/ATMEL/" "-IC:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.13\\cores\\arduino/api/deprecated" "-IC:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.13\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.13\\cores\\arduino" "-IC:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.13\\variants\\arduino_zero" "C:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.13\\variants\\arduino_zero\\variant.cpp" -o "C:\\Users\\Keller\\AppData\\Local\\Temp\\arduino\\sketches\\174330956B9CB2314DE94F0F7B0DC7CE\\core\\variant.cpp.o"
Using precompiled core: C:\Users\Keller\AppData\Local\Temp\arduino\cores\arduino_samd_arduino_zero_edbg_4b5ea3a38655fe2746d16be9197307fd\core.a
Linking everything together...
"C:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" "-LC:\\Users\\Keller\\AppData\\Local\\Temp\\arduino\\sketches\\174330956B9CB2314DE94F0F7B0DC7CE" -Os -Wl,--gc-sections -save-temps "-TC:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.13\\variants\\arduino_zero/linker_scripts/gcc/flash_with_bootloader.ld" "-Wl,-Map,C:\\Users\\Keller\\AppData\\Local\\Temp\\arduino\\sketches\\174330956B9CB2314DE94F0F7B0DC7CE/sketch_jun17a.ino.map" --specs=nano.specs --specs=nosys.specs -mcpu=cortex-m0plus -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -o "C:\\Users\\Keller\\AppData\\Local\\Temp\\arduino\\sketches\\174330956B9CB2314DE94F0F7B0DC7CE/sketch_jun17a.ino.elf" "C:\\Users\\Keller\\AppData\\Local\\Temp\\arduino\\sketches\\174330956B9CB2314DE94F0F7B0DC7CE\\sketch\\sketch_jun17a.ino.cpp.o" "C:\\Users\\Keller\\AppData\\Local\\Temp\\arduino\\sketches\\174330956B9CB2314DE94F0F7B0DC7CE\\core\\variant.cpp.o" -Wl,--start-group "-LC:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS\\4.5.0/CMSIS/Lib/GCC/" -larm_cortexM0l_math -lm "C:\\Users\\Keller\\AppData\\Local\\Temp\\arduino\\sketches\\174330956B9CB2314DE94F0F7B0DC7CE/..\\..\\cores\\arduino_samd_arduino_zero_edbg_4b5ea3a38655fe2746d16be9197307fd\\core.a" -Wl,--end-group
"C:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-objcopy" -O binary "C:\\Users\\Keller\\AppData\\Local\\Temp\\arduino\\sketches\\174330956B9CB2314DE94F0F7B0DC7CE/sketch_jun17a.ino.elf" "C:\\Users\\Keller\\AppData\\Local\\Temp\\arduino\\sketches\\174330956B9CB2314DE94F0F7B0DC7CE/sketch_jun17a.ino.bin"
"C:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-objcopy" -O ihex -R .eeprom "C:\\Users\\Keller\\AppData\\Local\\Temp\\arduino\\sketches\\174330956B9CB2314DE94F0F7B0DC7CE/sketch_jun17a.ino.elf" "C:\\Users\\Keller\\AppData\\Local\\Temp\\arduino\\sketches\\174330956B9CB2314DE94F0F7B0DC7CE/sketch_jun17a.ino.hex"

"C:\\Users\\Keller\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-size" -A "C:\\Users\\Keller\\AppData\\Local\\Temp\\arduino\\sketches\\174330956B9CB2314DE94F0F7B0DC7CE/sketch_jun17a.ino.elf"
Der Sketch verwendet 11644 Bytes (4%) des Programmspeicherplatzes. Das Maximum sind 262144 Bytes.
Globale Variablen verwenden 2980 Bytes (9%) des dynamischen Speichers, 29788 Bytes für lokale Variablen verbleiben. Das Maximum sind 32768 Bytes.
"C:\Users\Keller\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.10.0-arduino7/bin/openocd.exe" -d2 -s "C:\Users\Keller\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.10.0-arduino7/share/openocd/scripts/" -f "interface/cmsis-dap.cfg" -c "set telnet_port 0"  -f "target/at91samdXX.cfg" -c "telnet_port disabled; program {C:\Users\Keller\AppData\Local\Temp\arduino\sketches\174330956B9CB2314DE94F0F7B0DC7CE/sketch_jun17a.ino.hex} verify reset; shutdown"
Open On-Chip Debugger 0.10.0+dev-gf0767a31 (2018-06-11-13:36)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
debug_level: 2
0
Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.
none separate
adapter speed: 400 kHz
cortex_m reset_config sysresetreq
Info : CMSIS-DAP: SWD  Supported
Info : CMSIS-DAP: JTAG Supported
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : CMSIS-DAP: FW Version = 1.0
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 400 kHz
Info : SWD DPIDR 0x0bc11477
Info : at91samd.cpu: hardware has 4 breakpoints, 2 watchpoints
Info : Listening on port 3333 for gdb connections
target halted due to debug-request, current mode: Thread 
xPSR: 0x41000000 pc: 0x0000060c msp: 0x20007ffc
** Programming Started **
auto erase enabled
Info : SAMD MCU: SAMD21G18A (256KB Flash, 32KB RAM)
wrote 11776 bytes from file C:\Users\Keller\AppData\Local\Temp\arduino\sketches\174330956B9CB2314DE94F0F7B0DC7CE/sketch_jun17a.ino.hex in 1.057184s (10.878 KiB/s)
** Programming Finished **
** Verify Started **
verified 11644 bytes in 0.983615s (11.561 KiB/s)
** Verified OK **
** Resetting Target **
shutdown command invoked

Best regards

Hi @s-fr

Have you tried burning the bootloader then uploading a "blink" sketch over the board's native USB port?

Does your board enter bootloader mode, if you double tap the reset button (two times in quick succession)? In this case, it should switch to a different COM port.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.