I have a dev board for my attiny85. when connecting it to the computer I get "unknown USB device(device descriptor request failed)" although I have the needed drivers, so I thought of trying using my nodemcu. Tried connecting the SPI (to the nodemcu hmiso;hmosi;hcslk;hcs)and upload using "arduino as ISP" and compitable settings(https://www.hackster.io/arjun/programming-attiny85-with-arduino-uno-afb829). pressing "burn bootloadre" using this way gives me errors:
"avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x03
......
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x03
Error while burning bootloader."
***EDIT:
After changing a line(#define USE_OLD_STYLE_WIRING) in ArduinoISP (from example) the error code changed a bit and it shows up much faster:
"Arduino: 1.8.13 (Windows Store 1.8.42.0) (Windows 10), Board: "ATtiny25/45/85, ATtiny85, Internal 8 MHz"
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x04
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x30
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x61
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x67
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0xc1
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0xc4
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0xc5
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0xa1
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0xcc
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0xe2
Error while burning bootloader."
Any help on how to use nodemcu to program attiny85 will be great thanks
-
how did you prevent reset of the NodeMcu? try a different pin then io15 for reset of targetJuraj– Juraj ♦2020年11月06日 13:08:34 +00:00Commented Nov 6, 2020 at 13:08
-
Hi thanks for answering, first thing I tries was GPIO5 with no success :(tal itshak– tal itshak2020年11月06日 15:00:36 +00:00Commented Nov 6, 2020 at 15:00
-
how do you prevent auto-reset of the NodeMcu?Juraj– Juraj ♦2020年11月06日 15:12:39 +00:00Commented Nov 6, 2020 at 15:12
-
you mean by using a capacitor from RST to GND? I did try using a capacitor, although a 22uF one, did not worktal itshak– tal itshak2020年11月06日 16:01:49 +00:00Commented Nov 6, 2020 at 16:01
-
Using a 10 uF also did not work nor trying flashing the bootloader using the cmdtal itshak– tal itshak2020年11月08日 21:05:13 +00:00Commented Nov 8, 2020 at 21:05
1 Answer 1
Modifications to the ArduinoISP.ino sketch
I made the following changes to the ArduinoISP.ino file it exists in IDE version 1.8.13, and uploaded it to the NodeMCU board.
In short, I commented out (by way of #if 0) the heartbeat, err, etc LED related stuff. Not doing this causes the board to reset for reasons that would probably be apparent if I researched it, but I haven't and since I don't plan on using the LEDs and that you may not, I figured I would get this to you sooner.
I changed RESET to be SS which on NodeMCU is D8.
Why LED related code causes resets
... Out of curiosity I just went and looked at the ESP-12F and ESP8266EX datasheets. GPIO7, GPIO8, GPIO9 all go to the ESP-12F's SPI flash (program storage), so ostensibly monkeying with them interferes with the modules ability to keep executing from the SPI flash. They're not routed to NodeMCU pins, probably for that reason. So there's the answer to that.
Differences
@@ -70,7 +70,7 @@
// The standard pin configuration.
#ifndef ARDUINO_HOODLOADER2
-#define RESET 10 // Use pin 10 to reset the target rather than SS
+#define RESET SS // Use pin 10 to reset the target rather than SS
#define LED_HB 9
#define LED_ERR 8
#define LED_PMODE 7
@@ -216,15 +216,17 @@
#endif
void setup() {
SERIAL.begin(BAUDRATE);
+#if 0
pinMode(LED_PMODE, OUTPUT);
pulse(LED_PMODE, 2);
pinMode(LED_ERR, OUTPUT);
pulse(LED_ERR, 2);
pinMode(LED_HB, OUTPUT);
pulse(LED_HB, 2);
+#endif
}
@@ -276,6 +278,7 @@
}
void loop(void) {
+#if 0
// is pmode active?
if (pmode) {
digitalWrite(LED_PMODE, HIGH);
@@ -291,6 +294,7 @@
// light the heartbeat LED
heartbeat();
+#endif
if (SERIAL.available()) {
avrisp();
}
NodeMCU to ATTiny85 ISP Wiring
The board is wired to the ATTiny85 as follows:
NODEMCU 3.3V -> ATTINY85 PIN 8
NODEMCU GND -> ATTINY85 PIN 4
NODEMCU D5 -> ATTINY85 PIN 7
NODEMCU D6 -> ATTINY85 PIN 6
NODEMCU D7 -> ATTINY85 PIN 5
NODEMCU D8 -> ATTINY85 PIN 1
On the NodeMCU you'll find all 6 of these together on the right.
Verifying AVRDUDE functioning
avrdude -P /dev/ttyUSB0 -c stk500v1 -b 19200 -p attiny85
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x1e930b (probably t85)
avrdude: safemode: Fuses OK (E:FF, H:DF, L:71)
avrdude done. Thank you.
I've been playing with this chip, so don't be surprised that I don't have the same fuse values you have.
-
1Thanks a lot! Commenting the LED parts in the code made the diffrence.tal itshak– tal itshak2020年11月11日 13:51:08 +00:00Commented Nov 11, 2020 at 13:51
-
Good deal. I'd considered just putting only that, but wanted to make it a little more complete. To be clear, changing the pin definitions for the leds to non-problematic pins would also work. I may edit it later to to suggest and, maybe add a picture of the wiring if I get around to making a clean picture.timemage– timemage2020年11月11日 14:26:59 +00:00Commented Nov 11, 2020 at 14:26