Author Topic: Program ATmega Via WinAVR Arduino-avrdude:stk500_getsync():not in sync:resp=0x00  (Read 1431 times)

0 Members and 1 Guest are viewing this topic.

Offline 2XTopic starter

  • Frequent Contributor
  • **
  • Posts: 385
  • Country: gr
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 AVRDUDE
https://www.ladyada.net/learn/avr/avrdude.html


Write CMD commands:
avrdude -c arduino -b 19200 -p m128 -P COM3 -U flash:w:mega128_flash.hex:i         //Flash Write

avrdude -c arduino -b 19200 -p m128 -P COM3 -U eeprom:w:mega128_eeprom.hex:i      //Eeprom Write

avrdude -c arduino -b 19200 -p m128 -P COM3 -U hfuse:w:mega128_hfuse.hex:i         //High Fuse Write

avrdude -c arduino -b 19200 -p m128 -P COM3 -U lfuse:w:mega128_lfuse.hex:i         //Low Fuse Write

avrdude -c arduino -b 19200 -p m128 -P COM3 -U efuse:w:mega128_efuse.hex:i         //Extended Fuse Write


Arduino as ISP and Arduino Bootloaders
https://docs.arduino.cc/built-in-examples/arduino-isp/ArduinoISP/




« Last Edit: January 07, 2025, 11:29:09 pm by 2X »
 

Online RoGeorge

  • Super Contributor
  • ***
  • Posts: 7049
  • Country: ro
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.
 
The following users thanked this post: 2X

Offline squadchannel

  • Frequent Contributor
  • **
  • Posts: 439
  • Country: jp
  • deepl translate user
internal pull-up on the RESET pin is useless 99% of the time. It is too weak.
Try replacing the diode with a 10Kohm.
 
The following users thanked this post: 2X

Offline 2XTopic starter

  • Frequent Contributor
  • **
  • Posts: 385
  • Country: gr
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:            0
    Parity:          None
    Data Bits:       0
    Stop Bits:       1
    Timeout:         OFF
    XON/XOFF:        OFF
    CTS handshaking: OFF
    DSR handshaking: OFF
    DSR sensitivity: OFF
    DTR circuit:     OFF
    RTS circuit:     ON


Status for device CON:
----------------------
    Lines:          9001
    Columns:        120
    Keyboard rate:  31
    Keyboard delay: 1
    Code page:      737




After changing the port to COM15

Status for device COM15:
------------------------
    Baud:            0
    Parity:          None
    Data Bits:       0
    Stop Bits:       1
    Timeout:         OFF
    XON/XOFF:        OFF
    CTS handshaking: OFF
    DSR handshaking: OFF
    DSR sensitivity: OFF
    DTR circuit:     OFF
    RTS circuit:     ON


Status for device CON:
----------------------
    Lines:          9001
    Columns:        120
    Keyboard rate:  31
    Keyboard delay: 1
    Code page:      737




« Last Edit: January 09, 2025, 12:49:56 am by 2X »
 

Offline ifrythings

  • Contributor
  • Posts: 25
  • Country: ca
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.
 
The following users thanked this post: 2X

Offline 2XTopic starter

  • Frequent Contributor
  • **
  • Posts: 385
  • Country: gr
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.


The device that I am using for the ISP communication is the Arduino UNO.
 

Offline 2XTopic starter

  • Frequent Contributor
  • **
  • Posts: 385
  • Country: gr
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   

 

Online RoGeorge

  • Super Contributor
  • ***
  • Posts: 7049
  • Country: ro
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.


The device that I am using for the ISP communication is the Arduino UNO.

Arduino 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 try ifrythings advice.

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)
« Last Edit: January 09, 2025, 08:25:14 am by RoGeorge »
 
The following users thanked this post: 2X

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4361
  • Country: us
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.

 
The following users thanked this post: 2X

Offline 2XTopic starter

  • Frequent Contributor
  • **
  • Posts: 385
  • Country: gr
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.
 

Offline 2XTopic starter

  • Frequent Contributor
  • **
  • Posts: 385
  • Country: gr
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).

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf