Switch to TMC2130 compatible hardware SPI & misc (#10299)
This commit is contained in:
committed by
Scott Lahteine
parent
1c36606886
commit
902c885782
@ -249,15 +249,16 @@ bool Sd2Card::init(uint8_t sckRateID, pin_t chipSelectPin) {
|
||||
watchdog_reset();
|
||||
#endif
|
||||
|
||||
// set pin modes
|
||||
pinMode(chipSelectPin_, OUTPUT); // Solution for #8746 by @benlye
|
||||
// Set pin modes
|
||||
digitalWrite(chipSelectPin_, HIGH); // For some CPUs pinMode can write the wrong data so init desired data value first
|
||||
pinMode(chipSelectPin_, OUTPUT); // Solution for #8746 by @benlye
|
||||
spiBegin();
|
||||
|
||||
// set SCK rate for initialization commands
|
||||
// Set SCK rate for initialization commands
|
||||
spiRate_ = SPI_SD_INIT_RATE;
|
||||
spiInit(spiRate_);
|
||||
|
||||
// must supply min of 74 clock cycles with CS high.
|
||||
// Must supply min of 74 clock cycles with CS high.
|
||||
for (uint8_t i = 0; i < 10; i++) spiSend(0xFF);
|
||||
|
||||
// Initialization can cause the watchdog to timeout, so reinit it here
|
||||
@ -265,7 +266,7 @@ bool Sd2Card::init(uint8_t sckRateID, pin_t chipSelectPin) {
|
||||
watchdog_reset();
|
||||
#endif
|
||||
|
||||
// command to go idle in SPI mode
|
||||
// Command to go idle in SPI mode
|
||||
while ((status_ = cardCommand(CMD0, 0)) != R1_IDLE_STATE) {
|
||||
if (((uint16_t)millis() - t0) > SD_INIT_TIMEOUT) {
|
||||
error(SD_CARD_ERROR_CMD0);
|
||||
|
Reference in New Issue
Block a user