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

Please implement a faster, native unidirectional spiTransfer() capability #466

Open
MTKilpatrick opened this issue May 22, 2020 · 0 comments

Comments

@MTKilpatrick
Copy link

MTKilpatrick commented May 22, 2020

Having experimented with SPI and being grateful for help on a previous issue in this respect, I would like to suggest:

Please consider implementing a native SPI buffer transfer function for Microbit avoiding some of the overheads of the existing spiTransfer() method which simply repeatedly calls spiWrite() byte per byte. My assumption is that many of the overheads involve repeated checks of the configuration of the SPI pins and other house-keeping functions which, for a continuous transfer of bytes from a buffer, could be avoided.

For unidirectional transfer from a Microbit - let's say to an LCD or OLED screen other device which requires the transfer of a data buffer of considerable size - a call to spiTransfer() can result in an overall data transfer rate equivalent to less than 1Mbit/second even with an SPI clock frequency of 4MHz.

I experimented with an assembler routine to deliver a buffer by a software implementation using a clock pin and a data out pin and this was able to deliver an average continuous bit-rate of upto 1.3Mbit/s: for a byte buffer of 504 bytes I found it taking only 65% of the time taken by the current spiTransfer() method with the SPI clock speed set to 4MHz, which indicates a considerable dead-time between each byte transfer.

For SPI transfers which do not need to monitor return data at the input buffer, a faster native buffer method would be most welcome.

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

No branches or pull requests

1 participant