Skip to content

Faster buffered writing in SC16IS740Base#8

Open
josephfemia wants to merge 1 commit intorickkas7:masterfrom
josephfemia:witing_improvement
Open

Faster buffered writing in SC16IS740Base#8
josephfemia wants to merge 1 commit intorickkas7:masterfrom
josephfemia:witing_improvement

Conversation

@josephfemia
Copy link
Copy Markdown

  • 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

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.

- 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
@josephfemia
Copy link
Copy Markdown
Author

Current Implementation Speeds and Writing Delays:
image
image

Proposed Implementation Speeds and Writing Delays:
image
image

Just an FYI, the responses are 4KB chunks of data.

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