Arduino Zero Standalone board - Serial communication issue

Hi,

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.

  1. 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.

  2. 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.

Thanks in advance,
Daniel Reis

Hi,

Could you please share your hardware design? This is necessary to ensure it not an hardware related issue.

Thanks :slight_smile:

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.

Regards.-

Hi Aloyse,

Attached you have the hardware design.

Hi dmreis, looks that you have a RESET problem, you need to pull-up the Reset pin to VDD with a 10K resistor, watch for example https://www.arduino.cc/en/uploads/Main/MKR1000-schematic.pdf

Regards.

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.

Hi choncba, thanks for your input.

We already tried to pull up the reset pin, but it didn't solve the problem.

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.

Are you sure the code is correctly uploaded using the Arduino IDE?
Like dlabun, I suspect a clocking issue( USB needs very tight timing)

I opened an issue about it USB "Unrecognized device" ATSAMW25 custom board · Issue #218 · arduino/ArduinoCore-samd · GitHub
I'm going to try what they recommended (possible BUG in OpenOCD) and then report the results.
Anyway, if dmreis has the same problem using the Atmel-ICE, surely there is some additional configuration that should be done to the clock of the factory chips.

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:

  1. Burning the Adafruit Feather M0 Bootloader* using Atmel Studio 7 succesfully
  2. Windows recognizes the board
  3. Sketch succesfully uploaded using Arduino IDE
  4. Right after step 3, Windows stops recognizing the board, and Arduino IDE don't find any board in any COM Port
  5. 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.

Arduino IDE Sketch Upload.txt (955 Bytes)

fuses_bootloader.txt (926 Bytes)

MemoryExport(after step 1).hex.txt (720 KB)

MemoryExport(after Step 3).hex.txt (720 KB)

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

Let me know if this works :slight_smile:

Aloyse,
Thanks for your reply. I'm traveling today so I'll test this tomorrow and will post here the result.
Hope it works!!! :slight_smile:

I hope it'll work too. Let us know!

Hi Aloyse,

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.
:frowning:

I searched about it and I found a known bug related to that, but only when OpenOCD is used, not with Atmel Studio.

Any ideas what can I do?

Try to burn the fuse like I said and use the MKRZero bootloader. Verify the fuses before burning the bootloader.

Same thing :frowning:
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.

Any other suggestion?

Can you confirm the workflow please?

  1. Power board, plug ICE
  2. Open AS7, read fuses, modify fuses, write fuses
  3. Unplug ICE, power off the board
  4. Power on the board, plug ICE, read fuses using AS.

The step 3 is important.

Have you read the fuses before putting the bootloader? Are you using the Arduino IDE to burn the bootloader?

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?