patch #8511 Fix reset on FT245R

* ft245r.c: applied patch



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1331 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
rliebscher 2014-08-18 21:08:05 +00:00
parent 37598799e0
commit 40057a9a3e
2 changed files with 20 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2014-08-18 Rene Liebscher <R.Liebscher@gmx.de>
patch #8511 Fix reset on FT245R
* ft245r.c: applied patch
2014-08-18 Rene Liebscher <R.Liebscher@gmx.de> 2014-08-18 Rene Liebscher <R.Liebscher@gmx.de>
bug #43002 usbasp debug output typo bug #43002 usbasp debug output typo

View File

@ -292,6 +292,10 @@ static int set_pin(PROGRAMMER * pgm, int pinname, int val) {
return 0; 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) { static int set_reset(PROGRAMMER * pgm, int value) {
return set_pin(pgm, PIN_AVR_RESET, value); return set_pin(pgm, PIN_AVR_RESET, value);
} }
@ -414,6 +418,12 @@ static int ft245r_program_enable(PROGRAMMER * pgm, AVRPART * p) {
*/ */
static int ft245r_initialize(PROGRAMMER * pgm, AVRPART * p) { 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); ft245r_powerup(pgm);
set_reset(pgm, OFF); set_reset(pgm, OFF);
@ -421,7 +431,11 @@ static int ft245r_initialize(PROGRAMMER * pgm, AVRPART * p) {
set_reset(pgm, ON); set_reset(pgm, ON);
usleep(5000); // 5ms usleep(5000); // 5ms
set_reset(pgm, OFF); 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); return ft245r_program_enable(pgm, p);
} }