Arduino won't allow to upload more than once - arduino

I have an Uno-based Arduino (Robocore Blackboard) which has an ATMEGA328P-PU onboard. It's showing a strange behaviour: I can upload any code once, but if I try to upload anything else (or even the same code) after that, it says, vrdude: stk500_recv(): programmer is not responding. The only way to re-upload without error is unplugging and plugging the USB cable.
Does anybody know how to fix it?
PS: it is being powered by USB, no external power supply.

Arduino cards have auto-reset feature. When you load fresh code from IDE ,arduino automatically reboot for uploading new code. Maybe your card don't support it. So, you can try push the reset button on the board before starting upload your code.

Related

How to fix Failed to connect to ESP32: Timed out waiting for packet header error?

I tried to flash an ESP32 but I didn't succeed, I tried with esptool.py and Arduino IDE. I tried to press the boot button and reset but it didn't work. Here is the error:
A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
If using the Arduino IDE, try lowering the upload speed (Tools/Upload Speed). Lowering mine from 921600 to 460800 did the trick.
First ensure that you are in download mode:
Start the serial monitor and set the speed (mine is 115200).
While pressing the "boot" button, press and release the "en" button (your buttons may be labeled differently).
You should see something like this on the serial monitor:
waiting for download
Now start the upload
My development machine, a 2013 iMac is connected via USB to the USB-c port on my ESP32 Dev Module. Apparently the iMac's USB or ESP32 board's USB cannot keep up at the 921600 upload speed.
DISCLAIMER! May not be correct answer but may help to save time for someone.
Quick answer if you do not want read my experience: Disconnect all wires from pins and try uploading again! It may help.
I came across with the same error and could not figure it out. I first thought that something is wrong with the code, because it happened after I edited working code while figuring out where to connect what pin 😀. I also wasn't able to upload simple HelloWorld after it happened with connected wires. But then I disconnected all my wires from the board and the upload works fine.
I can not figure out the WHY factor but I think it must had been the input/data pin I was using, in my case D13. I have the DevKit with fewer pins. Maybe someone can comment why connected pins may make the error come up?
To make your ESP32 board go into flashing/uploading mode automatically, you can connect a 10 μF electrolytic capacitor between the EN pin and GND. When I had the same problem, when I followed this advice, the problem was solved.
References
Failed to connect to ESP32: Timed out waiting for packet header
espressif/arduino-esp32 - issue
On some AliExpress-like ESP32s you have to press the boot button in order to upload your sketch.
If you are watching the Arduino IDE console ouput and Connecting ... appears, you have to press the boot button for approximately 2 seconds until the console output changes.
Try to do this one after the other
Press the boot button when press uploading button until it write the code.
Try disconnect esp32 from the board/header/pcb that you are using right at the time.
Disconnect any other connection that your esp32 might have.
Do not connect to anything even your hand if possible.
Try put it in something that doesnt have a moist surface. look pic number 3.
MY CASES(30 pin version):
Case 1: I dont know why. I was connecting the pin to a female header it doesnt work and sometimes it just work like that. look pic number 1.
Case 2: when Im holding esp32 on my hand sometimes it wont work then i put it on my table and another time it doing well.
Case 3: pressing boot button when uploading it helped sometimes, and the other time it just work like it should.
Case 4: when it connected to pcb its simply just wont work, but when disconnected boom it work like nothing ever happen. look pic number 2.
Maybe just maybe something with capacitive or something like that (just assuming because number Case 1). hope that will help you out.
pic 1pic 2pic 3
This technique definitely working
Goto Tools > programmer, Select ISP and Upload Your Code.
if you can't see any programmer, then download 1.8.12 version.
https://www.arduino.cc/en/software/OldSoftwareReleases
With Arduino IDE
Make sure the Com port is selected under Tools menu. My experience with ESP32 is Com 5.
If it is not available as an option, try changing USB ports and/or re-select Tools - Board - ESP32 dev module.
Watch the "Compiling Sketch" window.
Press the "Boot" button as soon as you get the red message "Serial port Com 5" You can release the button as soon as it starts to upload.
If this doesn't work,try plugging into another USB port.
The Reset button only resets the uploaded sketch to re-initialise and has nothing to do with the uploading.
Install expressif.exe and port drivers,connect the port and flash the esp32 ,upload the code using ardiuno,solve the error
in my case buttons are new but not shorting properly as multimeter showed ..opened both scratched resoldered and all working
Changing by upload speed from 921600bps to 115200bps fixed it. No need to press any buttons.
Just download the drivers x)
CP210x: CP210x USB to UART Bridge VCP Drivers
FTDI: FTDI Virtual COM Port Drivers

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.

