0

I was trying to upload a hex file to my attiny85 with an arduino,and I came across this:

avrdude -c avrisp (followed by other codes and the flash address )

This doesn't work and it gave one of the most famous arduino errors : stk500_getsync() : not in sync: resp=0x00

Then I tried

   avrdude -c arduino 

And the code was successfully downloaded, but the chip itself doesn't work as intended. So this is the question, what does the -c [programmer id] actually do, for example in this case, does it download the hex file to my arduino?

Thanks in advance.

18
  • DId you disable the reset on the Arduino after installing the ArduinoISP sketch? If not, then you just reprogrammed the Arduino with your ATTiny85 program.
    – Majenko
    May 26, 2017 at 14:15
  • @Majenko disable with capacitor at the reset? I just tried and same error code with avrisp.(Also I don't know if I actually prevented the reset or not, no way I know now.) So the arduino option programs the arduino regardless of what chip I choose later ? May 26, 2017 at 14:21
  • The -c selects which protocol to use to talk to the remote device. -c arduino selects the Arduino's bootloader as the protocol to use. -c avrisp selects the protocol spoken by the ArduinoISP sketch.
    – Majenko
    May 26, 2017 at 14:22
  • Did you reprogram the ArduinoISP sketch back on the Arduino after breaking it with -c arduino and before testing it again with the reset disabled?
    – Majenko
    May 26, 2017 at 14:23
  • @Majenko the one in the example , yes. I also reburned the bootloader for the attiny85 just in case . Since the data flows from my laptop through the arduino then into the attiny85, does this mean that by selecting -c arduino will download the hex file into the arduino, or download the hex file into the attiny85 with arduino protocol ? May 26, 2017 at 14:31

1 Answer 1

0

Try these steps:

  1. Install ArduinoISP (in the examples menu) on your Arduino board.
  2. Disable reset on the Arduino board by adding a 10µF capacitor between the RESET and GND pins.
  3. Wire the ATTiny chip to the Arduino following this schematic.
  4. Run the upload command using -c avrisp with your program's HEX file

Alternatively you can just install the boards package detailed in the schematic link and program it directly from the Arduino IDE instead of messing with the avrdude upload command.

You must also ensure that you are uploading at the right baud rate. The ArduinoISP sketch defaults to 19200 baud:

// Configure the baud rate:

#define BAUDRATE    19200
// #define BAUDRATE 115200
// #define BAUDRATE 1000000

and you must match that in your avrdude command with, for example, -b 19200.

11
  • C:\Users\User>avrdude -c avrisp -P com1 -p t85 -Uflash:w:C:\Users\User\Desktop\sd8p_mo.hex:i avrdude: stk500_getsync(): not in sync: resp=0x00 avrdude done. Thank you. (exact code and error returned. also using 22uF capacitor, other forum said it was okay) May 26, 2017 at 14:51
  • I would suggest you forget using the command line for this. Follow the tutorial I linked to step by step and use the IDE for everything.
    – Majenko
    May 26, 2017 at 14:52
  • Oh, and is your Arduino really on COM1?
    – Majenko
    May 26, 2017 at 14:53
  • it is. I changed it in the device manager and made sure of it in the arduino ide. The code I want to import is found in hex.(elm-chan.org/works/sd8p/report.html), and the tutorial only allows ide, if im right. May 26, 2017 at 14:56
  • 1
    Another one to try is -c stk500v1. It's really confusing - they have "ArduinoISP", "ArduinoISPOrg" and "ArduinoAsISP" - all to do the same thing and all slightly different. I guess for different versions of the ArduinoISP code.
    – Majenko
    May 26, 2017 at 15:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.