Skip to content

Commit

Permalink
flush FTDI buffer to avoid 16ms latency timeout
Browse files Browse the repository at this point in the history
with this patch I could cut down the time to read a
4MB spi flash from 1min to 30sec.
  • Loading branch information
denis2342 committed Mar 15, 2024
1 parent 4bd112b commit 4c2c104
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Firmware/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,9 @@ void user_serial_initialise(void) {
U1STA = 0x0400;

IFS0bits.U1RXIF = NO;

/* FTDI CTS setup. */
FTDI_CTS_DIR = OUTPUT;
}

bool user_serial_transmit_done(void) { return U1STAbits.TRMT; }
Expand Down
4 changes: 4 additions & 0 deletions Firmware/spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,10 @@ void spi_enter_binary_io(void) {
REPORT_IO_FAILURE();
break;
}
#ifdef BUSPIRATEV3
/* avoid the 16ms FTDI buffer send latency */
FTDI_CTS = !FTDI_CTS;
#endif
}
}

Expand Down

0 comments on commit 4c2c104

Please sign in to comment.