KurtE
Senior Member+
Thought I would take a minor diversion from this part of the problem and look at the SD.transfer stuff mentioned on the issue: Here is the class definition for the SPI wrapper.
Paul, I am going to convert to newer SPI.transfer(buf, retbuf, cnt) version to see if that helps.
This is in: sdfat\src\SpiDriver\SdSpiTeensy3.cpp
Will switch to:
Ditto for changes for send:
converts to:
I doubt it will be a giant change in performance. but...
Note: Also with the the above I mentioned
Maybe it should also include Which SPIPort you wish to transfer to, as that is an option on that object...
Paul, I am going to convert to newer SPI.transfer(buf, retbuf, cnt) version to see if that helps.
This is in: sdfat\src\SpiDriver\SdSpiTeensy3.cpp
Code:
void SdSpiArduinoDriver::send(const uint8_t* buf , size_t count) {
#if USE_BLOCK_TRANSFER
uint32_t tmp[128];
if (0 < count && count <= 512) {
memcpy(tmp, buf, count);
m_spi->transfer(tmp, count);
return;
}
#endif // USE_BLOCK_TRANSFER
for (size_t i = 0; i < count; i++) {
m_spi->transfer(buf[i]);
}
}
#endif // defined(SD_USE_CUSTOM_SPI) && defined(__arm__) &&defined(CORE_TEENSY)
Will switch to:
Code:
void SdSpiArduinoDriver::send(const uint8_t* buf , size_t count) {
#if USE_BLOCK_TRANSFER
if (0 < count && count <= 512) {
m_spi->transfer(tmp, nullptr, count);
return;
}
#endif // USE_BLOCK_TRANSFER
for (size_t i = 0; i < count; i++) {
m_spi->transfer(buf[i]);
}
}
#endif // defined(SD_USE_CUSTOM_SPI) && defined(__arm__) &&defined(CORE_TEENSY)
Ditto for changes for send:
Code:
memset(buf, 0XFF, count);
m_spi->transfer(buf, count);
Code:
m_spi->setTransferWriteFill(0xFF); // what to transfer.
m_spi->transfer(nullptr, buf, count);
I doubt it will be a giant change in performance. but...
Note: Also with the the above I mentioned
Code:
bool begin(uint8_t csPin = 10, uint32_t maxSpeed=SD_SCK_MHZ(16), uint8_t opt=0) {