I bought a ATSAMD21G18A chip and soldered it in a breadboard to make my Arduino Zero standalone. Then I made the circuit and burned the arduino zero bootloader using ATMEL-ICE and ATMEL Studio 7 successfully.
Now I'm facing two issues.
Burning the Adafruit Feather bootloader, I'm able to upload the arduino code using Arduino IDE. After uploading the sketch, the board is not recognized by Windows nor Arduino IDE anymore, and I'm not able to communicate my board with the PC.
To establish the communication again, I need to load the bootloader again using Atmel Studio, but doing this, the arduino sketch is erased and I need to upload the sketch again, falling in the same problem.
My initial guess was that the program was overwriting the bootloader, but I read the ATSAMD21 memory using AS7 right after burning the bootloader, and after uploading the arduino sketch, and the bootloader section is not being overwrited, so I have no idea what is happening.
Also, if I burn the zero bootloader, When I connect the USB cable to PC, I get an "Unrecognized Device" from Windows, and I'm not able to select the COM Port in Arduino IDE. I already tried to upload the program in Arduino IDE even with no port selected, but I always got the message that no board was identified. I also tried to press reset button twice to get in or out of bootloader mode, but nothing happens.
I'm stuck in this problem for a long time, any help would be appreciated.
Hi, I'm working with a ATSAMW25 module on a custom board, the same as used in the MKR1000, this module include the ATSAMD21G18A too.
I don't have an Atmel ICE programmer, so I'm using OpenOCD installed in a Raspberry Pi 2 and use them with the GPIO from the raspi to load the bootloader in the ATSAMW25 with no problems.
In my case, I use the MKR1000 bootloader (from .bin file), (I don't try the Adafruit Feather bootloader).
But, same as you, I get "Unrecognized Device" when connect to PC.
Could be a problem with the USB ID PIN? Can't find anything about this in the board definition file.
I check again in W10, and I get "unrecognized device" (descriptor request error), I add a 330 ohm resistor to gnd in P11 pin too, just like the MKR1000 schematic, but without usb ID pin.
Just from personal experience, the unknown USB error messages always meant the bootloader was corrupt or I didn't configure a clock properly. It may be worth verifying the bootloader is working correctly.
If you burn the latest bootloader binary and use the Arduino IDE with the latest samd core, I see no software reason for bad clock configuration, if the hardware is correct of course...
First of all, thanks everyone for your help, I really appreciate it.
AloyseTech:
Are you sure the code is correctly uploaded using the Arduino IDE?
Like dlabun, I suspect a clocking issue( USB needs very tight timing)
When you say that it can be a clocking issue, is there anyway to deep check/test this? Or is there something I can do to eliminate this possible issue?
Yes, I'm uploading the code correctly using the Arduino IDE.
Trying to clarify how the issue is happening and to check if I'm doing something wrong, I'm attaching some print screens of the whole process I'm doing:
Right after step 3, Windows stops recognizing the board, and Arduino IDE don't find any board in any COM Port
The only way to 'recover' the Serial communication is burning the bootloader again using ATMEL Studio (Step 1)
I'm also attaching the bootloader parameters (fuses) and
Memory export right after Step 1
Memory export right after Step 3
Log from Arduino IDE during the sketch upload
From the memory export is possible to see that the bootloader occupies from address 0 until address 405, and the bootloader reserved space is until address 512.
In memory export after step 1, we have nothing in memory after the bootloader, and in memory export after step 3 we have the uploaded sketch from addresses 513 to 1080.
*I'm burning Adafruit Feather M0 Bootloader instead of Arduino Zero because when I burn the Arduino Zero bootloader, Windows does not recognize the board and I'm not able to upload a sketch using Arduino IDE.
Please change the following fuses using Atmel Studio, then power cycle your board and reburn the bootloader (.cc one at first, other if this doesn't work).
USER_WORD_0 => 0xD9FEC7FF
USER_WORD_1 => 0xFFFFFE5D
Unfortunatelly it didn't work.
We changed the fuses in AS7 but when we burn the bootloader and ask AS7 to read the fuses from the board, it goes back to the old values (USER_WORD_0 = 0xD8E0C7FF & USER_WORD_1 = 0xFFFFFC5D).
The fuse values we configured in AS7 are not being really recorded in the chip.
Same thing
I changed the fuses, clicked program and when I ask to read the fuses, the values of user word 0 & 1 goes back to the default value.
It's strange, because if I change other fuses, the value I choose remains after clicking program and asking to read.
Only user word 0 & 1 that change the value back to the default.
Actually we were not doing step 3, but now we did exactly what you described, step by step, and we had the same result.
We wrote the fuses, unplugged ICE and powered off the board. Then powered on the board, plugged ICE and when we ask to read the fuses it shows the default value, and not the value we had wrote some seconds ago.
Yes, we read the fuses before putting the bootloader, and user_word_0 & 1 were with the default value (USER_WORD_0 = 0xD8E0C7FF & USER_WORD_1 = 0xFFFFFC5D).
We are not using Arduino IDE to burn the bootloader, we are using AS7.
Is it wrong? Were we supposed to burn the bootloader using Arduino IDE?