-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
flush FTDI buffer to avoid 16ms latency timeout #169
base: master
Are you sure you want to change the base?
Conversation
Hi, With your commit i can't compile : "FTDI_CTS" unable to resolve identifier "FTDI_CTS" on spi.c file. |
it is defined in hardwarev3.h line 104 and 105: #define FTDI_CTS_DIR TRISAbits.TRISA3 |
Hi, Indeed, the issue is with BUSPIRATEV4 board. Could you add |
small explanation how this patch is 30 seconds faster on a 4MB flash. the flashrom software reads the flash in chunks of 2kb blocks. the FTDI chip sends the data in even smaller chunks over the USB interface. But the last chunk of the 2KB does not fill the buffer so the FTDI chip waits up to 16ms before it sends a not completely full buffer. Toggling the CTS line flushes the buffer immediately. 4MB flash divided by 2KB are 2048 transfers where we can save 16ms which is (in theory) 32.768 seconds. for further reading: https://ftdichip.com/wp-content/uploads/2020/08/AN232B-04_DataLatencyFlow.pdf |
Based on the original work of @denis2342 at BusPirate#169 - I have reviewed this commit and believe it is OK. Also improved the ifdef, works fine both for v3 and v4. Co-authored-by: denis2342 <[email protected]> Signed-off-by: Mike Banon <[email protected]>
with this patch I could cut down the time to read a 4MB spi flash from 1min to 30sec.
9b3566c
to
4c2c104
Compare
1. USB led logic is corrected (was reversed) 2. pirate-loader hello now works without resetting the buspirate 3. you get into the bootloader while pressing the mode button at start 4. changed version to 4.12
pirate-loader does not show errors anymore after successful actions like hello or flashing new firmware. also better error reporting. increased version to 1.0.4 should be used with bootloader 4.12 but works with 4.10 also
flashrom starts with binary mode and then wants to return to interactive mode to get the version and stuff. the method to reset only works for BPv3. the BPv4 uses USB which does not like the reset. Use another method to get back to the interactive mode.
67a56ce
to
9dac9c6
Compare
A change about 8 years ago made the SPI speed table incompatible with the flashrom tool. flashrom thinks it set 8MHz SPI speed when in reality it was only 2.6MHz. Changing the table back to the state it was to make it (again) compatible with the flashrom tool.
with this patch I could cut down the time to read a 4MB spi flash from 1min to 30sec.