Skip to content
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

Binary SPI write-then-read doesn't confirm when there's nothing to read #158

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mpasternacki
Copy link

In binary SPI mode, the write-then-read command is supposed to send a confirmation byte (0x01) when the operation is complete. This happens in spi_read_to_uart, which is called only when read > 0.

When there is 0 bytes to read, BusPirate doesn't send any confirmation (and application needs to guess how long it needs to sleep to use SPI again without interfering).

Flashrom uses write-then-read without read to send commands (e.g. erase, program page). It waits for confirmation byte, which never arrives, so flashrom hangs.

This patch fixes the problem. I tested that the confirmation byte is sent and that flashrom no longer hangs.

mikebdp2 added a commit to mikebdp2/Bus_Pirate that referenced this pull request Feb 11, 2024
Based on the original work of @mpasternacki at
BusPirate#158
- I have reviewed this commit and believe it is OK.

Co-authored-by: Maciej Pasternacki <[email protected]>
Signed-off-by: Mike Banon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant