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

HT32: SPI: avoid write collisions when SPI FIFO is disabled #361

Merged
merged 1 commit into from
Jul 17, 2023

Conversation

hansemro
Copy link
Contributor

@hansemro hansemro commented Jan 30, 2023

This improves SPI transmission reliability when SPI FIFO is not used. Without this change, I experienced hangups when frequently transmitting data to SPI flash.

For reference:
When SPI FIFO is enabled, a write collision occurs when writing to SPIDR register while both the TX buffer and SPI shift register are full (which is when TXE flag is not asserted).

When SPI FIFO is disabled, a write collision occurs when writing to SPIDR register while both TX FIFO and TX shift register are full. Here, the TXBE flag remains appropriate since it is used to check when TX buffer is empty and when the TX FIFO is below a set threshold value.

This fixes possible write collisions experienced when SPI FIFO is
disabled due to not checking whether the SPI shift register is empty
before writing. This is done by checking TXE flag instead of TXBE flag
when the FIFO is not used.
@fpoussin fpoussin merged commit 3197a82 into ChibiOS:chibios-21.11.x Jul 17, 2023
@fpoussin
Copy link
Member

Thank you!

This pull request was closed.
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.

2 participants