Actually, the SCK has to be set before powerup, so the new line goes
before power setting :)
Sorry,
D.
On 09/22/2013 08:13 PM, "Ing. Daniel Rozsnyó" wrote:
I was quite impatient so I started debugging with adding printf() to the
ft245 code... and found out that the reset is done wrong.
So I fixed it:
- main issue: after some instruction (presumably chip erase) the SCK
is H, so in that case, the consequent enter programming mode was of no
success
- the timing does not reflect the datasheet of the cpu (20ms!)
Patch attached. I'll also try to solve the last annoying bit - lockup
after the command is done.
Daniel
On 09/22/2013 05:47 PM, "Ing. Daniel Rozsnyó" wrote:
Hello,
is the fuse reading and programming too different from a chip erase ?
I am having trouble flashing a ATmega88PA chip - lowering the bitrate
does not help (anyway at 250400 it behaves "realtime", at 9600 reading
the fuses takes 10-15sec! And it still wont exit correctly):
*$ avrdude -c arduino-ft232r -P usb -p atmega88p -b 250400 -e*
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x1e930f
avrdude: erasing chip
avrdude: Device is not responding to program enable. Check connection.
^C
*$ avrdude -c arduino-ft232r -P usb -p atmega88p -b 9600 -e*
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 9.51s
avrdude: Device signature = 0x1e930f
avrdude: erasing chip
avrdude: Device is not responding to program enable. Check connection.
^C
This works:
*$ avrdude -c arduino-ft232r -P usb -p atmega88p -b 250400 -U
efuse:w:0x00:m**
*
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x1e930f
avrdude: reading input file "0x00"
avrdude: writing efuse (1 bytes):
Writing | ################################################## | 100% 0.01s
avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0x00:
avrdude: load data efuse data from input file 0x00:
avrdude: input file 0x00 contains 1 bytes
avrdude: reading on-chip efuse data:
Reading | ################################################## | 100% 0.00s
avrdude: verifying ...
avrdude: 1 bytes of efuse verified
avrdude: safemode: Fuses OK (E:00, H:DC, L:E7)
^C
*$ avrdude -c arduino-ft232r -P usb -p atmega88p -b 250400 -U
efuse:w:0x01:m*
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x1e930f
avrdude: reading input file "0x01"
avrdude: writing efuse (1 bytes):
Writing | ################################################## | 100% 0.01s
avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0x01:
avrdude: load data efuse data from input file 0x01:
avrdude: input file 0x01 contains 1 bytes
avrdude: reading on-chip efuse data:
Reading | ################################################## | 100% 0.00s
avrdude: verifying ...
avrdude: 1 bytes of efuse verified
avrdude: safemode: Fuses OK (E:01, H:DC, L:E7)
^C
FULL VERBOSE REPORT:
*$ avrdude -c arduino-ft232r -P usb -p atmega88p -b 250400 -e -vvv*
avrdude: Version 6.1-svn-20130917, compiled on Sep 22 2013 at 17:32:10
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is "/usr/local/etc/avrdude.conf"
User configuration file is "/home/daniel/.avrduderc"
Using Port : usb
Using Programmer : arduino-ft232r
Overriding Baud Rate : 250400
avrdude: <unknown>: Pin is ok.
avrdude: VCC: Pin is ok.
avrdude: BUFF: Pin is ok.
avrdude: RESET: Pin is ok.
avrdude: SCK: Pin is ok.
avrdude: MOSI: Pin is ok.
avrdude: MISO: Pin is ok.
avrdude: ERRLED: Pin is ok.
avrdude: RDYLED: Pin is ok.
avrdude: PGMLED: Pin is ok.
avrdude: VFYLED: Pin is ok.
ft245r: spi bitclk 250400 -> ft baudrate 500800
AVR Part : ATmega88P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages
MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------
----- ----- ---------
eeprom 65 20 4 0 no 512 4 0
3600 3600 0xff 0xff
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages
MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------
----- ----- ---------
flash 65 6 64 0 yes 8192 64 128
4500 4500 0xff 0xff
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages
MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------
----- ----- ---------
lfuse 0 0 0 0 no 1 0 0
4500 4500 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages
MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------
----- ----- ---------
hfuse 0 0 0 0 no 1 0 0
4500 4500 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages
MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------
----- ----- ---------
efuse 0 0 0 0 no 1 0 0
4500 4500 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages
MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------
----- ----- ---------
lock 0 0 0 0 no 1 0 0
4500 4500 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages
MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------
----- ----- ---------
calibration 0 0 0 0 no 1 0 0
0 0 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages
MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------
----- ----- ---------
signature 0 0 0 0 no 3 0 0
0 0 0x00 0x00
Programmer Type : ftdi_syncbb
Description : Arduino: FT232R connected to ISP
Pin assignment : 0..7 = DBUS0..7
VCC = (not used)
BUFF = (not used)
RESET = 7
SCK = 5
MOSI = 6
MISO = 3
ERR LED = (not used)
RDY LED = (not used)
PGM LED = (not used)
VFY LED = (not used)
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x1e930f
avrdude: safemode read 1, lfuse value: e7
avrdude: safemode read 2, lfuse value: e7
avrdude: safemode read 3, lfuse value: e7
avrdude: safemode: lfuse reads as E7
avrdude: safemode read 1, hfuse value: dc
avrdude: safemode read 2, hfuse value: dc
avrdude: safemode read 3, hfuse value: dc
avrdude: safemode: hfuse reads as DC
avrdude: safemode read 1, efuse value: 1
avrdude: safemode read 2, efuse value: 1
avrdude: safemode read 3, efuse value: 1
avrdude: safemode: efuse reads as 1
avrdude: erasing chip
avrdude: Program enable command not successful. Retrying.
avrdude: Program enable command not successful. Retrying.
avrdude: Program enable command not successful. Retrying.
avrdude: Program enable command not successful. Retrying.
avrdude: Device is not responding to program enable. Check connection.
Thanks,
Daniel
_______________________________________________
avrdude-dev mailing list
avrdude-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/avrdude-dev
_______________________________________________
avrdude-dev mailing list
avrdude-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/avrdude-dev
--- ../avrdude.old/ft245r.c 2013-09-22 17:00:01.413993533 +0200
+++ ft245r.c 2013-09-22 20:14:52.724413842 +0200
@@ -296,6 +296,10 @@
return 0;
}
+static int set_sck(PROGRAMMER * pgm, int value) {
+ return set_pin(pgm, PIN_AVR_SCK, value);
+}
+
static int set_reset(PROGRAMMER * pgm, int value) {
return set_pin(pgm, PIN_AVR_RESET, value);
}
@@ -418,6 +422,12 @@
*/
static int ft245r_initialize(PROGRAMMER * pgm, AVRPART * p) {
+ /* Apply power between VCC and GND while RESET and SCK are set to â0â. In some systems,
+ * the programmer can not guarantee that SCK is held low during power-up. In this
+ * case, RESET must be given a positive pulse of at least two CPU clock cycles duration
+ * after SCK has been set to â0â.
+ */
+ set_sck(pgm, OFF);
ft245r_powerup(pgm);
set_reset(pgm, OFF);
@@ -425,7 +435,11 @@
set_reset(pgm, ON);
usleep(5000); // 5ms
set_reset(pgm, OFF);
- usleep(5000); // 5ms
+
+ /* Wait for at least 20 ms and enable serial programming by sending the Programming
+ * Enable serial instruction to pin MOSI.
+ */
+ usleep(20000); // 20ms
return ft245r_program_enable(pgm, p);
}
_______________________________________________
avrdude-dev mailing list
avrdude-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/avrdude-dev