Arduino stk500_getsync(): not in sync

We have an arduino pro mini, we are trying to trying to upload sketch the controller but we are prohibited, as the arduino attempt to upload the sketch, it display an error of: not in sync.
We are pretty new in this are, so any help would be much appreciated.
Our setup is:
-Breadboard
-Connection to adapter: USB Serial.
-Arduino Pro Mini as a controller
Through the Arduino Programming Client.
The processor and the port are setup op properly.
The strange thing is, it has worked sometimes these past days..
Much Thanks.
Mieer
Do you push the "RESET" button when it starts uploading? Using the pro-mini probably you haven't connected the DTR pin, so it can't auto-reset the device (so you have to do it manually).
When Arduino starts the uploading phase just press the reset button. It should start.

Arduino "avrdude" Error

I have been working with the Arduino system with an Arduino Uno chip for a while, but I recently came upon a problem I cannot solve. The problem is that whenever I attempt to upload a new program to my chip, I get the following error:
avrdude: stk500_getsync(): not in sync: resp=0x00
I have done some research, and I have tried everything that people have suggested. I have checked the COM port, checked the chip type, checked the component installations, updated the FTDI drivers, hit the reset button, tried the latest Arduino software, and yes, I have even made sure the board is plugged into the computer.
Earlier this year I had absolutely no problem uploading code to my board, and almost nothing has changed since I last tried it. The only thing that has changed is the cable I have used to upload the programs, and I have tried several different cables as well. Could it just be a batch of bad cables? This seems unlikely. I have also tried uploading code onto different boards, with the same result.
This is getting quite frustrating, as I really want to continue working on my projects. However, that will not happen if I cannot even print "Hello World!" to the serial monitor.
I am running on a 32-bit Windows 7 machine. Any suggestions to solving this would be greatly appreciated.
If you are expecting a normal upload using Serial then you should ensure your preferences are not set to "Upload using programmer" and that you are not selecting "Upload using programmer" from any of the Arduino menus.
EDIT
If you have not overridden the programmer then you must have the wrong board selected on the tools menu boards list. lpt1 in the error message is not what the Uno uses.
It turns out that the problem was the FTDI cable I was using. I tried a bunch of different cables until I found one that works, and now uploading occurs without any problems.
check the board you have selected in tools-> board . If you selected wrong board error comes as above. If right board being selected still getting same error , then it is definitely boot loader crashed error. You need to upload boot loader.
Sometimes parts connected to digital pin 0 and 1. The parts interfere communication between the computer and arduino so I recommend this procedure.
Check something is connected to D0 and D1.
If something is connected, unplug those.
Upload the sketch.
Plug parts removed at step 2.
your arduino maybe not uno, change board to duemilanove.

Arduino stuck in an infinite loop

My Arduino is stuck in an infinite loop trying to read from a pin and print it to the serial console. I can't upload any other programs now. What can I do to get the chip out of the loop?
Remove the USB connection, close the IDE, open the IDE, open BareMinimum, hold the reset button, plugin the USB connection, click the upload button 1/2 a second after removing your finger from the reset button.
If you're using an Arduino Uno, you might want to check out Updating the Atmega8U2 on an Uno or Mega2560 using DFU. Apparently there was a bug in the interface firmware.
This may sounds silly but what about disconnect it from the power supply to reset the MCU?
Edit:
I see it is powered via USB; then make sure you disconnect the device, remove/discharge any battery/capacitors whatsoever. If nothing works, close down the Arduino IDE, change the USB port you are using (sometimes it does happen that they get stuck..), reboot the PC.. Good luck!
Reprogramming the interface firmware (see ViennaMike's response) did not work for me, so I purchased another Arduino and turned it into an ISP programmer and overwrote the offending application:
https://stackoverflow.com/a/8453576/1090713
While this approach had some cost, I now have another tool and a way to save an Arduino in the future.
Upload your boot loader using Avr pocket programmer. This solves your MCU reset.
Use Watchdog timer instruction while coding infinite loop provided you are dealing with critical parameter to be written when it restarts.
If you run across the same problem with Arduino Yun, try uploading empty sketch using WIFI as port. It worked for me when I couldn't upload new sketch via USB.
The Arduino will wait a short while when attempting to upload. So you can press the reset and hold it until the Ide shows attempting to upload. then let go of it.
The problem can be that when you click upload the Ide first compiles then at the end of the process attempts to upload. So pressing reset, clicking compile and immediately letting go of reset doesn't always work because you let go of the reset too quickly.

Resources