Browse Source

Fix "SD init fail" problem for STM32F1 (#11579)

Fix "SD init fail" problem for STM32F1 caused by incorrect SS pin state and incorrect SPI mode. Issue #11225
jmz52 6 years ago
parent
commit
0b2d686160
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      Marlin/src/HAL/HAL_STM32F1/HAL_spi_Stm32f1.cpp

+ 2
- 2
Marlin/src/HAL/HAL_STM32F1/HAL_spi_Stm32f1.cpp View File

81
   #if !PIN_EXISTS(SS)
81
   #if !PIN_EXISTS(SS)
82
     #error "SS_PIN not defined!"
82
     #error "SS_PIN not defined!"
83
   #endif
83
   #endif
84
-  WRITE(SS_PIN, HIGH);
85
   SET_OUTPUT(SS_PIN);
84
   SET_OUTPUT(SS_PIN);
85
+  WRITE(SS_PIN, HIGH);
86
 }
86
 }
87
 
87
 
88
 /**
88
 /**
104
     case SPI_SPEED_6:       clock = SPI_CLOCK_DIV64; break;
104
     case SPI_SPEED_6:       clock = SPI_CLOCK_DIV64; break;
105
     default:                clock = SPI_CLOCK_DIV2; // Default from the SPI library
105
     default:                clock = SPI_CLOCK_DIV2; // Default from the SPI library
106
   }
106
   }
107
-  spiConfig = SPISettings(clock, MSBFIRST, SPI_MODE0);
107
+  spiConfig = SPISettings(clock, MSBFIRST, SPI_MODE3);
108
   SPI.begin();
108
   SPI.begin();
109
 }
109
 }
110
 
110
 

Loading…
Cancel
Save