• R/O
  • SSH
  • HTTPS

chibios: 提交


Commit MetaInfo

修订版15847 (tree)
时间2022-11-23 01:26:48
作者gdisirio

Log Message

Fixed SPI settings, to be tested.

更改概述

差异

--- trunk/demos/STM32/RT-VFS-FATFS/cfg/stm32g474re_nucleo64/portab.c (revision 15846)
+++ trunk/demos/STM32/RT-VFS-FATFS/cfg/stm32g474re_nucleo64/portab.c (revision 15847)
@@ -50,16 +50,19 @@
5050 /* Module exported functions. */
5151 /*===========================================================================*/
5252
53-void spi_error_cb(SPIDriver *spip);
53+/* Making sure mcuconf.h setup is as expected.*/
54+#if STM32_PCLK1 != 85000000
55+#error "unexpected PCLK1 frequency"
56+#endif
5457
5558 /*
56- * High speed SPI configuration (21.25MHz, CPHA=0, CPOL=0, MSb first).
59+ * High speed SPI configuration (PCLK1/4=21.25MHz, CPHA=0, CPOL=0, MSb first).
5760 */
5861 const SPIConfig hs_spicfg = {
5962 .circular = false,
6063 .slave = false,
6164 .data_cb = NULL,
62- .error_cb = spi_error_cb,
65+ .error_cb = NULL,
6366 .ssport = GPIOB,
6467 .sspad = 12U,
6568 .cr1 = SPI_CR1_BR_0,
@@ -67,16 +70,16 @@
6770 };
6871
6972 /*
70- * Low speed SPI configuration (664,062kHz, CPHA=0, CPOL=0, MSb first).
73+ * Low speed SPI configuration (PCLK1/32=265.6250kHz, CPHA=0, CPOL=0, MSb first).
7174 */
7275 const SPIConfig ls_spicfg = {
7376 .circular = false,
7477 .slave = false,
7578 .data_cb = NULL,
76- .error_cb = spi_error_cb,
79+ .error_cb = NULL,
7780 .ssport = GPIOB,
7881 .sspad = 12U,
79- .cr1 = SPI_CR1_BR_2 | SPI_CR1_BR_1,
82+ .cr1 = SPI_CR1_BR_2,
8083 .cr2 = SPI_CR2_DS_2 | SPI_CR2_DS_1 | SPI_CR2_DS_0
8184 };
8285
--- trunk/demos/STM32/RT-VFS-FATFS/cfg/stm32g474re_nucleo64/portab.h (revision 15846)
+++ trunk/demos/STM32/RT-VFS-FATFS/cfg/stm32g474re_nucleo64/portab.h (revision 15847)
@@ -37,6 +37,7 @@
3737 #define PORTAB_BUTTON_PRESSED PAL_HIGH
3838
3939 #define PORTAB_SD1 LPSD1
40+#define PORTAB_SPI1 SPID2
4041
4142 /*===========================================================================*/
4243 /* Module pre-compile time settings. */
@@ -58,6 +59,9 @@
5859 /* External declarations. */
5960 /*===========================================================================*/
6061
62+extern const SPIConfig hs_spicfg;
63+extern const SPIConfig ls_spicfg;
64+
6165 #ifdef __cplusplus
6266 extern "C" {
6367 #endif
--- trunk/demos/STM32/RT-VFS-FATFS/main.c (revision 15846)
+++ trunk/demos/STM32/RT-VFS-FATFS/main.c (revision 15847)
@@ -153,6 +153,9 @@
153153
154154 #if !HAL_USE_SDC
155155 mmc_spi_driver_t MMCD1;
156+
157+/* MMC/SD over SPI driver configuration.*/
158+static MMCConfig mmccfg = {&SPID2, &ls_spicfg, &hs_spicfg};
156159 #endif
157160
158161 /*
@@ -278,7 +281,8 @@
278281 /* Activates the card insertion monitor.*/
279282 tmr_init(&PORTAB_SDCD1);
280283 #else
281- /* TODO MMC_SPI */
284+ mmcObjectInit(&MMCD1);
285+ mmcStart(&MMCD1, &mmccfg);
282286
283287 /* Activates the card insertion monitor.*/
284288 tmr_init(&MMCD1);
Show on old repository browser