Introduction: SPEEEduino: a Christmas Special
SPEEEduino is an IoT enabled Arduino powered with ESP8266 ESP-01, designed and fabricated by SP EEE students: Ziyue, and Julian. yours truly is delighted to receive the SPEEEduino boards on Christmas Eve. At the back of his head, he was thinking of making some cool stuff with SPEEEduino over christmas break.
Some of the boards come presoldered with components san ATMega328p and the ESP-01. The standard operating procedure would be to plug in a new ATMega328p, burn the Arduino bootloader on it via Arduino as ISP or AVR programmer or USB AVR, and then download the example blink code to it to verify all is prim and proper. Julian and Ziyue wrote an instructable on doing the necessary prep to use SPEEEduino https://www.instructables.com/id/Burning-a-Bootloader-Onto-a-SPEEEduino-Verifying-I/
At that moment in time, yours truly only have 1x working Arduino Uno lying around, and definitely could not do Arduino as ISP to burn bootloader into a new ATMega328p on the SPEEEduino. So he transplanted the ATMega328p what is in working condition from the Arduino Uno into SPEEEduino, assumes it will work straight out of the box, and start to program away. Fate took an unfortunate turn when he tries to download the code into SPEEEduino transplanted with ATMega328p.
yours truly was greeted with the legendary
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x47
he thought he had a batch of bricked PCB, but upon closer examinations he noticed the LED on pin13 blinks according to the example code downloaded via the Arduino Uno to verify the functionality of ATMega328p before the transplant.
Then he verified the following connection via continuity test
1. Win8.1, Arduino IDE 1.6.7. SPEEEduino with transplanted ATMega832p gave this error of avrdude: stk500_recv(): programmer is not responding
2. Ubuntu14, Arduino IDE 1.6.8. SPEEEduino with transplanted ATMega832p works out of the box in this environment.
A little consolation prize is needed to keep troubleshooting to solve the mystery of not working in windows environment, but works in linux environment.
If you landed on this page looking for solution for the legendary error of avrdude: stk500_recv(): programmer is not responding or avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x47 look no further than the next step where yours truly outlined the voodoo sequence. If you are interested to know the troubleshooting sequence, look further.
Step 1: The Voodoo Sequence Aka Workaround
SPEEEduino is connected with CP2102 on a valid com port on a lenovo laptop running windows8.1 and Arduino IDE 1.5.6 r2 with verbose mode turn on upload via File->preferences
when you are about to press the "upload" button to compile and download the hex to the board, press and hold the "reset" button on SPEEEduino. upon seeing the first handshake "avrdude: Send: 0   ", release the reset button. you will now able to program the ATMega328p. refer to the screenshot for details.
this voodoo sequence seems to be counter intuitive, because Arduino Bootloader supports auto reset feature with a 0.1uF cap and 10K resistor is connected between the DTR line to the RST on ATMega328.
yours truly took a 2 days scraping the Internet forum posts, and experimenting on many laptops to be able to download the hex successfully.
this voodoo sequence is the workaround for the legendary error of avrdude: stk500_recv(): programmer is not responding or avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x0a
Step 2: Computing Environment
Ubuntu 14 with Arduino IDE 1.6.7 works out of the box for SPEEEduino with transplanted ATMega328p. check out the screenshot and demo video. the DTR line configuration auto resets according to specs.
So yours truly focused on troubleshooting and hope to find a workaround for Windows Environment.
Step 3: Troubleshooting Sequence With Only 1x ATMega328p
There are 4 parameters that need to be held stable when isolating for the possible cause of failure.
1. the ATMega328p on SPEEEduino
2. the computing environment
3. the USB TTL
4. the PCB & component values
yours truly tested in the following sequence
tested a variety of USB TTL such as FTDI, CP2102 (USB), CP2102(micro USB). Able to download sample code blink in Arduino IDE 1.6.7 on Ubuntu14 hosted as VM in his staff laptop. Same experiment is repeated for Win8.1, but no luck with Arduino IDE 1.6.5 on win8.
tested a variety of laptop installed with Windows 7/8/10 with Arduino IDE 1.6.x to 1.8.0 to download code to the SPEEEduino with the transplanted ATMega328p. Still the same legendary error of avrdude: stk500_recv(): programmer is not responding or avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
Verified the value of the components eg 0.1uF and 10K resistor with DMM.
Hook up the DTR line to an oscilloscope and observed the handshaking signal.
The evidence collected thus far indicated a possible timing issue on DTR line for the fail to auto-reset on the transplanted ATMega328. New versions of Arduino IDE does not show indicators of when the manual reset should be performed, but the old versions of Arduino IDE eg 1.5.6 r2 shows the handshaking hence cutting short the chase for human to spot the cue to be able to reset manually.
Christmas well spent indeed!!
Step 4: Troubleshooting Sequence With Many ATMega328p and SPEEEduino
Julian reported he had successfully burn the Arduino bootloader via the Arduino as ISP method, and verified that the sample code blink is downloaded to his SPEEEduino. His computing environment is Win10 Arduino IDE v1.6.7. More details here https://www.instructables.com/id/Burning-a-Bootloader-Onto-a-SPEEEduino-Verifying-I/
This mysterious problem give rise to an opportunity to find out the real issue with an A/B test.
Julian's SPEEEduino with freshly burn Arduino bootloader is able to download code on yours truly's win8.1 Arduino IDE1.6.5. Whereas the SPEEEduino with the transplanted ATMega832p on Julian's Win10 Arduino IDE v1.6.7 yield the legendary error of avrdude: stk500_recv(): programmer is not responding or avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
Step 5: Mystery Solved!
1. burn bootloader for used ATMega328p on SPEEEduino
2. have multiple computing environment to test out different use cases