I have my own board which I am trying to flash, but I'm struggling to know how to flash the mkrzero itself as a starting point. I have soldered fly leads to the pads on the back to give access to the SWD pins and have these connected to the MPLAB SNAP. But I don't know if I can use the arduino IDE to flash the bootloader (I get an error if I try this) or the MPLAB IDE - and I have no idea where to start with this. Thanks!
Hi @mackerel.
I'm going to ask you to post the full verbose output from a "Burn Bootloader" operation in Arduino IDE.
This procedure is not intended to solve the problem. The purpose is to gather more information.
Please do this:
- Select File > Preferences... (or Arduino IDE > Settings... for macOS users) from the Arduino IDE menus.
The "Preferences" dialog will open. - Check the box next to Show verbose output during: ☐ upload in the "Preferences" dialog.
ⓘ This preference applies to "Burn Bootloader" operations in addition to uploads. - Click the "OK" button.
The "Preferences" dialog will close. - Attempt a "Burn Bootloader" operation, just the same as you did before.
- Wait for the "Burn Bootloader" operation to fail.
- You will see a "Error while burning the bootloader: ..." notification at the bottom right corner of the Arduino IDE window. Click the "COPY ERROR MESSAGES" button in that notification.
- Open a forum reply here by clicking the "Reply" button.
- Click the
<CODE/>icon on the post composer toolbar.
This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
- Press the Ctrl+V keyboard shortcut (Command+V for macOS users).
This will paste the error output from the upload into the code block. - Move the cursor outside of the code block markup before you add any additional text to your reply.
- Click the "Reply" button to post the output.
I don't have any experience with MPLAB IDE so I won't be able to provide any assistance in this department. Maybe one of the other forum helpers will be able to. But for now I think it is a good idea to see if we can get it working with Arduino IDE since you are already using it and there is a great deal of familiarity with Arduino IDE on this forum.
Arduino: 1.8.15 (Windows 10), Board: "Arduino MKRZERO"
C:\Users\jonmi\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.10.0-arduino7/bin/openocd.exe -d2 -s C:\Users\jonmi\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.10.0-arduino7/share/openocd/scripts/ -f C:\Users\jonmi\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.11/variants/mkrzero/openocd_scripts/arduino_zero.cfg -c telnet_port disabled; init; halt; at91samd bootloader 0; program {C:\Users\jonmi\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.11/bootloaders/mkrzero/samd21_sam_ba_arduino_mkrzero.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
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
Error while burning bootloader.
Error: unable to find CMSIS-DAP device
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
I did a bit of research on the subject and found some information that the MPLAB SNAP has two different modes. In one, it acts as an "EDBG" programmer. This is promising because the EDBG uses the standardized CMSIS-DAP protocol which should be usable with the MKR Zero (the Zero board actually has an on-board EDBG and this works perfectly with "Burn Bootloader" in Arduino IDE).
So the error indicates it is in the other "PIC mode". Unfortunately it looks like the only way to change the mode is using MPLAB IDE. There is information about that here:
https://web.archive.org/web/20230607155735/https://bloom.oscillate.io/docs/mplab-snap-avr-mode
I note this statement:
The configured firmware mode is persisted through power cycles. Users are not required to enable AVR mode before each instance of use - enabling it on a single occasion should suffice.
So if you manage to put the MPLAB SNAP into the "AVR mode" (where it acts as an EDBG), it should be possible to then use it with Arduino IDE from then onward.
Thanks very much for following up with this. I do have MPLAB installed, but that link shows I need v6.05 or earlier, so I am uninstalling and will re-install and give this a try. Will send an update on Friday!
Alternatively, you can use Avrdude 7.3 to enter AVR mode, like so:
avrdude -c snap -x mode=avr
Thanks both. @hansibull - thanks for this, I don't think it worked as I got an error. @ptillisch - So I did find MPLAB v6.05 and was able to follow the instructions from that link to enable AVR mode and I think that worked as the PC was busy doing something, the USB bong came and went so I think it worked! However I get the same error from Arudino IDE as before. To check my other settings in the Arduino IDE - I have "Atmel SAM ICE" selected as Programmer. I have both the SNAP and mkrzero plugged into USB ports and these are connected via the 8 pin socket on the SNAP with 4 connections - VTG on SNAP to VDD , GND, SWCLK and SWDIO on mkrzero back, which is "CORTEX SWD" debug interface according to the SNAP documentation.
If I don't get any luck with this approach I might try mplab ide. Is the mkrzero bootloader source available for me to compile and blow in mplab?
Here it is:
The compiled binary file is also provided here:
Thanks I will give this a try
So I >think< that worked! I eventually got this kind of transcript ...
Erasing...
The following memory area(s) will be programmed:
program memory: start address = 0x0, end address = 0x19ff
Programming/Verify complete
And I could program blink afterwards, so it either did nothing, or worked!
So I am now trying to do the thing that I originally set out to do - which is to program my own board with SAMD21 device! Trying the same flow as with the mkrzero I get the transcript showing the SNAP debugger connected to the IDE ...
Connecting to MPLAB Snap
Currently loaded versions:
Application version...........02.01.06
Boot version..................01.00.00
PCB version...................2
Script version................00.06.71
Script build number...........74cdf38a4d
Tool pack version ............2.3.1200
... and the progress bar at the bottom is showing activity, but I can leave it in this state for an hour and nothing else happens.
Does anyone know if I can get any more debug info as to whether it's programming, just really slowly, or if there's an issue? I have tried a few times, resetting PC and IDE etc and always just get this. I haven't let it run for more than an hour!
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
