Hello Arduino Community!
I've been searching for the past few hours but unfortunately I haven't found the exact solution and I fear for the worst: hardware failure.
About the problem:
When I try to upload my code, then the compiling finishes successfully but the flashing fails (or rather stops) when trying to change the Baud rate:
Sketch uses 11026 bytes (4%) of program storage space. Maximum is 253952 bytes.
Global variables use 504 bytes (6%) of dynamic memory, leaving 7688 bytes for local variables. Maximum is 8192 bytes.
C:\Users\gabor\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\gabor\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega2560 -cwiring -PCOM3 -b115200 -D -Uflash:w:C:\Users\gabor\AppData\Local\Temp\arduino_build_521283/KitchenLighting.ino.hex:i
avrdude: Version 6.3-20190619
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Users\gabor\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"
Using Port : COM3
Using Programmer : wiring
Overriding Baud Rate : 115200
An error occurred while uploading the sketch
I tried to get a more verbose description from the command prompt and I got the following result:
C:\Users\gabor\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17\bin>avrdude -CC:\Users\gabor\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -v -v -v -v -v -patmega2560 -cwiring -PCOM3 -b115200 -D -Uflash:w:C:\Users\gabor\AppData\Local\Temp\arduino_build_521283/KitchenLighting.ino.hex:i
avrdude: Version 6.3-20190619
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Users\gabor\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"
Using Port : COM3
Using Programmer : wiring
Overriding Baud Rate : 115200
avrdude: wiring_open(): releasing DTR/RTS
avrdude: wiring_open(): asserting DTR/RTS
STK500V2: stk500v2_getsync()
STK500V2: stk500v2_send(0x1b 0x01 0x00 0x01 0x0e 0x01 0x14 , 7)
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14]
...cursor is stuck flashing here indefinitely...
So basically it doesn't even show that there is no response (Rx) and is stuck here indefinitely. At least using Arduino IDE I get an "...error occurred..." after about 5-10 minutes.
Debugging attempts:
- The previously uploaded code runs correctly on the Arduino (lights turn on upon button click, etc.)
- Serial port reading and sending commands --> the COM3 Serial Monitor opens but when a command is sent, the whole Arduino IDE (including the Serial Monitor) simply freezes and is unresponsive even to close requests. It can only be closed by stopping it in task manager.
- Arduino power on LED is lit
- PC restart
- Simple on-board LED blinking sketch doesn't upload either
- Arduino program re-install
- Checking baud rate (in the code it is set to 57600)
- Checking selected board (Arduino Mega2560)
- Checking COM port (COM3) --> device manager shows "Arduino Mega 2560 (COM3)" ) - Arduino IDE also displays it correctly
- The Tx LED on the Arduino blinks from time to time but no message is received on Serial monitor
- verbose readout via cmd (see above)
- measuring continuity in the USB cable --> pass and no short between pins
- checked on all 4 USB ports on the laptop
- checked my arduino nano --> everything works fine on that board
- I just bought a brand new USB-B cable --> same behaviour so the cable is fine
About the project:
The project is basically a kitchen RGBW lighting using the Adafruit_NeoPixel.h to drive about 10m of SK6812 RGBW LED array. An important point is that the LED has an external 30A 5V power supply. During normal operation the LED power supply Vcc was connected to the Arduino Vin pin and the LED power supply ground was connected to the Arduino ground pin. Before connecting the Arduino to the laptop I always disconnected the Vin but left the ground connected (this was the only way the LED strip would get correct data Low signals). The data line of the LED strip is connected to the A2 pin. I've done loads of sketch uploads this way without any problems. The project also includes a capacitive button which is connected to the Arduino 5V and ground pins with the signal pin connected to pin 2 (although I doubt the button would cause any trouble).
My project has been working for a few months now and due to the holidays I've had time to start upgrading it. I've been working on the code for a while now and it was time for uploading. I disconnected the Vin cable and hooked up the Arduino to my laptop. The result is the previously mentioned problem.
Any help would be much appreciated in finding what has gone wrong and if I fried something then how I may have done so (at least a lesson learned)! At this point I am truly lost and searches on the web have led me nowhere so I am left at your mercy. I've got no more hair to pull out so this is truly my last resort before throwing the board into the bin.
Thank you if you have read up to this point!
Note: I have found a similar topic here, but I see some minor differences.
Note2: the code is over 1000 lines, so I have not uploaded it unless it is requested.