[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avrdude-dev] [bug #53839] ATtiny and Programmer running after download
From: |
John Barrington |
Subject: |
[avrdude-dev] [bug #53839] ATtiny and Programmer running after download done |
Date: |
Fri, 4 May 2018 18:03:20 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36 |
URL:
<http://savannah.nongnu.org/bugs/?53839>
Summary: ATtiny and Programmer running after download done
Project: AVR Downloader/UploaDEr
Submitted by: johnbarr
Submitted on: Fri 04 May 2018 10:03:18 PM UTC
Category: None
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Originator Name: John Barrington
Originator Email:
Open/Closed: Open
Release: 6.3
Discussion Lock: Any
Programmer hardware: USBtinyISP & Genuino
Device type: ATtiny84
_______________________________________________________
Details:
We have analyzed the actions of our programmer, Avrdude / USBtinyISP, when and
after downloading our HEX file to our ATtiny84. We find faulty behavior after
download is complete.
Before Avrdude starts downloading, RESET (Attiny84 pin 4) is HIGH. While
Avrdude is downloading code, it sets RESET to LOW. When Avrdude is finished
downloading it sets RESET back to HIGH and, RESET being HIGH, our downloaded
code starts running immediately while the chip is still in the programmer
socket.
Using an alternative programmer, an Arduino Genuino running ArduinoISP.ino, we
find the problem also exists. When we used the Genuino as a programmer running
ArduinoISP instead of a USBtinyISP, ArduinoISP also set RESET back to HIGH.
Modifying ArduinoISP.ino (see code below) to continually write RESET LOW after
downloading keeps our downloaded code from running and interrogating Pin 9,
the programmer's SCK. This allows the Attiny84 and its code, when moved from
the programmer socket to its destination and run uninterrupted by any pulses
on Pin 9, to find the initial value in the first byte of EEPROM.
------------------------------------------------------------------
Bug #1: After Avrdude has finished downloading, RESET should be left LOW so
that the ATtiny84 downloaded program will not run (until the ATtiny84 chip is
removed from the programmer socket and placed in its final destination).
------------------------------------------------------------------
After the programmer has finished downloading our code to the ATtiny84, our
code runs and writes output. The programmer reads this output and writes to
the ATtiny84, to the programmer's SCK output. Our code recognized this
spurious pin 9 input (a "switch input" to the code) and, in response, writes
the first byte of the ATtiny84 EEPROM.
Both USBtinyISP and ArduinoISP continue running after setting RESET to HIGH.
Thus both the programmer and the downloaded code in the ATtiny84 are RUNNING
AT THE SAME TIME.
------------------------------------------------------------------
Bug #2: After the programmer, ArduinoISP or USBtinyISP, has finished
downloading, it should loop doing nothing. It should not read from the
ATtiny84 nor write to it.
------------------------------------------------------------------
We find:
1. The problem occurs with multiple versions of Avrdude.
2. The problem occurs with all of our USBtinyISPs.
---------------------------------------------------------------------------------
Part of Arduino ISP:
void end_pmode() {
SPI.end();
// We're about to take the target out of reset // WHY? so configure SPI pins
as input
pinMode(PIN_MOSI, INPUT);
pinMode(PIN_SCK, INPUT);
reset_target(false);
pinMode(RESET, INPUT);
pmode = 0;
)
---------------------------------------------------------------------------------
The same part of Arduino ISP, modified to work:
void end_pmode() {
SPI.end();
// We're about to take the target out of reset so configure SPI pins as input
pinMode(PIN_MOSI, INPUT);
pinMode(PIN_SCK, INPUT);
//reset_target(false);
//pinMode(RESET, INPUT);
//
//Keep RESET low:
digitalWrite(RESET, LOW);
// Keep continually setting RESET LOW
pmode = 0;
}
-----------------------------------------
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/bugs/?53839>
_______________________________________________
Message sent via Savannah
https://savannah.nongnu.org/
- [avrdude-dev] [bug #53839] ATtiny and Programmer running after download done,
John Barrington <=