-
Notifications
You must be signed in to change notification settings - Fork 524
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
SdSpiTeensy3.cpp - Could be faster and not need to use 512 bytes on the stack on each sector send. #506
Comments
Many board packages now support the following API:
Where txBuf or rxBuf may be nullptr and 0XFF is sent if txBuf is nullptr. Transfer mode 2 can be used and no temp buffer will be needed. Here is receive for mode 2 and here is send. I will not add special cases for Teensy. I am removing special cases as more boards support the above API. There are now endless "Arduino compatible" boards so you must fork the library for one-of-a-kind APIs. |
Thanks @greiman, I more or less 100% agree with you. In fact that is why I included the comments about the different modes.
As far as I can tell, this is for if the user chooses the SPI interface for the built in SDCard on T3.5/6/T4.x and said use Never thought you could do that (Use SPI for it...) although should work. (I think). Not sure it is worth the trouble of special driver. @PaulStoffregen - I don't believe the Teensy fork of this, has integrated this support for choosing the method of how read and write of multiple bytes has been done. Maybe something good for the next beta? @facchinm as @greiman mentioned:
I really wish that Arduino would adopt this as well, especially for all ARM base boards. Any chance of this? |
Many boards require a special begin call or combination of calls. SdFat supports a user call to setup the SPI port. Here is the form of the call
|
One final SPI option. You can wrap any SPI driver with the SdFat API. Here is an example. |
@greiman @PaulStoffregen: While @mjs513 and myself have been playing with SdFat code on another board, I noticed that
the current versions of this file, use the option 1 like code as described in this version library SdFatConfig.h file:
This code on every multi byte (512 typically) send it uses a 512 byte array on the stack, that it copiesthe data
to be sent to and then uses the m_spi->transfer(tmp, count);
code to send it.
8 years ago we added the methods:
to the Teensy SPI library.
so this code could simply be:
Likewise, currently the receive function does a memset(buf, 0xff, count);
before it calls: m_spi->transfer(buf, count);
Now if SD cards do require 0xff to be sent, you can specify what character should be sent when
you specify in the transfer, call that you are not passing it a buffer.
Something like:
The text was updated successfully, but these errors were encountered: