Faster buffered writing in SC16IS740Base#8
Open
josephfemia wants to merge 1 commit intorickkas7:masterfrom
Open
Faster buffered writing in SC16IS740Base#8josephfemia wants to merge 1 commit intorickkas7:masterfrom
josephfemia wants to merge 1 commit intorickkas7:masterfrom
Conversation
- Only write a maximum of half of the max available bytes at a time to improve writing frequency and decrease pauses between larger byte chunks
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




I am currently using SC16IS740Base in one of my IoT projects. I noticed that writing speeds increased when utilizing a buffered array to write to the SPI line compared to writing byte by byte. However even though my SPI line supports a max of 64B per writing message, I think there could be further optimization to increase writing speeds further.
I am suggesting that the count should be set to half of the writeInternalMax and removing the delay in the while(true). This is because when waiting for the maximum available bytes before writing, I have experienced delays of 180 microseconds with longer writing periods of 10-20 minutes this delay has been seen up to 1ms. However by writing half of the byte max, there should always be enough space available for writing and there would be no delay between writing chunks of bytes. This change has resulted in improved writing speeds in my IoT project and thought it would be helpful for others and the project.