Atmel SAMD21 microcontroller not making a USB port anymore

My custom board with Atmel SAMD21 microcontroller (same as Arduino Zero) is not making a USB port since yesterday. The board was working fine before that.

Please suggest ways to resolve this issue. What are the possible reasons for such an issue?

Since reset is equivalent to powering the board ON and OFF which has not resolved the issue, can burning the bootloader again help?

Further information:

  1. The board seems fine. It powers ON and OFF in the usual manner.
  2. This problem with the USB port connection happened while I was trying to upload the code.
  3. The USB pin connections on the board have been checked as well as tested with different USB wires.

Appreciate your help.

The tricky thing about the boards with native USB functionality like your board is that the USB code that creates the CDC serial port is running on the same microcontroller as your sketch. This means your sketch code can break the USB code, or stop it from running. When that happens, it no longer presents a port.

That makes it so you can't upload normally any more. However, the situation is really not so bad because there is an independent program called the bootloader in a separate section of memory from your sketch, and that program has its own USB CDC code. So even if the sketch is completely broken, you only need to activate the bootloader and you will get a port back and be able to upload.

Fortunately, there is an easy way to recover from this situation:

  1. Press and release the reset button on your board quickly twice. You should now see the LED on the board pulsing, which means the bootloader is running. The double press causes the bootloader to run indefinitely (until the board is reset, powered off, or an upload is done), which means you don't need to get the timing of the reset just right.
  2. Select the port of your board from the Tools > Port menu. The port number may be different when the bootloader is running so don't assume you already have the correct port selected.
  3. Start an upload in the Arduino IDE.

The upload should now finish successfully. After this, you should be able to go back to doing normal uploads without needing to press the reset button. If you still need to do the reset trick to do uploads after this, the problem may be caused by your code. You can verify this by uploading a simple sketch like File > Examples > 01.Basics > BareMinimum.

1 Like

I have successfully reloaded the bootloader to an Nano 33 IOT which uses the SAMD21 processor using an ESP32 connected to the DAP pads

See Unbrick Nano 33 IoT - #27 by UKHeliBob

1 Like

Hi Sajjid,

I just came across this.
Appreciate you posting my query from stackoverflow and Arduino Stackexchange on this forum. The post has received some helpful replies.

Hi Pert,

Appreciate your very nicely explained response. As explained, the board is custom made that integrates the Atmel SAMD21 microcontroller. This custom board, unfortunately, lacks a reset button.

Is there another way to get into the bootloader mode? Can burning the bootloader again resolve this issue?

I don't know. But even if there was, it would require you to upload a sketch with the code that would put it in bootloader mode, so it wouldn't help you anyway.

Yeah, that should do it.

1 Like

To give further information, I connect this board with my Windows 10 PC which usually generates a sound and notification to alert that a device has been connected. That sound and notification is also gone suggesting that the PC is not even recognizing the board as a device now.

Is that bad?

No. That will happen if the USB stack wasn't running on the board. That can happen pretty easily, and even is expected with certain code, such as code that puts the microcontroller to sleep.

1 Like

Okay, that is reassuring.

Thanks Pert, I am going to burn the bootloader again and update the results. Hoping it works !

Highly appreciate your help and all the information that you have given.

It worked !

Solutions to the problem:

  1. External Hardware Reset -- using a reset button (that I externally managed to solder) -- to get into bootloader mode and start the program from the beginning

  2. Burning bootloader again may also work (theoretically) - I have not tried and tested it.

I'm glad to hear you were able to recover your board. Thanks for taking the time to post an update.

I think you will be glad to have access to the reset line for the sake of being able to easily recover the board again no matter what happens to the USB stack during further firmware development. Even if a reset button isn't appropriate for a given board design, probably it's worth at least providing some test pads that can be shorted out to get a double reset in a pinch.

1 Like

Haha, I completely missed the significance of this. @sajjidkhan71 is one of the absolute scum of the earth who make post that are copy/pastes of relevant questions from other sites for the sole purpose of later editing a spam link into the post for the sake of SEO. This is the worst possible form of spam because the helpers on the forum waste time investigating and replying to the post out of the goodness of their hearts, without realizing the person they are providing assistance to doesn't care and will never even read it.

But it worked out well in this particular case so @sajjidkhan71 managed to do one good thing in their worthless life, even though it was purely by accident.