Program ATmega Via WinAVR Arduino-avrdude:stk500_getsync():not in sync:resp=0x00 - Page 1
Forum section: electronics / general

author: 2X
author_rank: Frequent Contributor
timestamp: January 07, 2025, 10:23:31 pm
content: Hi,I am trying to program the ATmega128A-AU microcontroller via an arduino UNO with ISP in windows 11. I have use the below method before some years (in windows 10) and worked on the same MCU. Now always I am getting the same error "avrdude: stk500_getsync(): not in sync: resp=0x00".The ATmega128A-AU is a brand new chip and also the Arduino Uno can be programmed from the Arduino IDE v2.3.4, so the bootloader of the arduino it works fine I assume. Any ideas?Running AVRDUDEhttps://www.ladyada.net/learn/avr/avrdude.htmlWrite CMD commands:avrdude -c arduino -b 19200 -p m128 -P COM3 -U flash:w:mega128_flash.hex:i //Flash Writeavrdude -c arduino -b 19200 -p m128 -P COM3 -U eeprom:w:mega128_eeprom.hex:i //Eeprom Writeavrdude -c arduino -b 19200 -p m128 -P COM3 -U hfuse:w:mega128_hfuse.hex:i //High Fuse Writeavrdude -c arduino -b 19200 -p m128 -P COM3 -U lfuse:w:mega128_lfuse.hex:i //Low Fuse Writeavrdude -c arduino -b 19200 -p m128 -P COM3 -U efuse:w:mega128_efuse.hex:i //Extended Fuse WriteArduino as ISP and Arduino Bootloadershttps://docs.arduino.cc/built-in-examples/arduino-isp/ArduinoISP/

author: RoGeorge
author_rank: Super Contributor
timestamp: January 08, 2025, 08:50:58 am
content: Did you add a 10..100uF from Reset to GND (on the Arduino board that plays the role of a programmer)?Without that, an Arduino board can not program another microcontroller, but I don't recall the exact error.

author: squadchannel
author_rank: Frequent Contributor
timestamp: January 08, 2025, 09:14:14 am
content: internal pull-up on the RESET pin is useless 99% of the time. It is too weak.Try replacing the diode with a 10Kohm.

author: 2X
author_rank: Frequent Contributor
timestamp: January 08, 2025, 10:22:30 pm
content: I put a 4,7uF capacitor on the RESET pin and also I tried to program it on a different friend's PC with windows 10 and worked fine. So the problem is software on my PC. Any suggestions?I found the below video. I changed the port from COM3 to COM15 and the same thing again, but in cmd terminal in my PC the " DTR circuit" is OFF ( I don't know if this must e enabled). Do you know a way how to check the port where I am using is OK? The problem is software and not hardware.Status for device COM3:-----------------------Baud: 0Parity: NoneData Bits: 0Stop Bits: 1Timeout: OFFXON/XOFF: OFFCTS handshaking: OFFDSR handshaking: OFFDSR sensitivity: OFFDTR circuit: OFFRTS circuit: ONStatus for device CON:----------------------Lines: 9001Columns: 120Keyboard rate: 31Keyboard delay: 1Code page: 737After changing the port to COM15Status for device COM15:------------------------Baud: 0Parity: NoneData Bits: 0Stop Bits: 1Timeout: OFFXON/XOFF: OFFCTS handshaking: OFFDSR handshaking: OFFDSR sensitivity: OFFDTR circuit: OFFRTS circuit: ONStatus for device CON:----------------------Lines: 9001Columns: 120Keyboard rate: 31Keyboard delay: 1Code page: 737

author: ifrythings
author_rank: Contributor
timestamp: January 08, 2025, 10:26:19 pm
content: Is your USB to serial chip a WCH 340 or variant of that? The last 2 driver updates that windows shoves down your ….. don’t work, if you have that chip see what year the driver is 2023 and 2024 don’t work, roll back to a 2019 driver and it will work.

author: 2X
author_rank: Frequent Contributor
timestamp: January 08, 2025, 11:11:13 pm
content: Quote from: ifrythings on January 08, 2025, 10:26:19 pmThe device that I am using for the ISP communication is the Arduino UNO.

author: 2X
author_rank: Frequent Contributor
timestamp: January 09, 2025, 12:05:22 am
content: One thing that I noticed... after I write the avrdude command the RTS went OFF.avrdude -c arduino -b 19200 -p m128 -P COM15 -U flash:r:mega128_flash.hex:i

author: RoGeorge
author_rank: Super Contributor
timestamp: January 09, 2025, 08:20:43 am
content: Quote from: 2X on January 08, 2025, 11:11:13 pmArduino UNO is connected to a PC through a USB to serial chip. That chip is on the Arduino UNO board, can be either a FTD, or a CH340G, or something else with a similar function: USB to serial. The exact chip depends of the manufacturer, there's no standard, but each chip has its own Windows driver. The Windows drivers are unrelated with the Arduino IDE, or with the avrdude. It's a Windows thing.CH340 is about 10 times cheaper, so most Arduino UNO will not have the expensive FTDI. That USB to serial bridge, no matter the model has to have Windows drivers installed, or else Windows won't be able to control it.I don't use Windows, but I remember driver problems in the past, for both FTDI and CH340, each with different driver problems. I would tryifrythingsadvice.Another thing (if still doesn't work after you replace the Windows drivers), I remember using 100uF electrolytic capacitor on the Reset, not 4.7uF. 4.7uF seems too small. Try a bigger capacitor, or if you don't have any, put in parallel 2..3 capacitors of 4.7uF each, to make a bigger one. It won't damage the board. A bigger than 4.7uF on Reset won't damage the board, so just plug another one between Reset and GND of the UNO programmer and see if it starts working.Which USB-to-serial chip is on your Arduino UNO (programmer) board?(usually the USB-to-serial chip is located near the USB connector, so not the ATmega microcontroller)

author: westfw
author_rank: Super Contributor
timestamp: January 09, 2025, 10:42:52 am
content: A “real” Arduino Uno has an atmega16u2 with firmware that does the usb to serial function. THAT is “the standard.” But it’s all open source, and other manufacturers have used “many” other usb/serial chips (ch340 is very popular. Ft230rl was used on pre-uno boards, and it (or counterfeits thereof) is still popular on derivatives. Newer ft231 chips, cp21xx (Silabs or cypress?), and I think even pl2103 counterfeits have shown up…)However, since you are able to program the uno, you should be past the driver issues.

author: 2X
author_rank: Frequent Contributor
timestamp: January 09, 2025, 07:41:24 pm
content: The chip for programming the Arduino is the "ATmega16U2" as "westfw" refered in the provious post. I have the original Arduino UNO R3.Also, I tried capacitors 10uF, 100uF and 1000uF and the same error again and agai.

author: 2X
author_rank: Frequent Contributor
timestamp: January 11, 2025, 04:02:33 am
content: Finally the problem was that the Arduino isn't programmed right with the ISP code. I reprogramed the Arduino chip "ATMEGA328P" with the bootloader again and worked fine. Also, I programmed the ATmega128A-AU microcontroller with the Xgpro v12.67 (XGecu T56 Universal programmer) with ICSP. Then I read the program from the ATmega128A-AU with avrdude and Xgpro and I compared them between and were identical. Many thanks all of you for the help.P.S. Attention... The Xgpro doesn't save the fuses like the avrdude. You can only save the EEPROM & Flash ("default" option on save as) and you have to take a screeenshot from the config/fuses window in order to set them right the next time that you will open the Xgpro. Also, you can save all of them (EEPROM & Flash & Fuses Low, High, Extended & Lock Bit) in one packet... (Project -> Save Project).