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.
1 Answer 1
Try these steps:
- Install ArduinoISP (in the examples menu) on your Arduino board.
- Disable reset on the Arduino board by adding a 10μF capacitor between the RESET and GND pins.
- Wire the ATTiny chip to the Arduino following this schematic.
- 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
.
-
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)See Jian Shin– See Jian Shin2017年05月26日 14:51:39 +00:00Commented 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– Majenko2017年05月26日 14:52:33 +00:00Commented May 26, 2017 at 14:52
-
Oh, and is your Arduino really on COM1?Majenko– Majenko2017年05月26日 14:53:01 +00:00Commented 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.See Jian Shin– See Jian Shin2017年05月26日 14:56:26 +00:00Commented May 26, 2017 at 14:56
-
1Another 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– Majenko2017年05月26日 15:08:08 +00:00Commented May 26, 2017 at 15:08
-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.-c arduino
and before testing it again with the reset disabled?