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

[chore] Speedup for simple SPI.transfer #2082

Closed
wants to merge 2 commits into from

Conversation

RudolphRiedel
Copy link

@RudolphRiedel RudolphRiedel commented Jul 22, 2023

Summary

This PR gives a speed boost to simple SPI.transfer(data) and SPI.transfer(buffer, count) operations
in which the user controls the chip-select by directly using only the necessary LL-HAL functions and not going thru the CS controlling functions and the spi_transfer() function.

With no DMA support in the SPI class the sending of a buffer takes a long time and with this modification
it takes at least less time.

Measured with STM32C031C6, SPI clock 8MHz and a buffer of 231 bytes:
digitalWrite(CS, LOW);
SPI.transfer(&buffer, 231);
digitalWrite(CS, HIGH);

original code: 587,26µs
this pr: 474.92µs

@fpistm fpistm added the enhancement New feature or request label Aug 4, 2023
@fpistm
Copy link
Member

fpistm commented Aug 4, 2023

Hi @RudolphRiedel
I will not be able to review it soon but will get back to you when review it.

@fpistm fpistm self-requested a review October 19, 2023 15:12
@fpistm fpistm changed the title - major speedup for simple SPI.transfer(data) and SPI.transfer(buffer… [chore] Speedup for simple SPI.transfer Oct 31, 2023
@fpistm
Copy link
Member

fpistm commented Nov 9, 2023

Hi @RudolphRiedel
Thanks for this PR. When reviewed it, I though we can go further and remove some unused and over complicated internal CS management. That's why I've made this PR: #2171 .
Feel free to test ang give your feedback.
So I close this one as the new PR include your proposal.

@fpistm fpistm closed this Nov 9, 2023
@fpistm fpistm added the abandoned No more work on this label Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
abandoned No more work on this enhancement New feature or request
Projects
Development

Successfully merging this pull request may close these issues.

2 participants