patch #9122: Fixed MISO sampling in ftdi_syncbb

Submitted by Ivan Frederiks

Fix MISO sampling on falling edge of SCK.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1474 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Joerg Wunsch 2021-11-14 15:44:54 +00:00
parent ebea9b5237
commit e8c5ed0fcd
2 changed files with 14 additions and 1 deletions

2
NEWS
View File

@ -107,6 +107,8 @@ Current:
patch #9110: Let reserved fuse bits to be read as *don't care* patch #9110: Let reserved fuse bits to be read as *don't care*
patch #9253: Fix for giving terminal_mode commands more than 20 arguments patch #9253: Fix for giving terminal_mode commands more than 20 arguments
patch #9320: fix TPI RESET in bitbang.c patch #9320: fix TPI RESET in bitbang.c
patch #9079: Fix ftdi_syncbb teardown (supersedes #9893)
patch #9122: Fixed MISO sampling in ftdi_syncbb
* Internals: * Internals:
- New avrdude.conf keyword "family_id", used to verify SIB attributes - New avrdude.conf keyword "family_id", used to verify SIB attributes

View File

@ -469,7 +469,8 @@ static inline int set_data(PROGRAMMER * pgm, unsigned char *buf, unsigned char d
static inline unsigned char extract_data(PROGRAMMER * pgm, unsigned char *buf, int offset) { static inline unsigned char extract_data(PROGRAMMER * pgm, unsigned char *buf, int offset) {
int j; int j;
int buf_pos = 1; int buf_pos = FT245R_CYCLES; /* MISO data is valid AFTER rising SCK edge,
i.e. in next clock cycle */
unsigned char bit = 0x80; unsigned char bit = 0x80;
unsigned char r = 0; unsigned char r = 0;
@ -845,6 +846,11 @@ static int ft245r_paged_write_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_AVR_SCK,0); // sck down ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_AVR_SCK,0); // sck down
buf[buf_pos++] = ft245r_out; buf[buf_pos++] = ft245r_out;
} }
else {
/* stretch sequence to allow correct readout, see extract_data() */
buf[buf_pos] = buf[buf_pos - 1];
buf_pos++;
}
ft245r_send(pgm, buf, buf_pos); ft245r_send(pgm, buf, buf_pos);
put_request(addr_save, buf_pos, 0); put_request(addr_save, buf_pos, 0);
//ft245r_sync(pgm); //ft245r_sync(pgm);
@ -934,6 +940,11 @@ static int ft245r_paged_load_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_AVR_SCK,0); // sck down ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_AVR_SCK,0); // sck down
buf[buf_pos++] = ft245r_out; buf[buf_pos++] = ft245r_out;
} }
else {
/* stretch sequence to allow correct readout, see extract_data() */
buf[buf_pos] = buf[buf_pos - 1];
buf_pos++;
}
n = j; n = j;
ft245r_send(pgm, buf, buf_pos); ft245r_send(pgm, buf, buf_pos);
put_request(addr_save, buf_pos, n); put_request(addr_save, buf_pos, n);