Atmel SAMD21 microcontroller not making a USB port anymore - arduino

My custom board with Atmel SAMD21 microcontroller (same as Arduino MKR 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:
The board seems fine. It powers ON and OFF in the usual manner.
This problem with the USB port connection happened while I was trying to upload the code.
The USB pin connections on the board have been checked as well as tested with different USB wires.
Appreciate your help.

Solutions to the problem:
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
Burning bootloader again may also work (theoretically) - I have not tried and tested it.
For detailed understanding - follow this post - https://forum.arduino.cc/t/atmel-samd21-microcontroller-not-making-a-usb-port-anymore/882504/5

Related

Is it possible to factory reset an arduino from hardware to remove bad user code?

I was troubleshooting why Serial1 was always throwing undefined errors in sketches I was trying to run when I found a solution posted online for a slightly different board that suggested this line:
HardwareSerial Serial1(2);
I uploaded it and now the Arduino doesn't show up in the IDE, did I remap it's serial communications? Why is this possible!
Is there any hardware factory reset option available on these boards? Did I just brick my device?
edit: It seems the STM32Cube programmer app can be used to communicate with the device but I'm not sure where to get the original firmware to flash. https://imgur.com/a/LbiHenf
Assuming from the tag in your question, I guess you have an STM32 – (BluePill) Development Board (STM32F103C8).
If you think that your board is not handling serial communication properly then you might consider burning bootloader to your board. This will reset the complete configuration of your board.
There are many ways in which you can burn bootloader to your board.
Using another Arduino board like Uno / Nano / Mega
Using an FTDI USB to TTL Serial Adapter.
You might want to go through tutorials list below:
Getting Started with STM32 using Arduino IDE: Blinking LED
Programming STM32F103C8 Board using USB Port

Arduino Standalone

I have an Arduino Uno and I am using arduino 1.0.5 IDE. I followed he procedures for bootloading an atmega328P-PU on a breadboard.
I uploaded the ArduinoISP sketch first, made the connections(using the External Oscillator) and then wired it up. Then, I selected the programmer as Arduino as ISP, selected the board as Arduino duemilanove w/ Atmega328P. Then I selected the correct serial port and clicked Burn Bootloader.
I got the following errors:
avrdude.exe: stk500_program_enable(): protocol error, expect=0x14,
resp=0x50avrdude.exe: initialization failed, rc=-1 Double
check connections and try again, or use -F to override
this check.avrdude.exe: stk500_disable(): protocol error, expect=0x14,
resp=0x51
How to solve this issue? Also, can I upload the bootloader directly by using it on the Uno in place of the original chip. If so, how?
to my understanding the error you have indicates a bad reading from the chip. I experienced that with chips that were either dead or not properly connected, especially to power supply.
You may find more detailed information in th tutorial : https://www.arduino.cc/en/Tutorial/ArduinoISP
Especially those things :
Note for Arduino 1.0: you need to make one small change to the
ArduinoISP code. Find the line in the heartbeat() function that says
"delay(40);" and change it to "delay(20);".
Select the items in the
Tools > Board and Serial Port menus that correspond to the board you
are using as the programmer (not the board being programmed).
Instead of arduino built-in boot loader just go through below link and it will be great for uploading boot loader and verifying board status info
I am replying you this because same issue I got long back and it saved me.
One more thing for arduino boot loader: for atmega328 you need to put capacitor between reset and gnd( in case you missed)
For gammon bootloader you don't need it.
Be Innovative.
For reset line you might me using 100nf(thats what stated in documentation )...but sometimes it doesn't work...try something like 4.7uf, 22uf or 47uf or close values
I had a similar problem and the issue was that my programmer was a bit slow, I used the -B flag for avrdude to slow down the bitrate and it started working, I set the -B20 and works like a charm every time, but I use the USBTinyISP programmer, not the stk500 one, so this might not work for you.
In case someone stuck at this as I did and nothing like changing the cap value helped. Make sure you are using your USB-TTL adapter in a 5v mode (obviously for a 5v powered chip). I always used it in a 3.3v mode in order not to accidentally burn my 3.3v chips and it always worked. Until today, I was trying to flash my custom atmega8 board and everything worked with the ISP but I was having a hard time using the bootloader and after half a day searching and trying different stuff the 5v setting to the rescue.

avrdude : stk500_getsync not in sync:resp=0x87

I am using arduino uno r3 board and arduino 1.6.5 on windows 8. When Itried to upload my program on ATMEGA328 microcontroller it is showing:
avrdude:stk500_getsync not in sync:resp=0x87.
help me to solve this error
This boils down to 3 problems usually..
The bootload on the chip is missing (unlikely if you purchased the board from Arduino).
The serial connection between the arduino and the computer is disconnected or interrupted.
You've simply selected the wrong board type or port when programming, and thus the IDE is searching for a signal that the arduino isn't coming back with.
This problem is most likely due to option 3, however it can occur in odd situations especially on the Arduino Micro where the board does all USB comms on chip and can be flooded by main without an appropriate delay to the point it can't communicate with the IDE. However this is just most likely a bad board selection or a bad port selection.
I've tried many things but this worked for me. If you have a working Arduino lying around (in my case Uno) you can use it as an intermediate in-system programmer (ISP).
Follow this guide to first load the ISP sketch into your working Arduino.
Once you are done, for your non-working Arduino, select from the Tools > Programmer menu and choose Arduino as ISP, and set Board and Processor accordingly. To program choose Sketch > Upload using programmer.
Hope this works.
I think the reason that this work is that it will bypass the CH340/FTDI chip, and all those synchronization issue. Given that that is your problem.

What can cause Arduino to continuously restart?

I have an Arduino Uno with a 3g shield and am using a Software Serial port on pin 6, 7 and the usb port for debug. After doing well for days, now my program seems to start over and over again (I see that thanks to a println in the setup function) - I added some code, to be honest.
Any suggestion about possible reasons?
Because you are using pin 6 and 7 with SoftwareSerial, the autoreset on serial connection start does not apply.
It would if you use the "standard" 0 and 1 pin which are connected on the USB.
This kind of bug happens in many cases, normally is HW related (attached hardware use too much current, are you using an external charger or power by usb?) or because you are out of ram. Check if you have enough Available Memory
What code did you add? You say you are experienced in C#, so did you remember to clean your garbage? C/C++ does not have a garbage collector that does that for you.
The Arduino has much less memory then you are probably used to, so if are recursively calling a function intentionally or indirectly you could run out of memory.
If you are using a lot of strings it could also use all of your memory.
Can you divide and conquer to determine specifically what routine is causing the reset?
I would start by commenting out half of the main loop and see if it still resets?
An Arduino will reset when the usb port is reinitialized (read: usb cable replugged), and that could be due to the host computer sleeping, rebooting, or something else such as the whole usb controller restarting because another usb device was plugged in.
Use watchdog timer Solve above issue.And while Debug using Serial monitor keep in mind whenever you start the controller get reinitialize
I had the same problem, and my issue was have 10 sensors on arduino 5v output. I changed 5 of them to a separeted power with a 5v regulator and all works great.
Power regulator might be overheating and it's turning off. Putting a small piece of metal on top of it as a heatsink might fix the problem.
When I had this problem I found out that it had something to do with the Sony software for my phone. Turning the software On my computer solved it, and my Arduino has been happy ever since.
The solution was found here
The culprit in my case was Sony Ericsson software trying to identify if the USB device was a mobile phone. Disabling this cured the problem. The moral of the story is don’t run any software which uses the USB whilst you are doing Arduino development. You can disable the reset function after you’ve finished developing if you want.

Arduino YUN doesn't start

When we start an Arduino YUN board we see the LED RX binking once and then LED ON doesn't work. When we upload the program - it works, but we cannot see the WiFi of Arduino now, and LED ON doesn't work as well.
Is it somehow possible to fully erase the board? Or how to repair this issue?
Once I thought my Yun is dead too, I spent 2 days trying to track down the issue. It was faulty code I've uploaded and it caused my board to run infinite loop, it blocked my serial communication and I couldn't even upload new code via USB. Eventually what worked for me was reseting everything on board and uploading empty sketch via LAN (not USB). Yun has 3 different reset buttons, use them.
Yún RST
32U4 RST
WLAN RST
Things to investigate are: Bootloader, uploaded Sketch, Board settings. Try uploading empty sketch via ethernet (not usb), it's great advantage of Yun that you can upload new code that way. Simply try to clear everything and then you might fix your Yun. Good luck.
You need to be more specific.
1. What program are you uploading?
2. Can you consistently load a sketch onto the Yun?
3. Did you read the Yun page and follow these instructions http://arduino.cc/en/Guide/ArduinoYun#toc6 to reset the Yun processors and WiFi?

Resources