mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-23 12:15:32 +08:00
增加sd卡支持
This commit is contained in:
@@ -311,6 +311,7 @@ CONFIG_BSP_USING_USB_TO_USART=y
|
||||
# CONFIG_BSP_USING_SDRAM is not set
|
||||
# CONFIG_BSP_USING_QSPI_FLASH is not set
|
||||
# CONFIG_BSP_USING_ETH is not set
|
||||
# CONFIG_BSP_USING_SDCARD is not set
|
||||
|
||||
#
|
||||
# On-chip Peripheral Drivers
|
||||
@@ -320,6 +321,7 @@ CONFIG_BSP_USING_UART=y
|
||||
CONFIG_BSP_USING_UART1=y
|
||||
# CONFIG_BSP_UART1_RX_USING_DMA is not set
|
||||
# CONFIG_BSP_USING_QSPI is not set
|
||||
# CONFIG_BSP_USING_SDIO is not set
|
||||
|
||||
#
|
||||
# Board extended module Drivers
|
||||
|
||||
@@ -39,10 +39,10 @@ STM32F746-disco 是 ST 推出的一款基于 ARM Cortex-M7 内核的开发板,
|
||||
| **板载外设** | **支持情况** | **备注** |
|
||||
| :----------------- | :----------: | :------------------------------------- |
|
||||
| USB 转串口 | 支持 | UART1 |
|
||||
| QSPI Flash | 支持 | |
|
||||
| QSPI Flash | 支持 | QSPI1 |
|
||||
| 以太网 | 支持 | RMII |
|
||||
| SDRAM | 支持 | SDRAM1 |
|
||||
| SD卡 | 暂不支持 | |
|
||||
| SD卡 | 支持 | SD 4bits |
|
||||
| 4.3寸电容屏 | 暂不支持 | |
|
||||
| MEMS麦克风 | 暂不支持 | |
|
||||
|
||||
@@ -55,7 +55,7 @@ STM32F746-disco 是 ST 推出的一款基于 ARM Cortex-M7 内核的开发板,
|
||||
| I2C | 暂不支持 | 即将支持 |
|
||||
| FLASH | 暂不支持 | 即将支持 |
|
||||
| WDT | 暂不支持 | 即将支持 |
|
||||
| SDIO | 暂不支持 | 即将支持 |
|
||||
| SDIO | 支持 | 支持 |
|
||||
| USB Device | 暂不支持 | 即将支持 |
|
||||
| USB Host | 暂不支持 | 即将支持 |
|
||||
| SAI | 暂不支持 | 即将支持 |
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -10,73 +10,80 @@ Mcu.IP2=FMC
|
||||
Mcu.IP3=NVIC
|
||||
Mcu.IP4=QUADSPI
|
||||
Mcu.IP5=RCC
|
||||
Mcu.IP6=SYS
|
||||
Mcu.IP7=USART1
|
||||
Mcu.IPNb=8
|
||||
Mcu.IP6=SDMMC1
|
||||
Mcu.IP7=SYS
|
||||
Mcu.IP8=USART1
|
||||
Mcu.IPNb=9
|
||||
Mcu.Name=STM32F746NGHx
|
||||
Mcu.Package=TFBGA216
|
||||
Mcu.Pin0=PE2
|
||||
Mcu.Pin1=PG14
|
||||
Mcu.Pin10=PD1
|
||||
Mcu.Pin11=PF0
|
||||
Mcu.Pin12=PC14/OSC32_IN
|
||||
Mcu.Pin13=PF1
|
||||
Mcu.Pin14=PA9
|
||||
Mcu.Pin15=PC15/OSC32_OUT
|
||||
Mcu.Pin16=PK1
|
||||
Mcu.Pin17=PH0/OSC_IN
|
||||
Mcu.Pin18=PF2
|
||||
Mcu.Pin19=PH1/OSC_OUT
|
||||
Mcu.Pin2=PA14
|
||||
Mcu.Pin20=PF3
|
||||
Mcu.Pin21=PJ8
|
||||
Mcu.Pin22=PG8
|
||||
Mcu.Pin23=PF4
|
||||
Mcu.Pin24=PH5
|
||||
Mcu.Pin25=PH3
|
||||
Mcu.Pin26=PF5
|
||||
Mcu.Pin27=PD15
|
||||
Mcu.Pin28=PD10
|
||||
Mcu.Pin29=PC3
|
||||
Mcu.Pin3=PA13
|
||||
Mcu.Pin30=PD14
|
||||
Mcu.Pin31=PD9
|
||||
Mcu.Pin32=PD8
|
||||
Mcu.Pin33=PC1
|
||||
Mcu.Pin34=PB2
|
||||
Mcu.Pin35=PF12
|
||||
Mcu.Pin36=PF15
|
||||
Mcu.Pin37=PD12
|
||||
Mcu.Pin38=PD13
|
||||
Mcu.Pin39=PA1
|
||||
Mcu.Pin4=PG13
|
||||
Mcu.Pin40=PC4
|
||||
Mcu.Pin41=PF13
|
||||
Mcu.Pin42=PG0
|
||||
Mcu.Pin43=PE8
|
||||
Mcu.Pin44=PD11
|
||||
Mcu.Pin45=PG5
|
||||
Mcu.Pin46=PG4
|
||||
Mcu.Pin47=PA2
|
||||
Mcu.Pin48=PC5
|
||||
Mcu.Pin49=PF14
|
||||
Mcu.Pin5=PB7
|
||||
Mcu.Pin50=PF11
|
||||
Mcu.Pin51=PE9
|
||||
Mcu.Pin52=PE11
|
||||
Mcu.Pin53=PE14
|
||||
Mcu.Pin54=PA7
|
||||
Mcu.Pin55=PE7
|
||||
Mcu.Pin56=PE10
|
||||
Mcu.Pin57=PE12
|
||||
Mcu.Pin58=PE15
|
||||
Mcu.Pin59=PE13
|
||||
Mcu.Pin6=PB6
|
||||
Mcu.Pin60=VP_SYS_VS_Systick
|
||||
Mcu.Pin7=PG15
|
||||
Mcu.Pin8=PG11
|
||||
Mcu.Pin9=PD0
|
||||
Mcu.PinsNb=61
|
||||
Mcu.Pin10=PD0
|
||||
Mcu.Pin11=PC11
|
||||
Mcu.Pin12=PC10
|
||||
Mcu.Pin13=PD1
|
||||
Mcu.Pin14=PF0
|
||||
Mcu.Pin15=PD2
|
||||
Mcu.Pin16=PC14/OSC32_IN
|
||||
Mcu.Pin17=PF1
|
||||
Mcu.Pin18=PA9
|
||||
Mcu.Pin19=PC15/OSC32_OUT
|
||||
Mcu.Pin2=PC12
|
||||
Mcu.Pin20=PK1
|
||||
Mcu.Pin21=PC9
|
||||
Mcu.Pin22=PH0/OSC_IN
|
||||
Mcu.Pin23=PF2
|
||||
Mcu.Pin24=PC8
|
||||
Mcu.Pin25=PH1/OSC_OUT
|
||||
Mcu.Pin26=PF3
|
||||
Mcu.Pin27=PJ8
|
||||
Mcu.Pin28=PG8
|
||||
Mcu.Pin29=PF4
|
||||
Mcu.Pin3=PA14
|
||||
Mcu.Pin30=PH5
|
||||
Mcu.Pin31=PH3
|
||||
Mcu.Pin32=PF5
|
||||
Mcu.Pin33=PD15
|
||||
Mcu.Pin34=PD10
|
||||
Mcu.Pin35=PC3
|
||||
Mcu.Pin36=PD14
|
||||
Mcu.Pin37=PD9
|
||||
Mcu.Pin38=PD8
|
||||
Mcu.Pin39=PC1
|
||||
Mcu.Pin4=PA13
|
||||
Mcu.Pin40=PB2
|
||||
Mcu.Pin41=PF12
|
||||
Mcu.Pin42=PF15
|
||||
Mcu.Pin43=PD12
|
||||
Mcu.Pin44=PD13
|
||||
Mcu.Pin45=PA1
|
||||
Mcu.Pin46=PC4
|
||||
Mcu.Pin47=PF13
|
||||
Mcu.Pin48=PG0
|
||||
Mcu.Pin49=PE8
|
||||
Mcu.Pin5=PG13
|
||||
Mcu.Pin50=PD11
|
||||
Mcu.Pin51=PG5
|
||||
Mcu.Pin52=PG4
|
||||
Mcu.Pin53=PA2
|
||||
Mcu.Pin54=PC5
|
||||
Mcu.Pin55=PF14
|
||||
Mcu.Pin56=PF11
|
||||
Mcu.Pin57=PE9
|
||||
Mcu.Pin58=PE11
|
||||
Mcu.Pin59=PE14
|
||||
Mcu.Pin6=PB7
|
||||
Mcu.Pin60=PA7
|
||||
Mcu.Pin61=PE7
|
||||
Mcu.Pin62=PE10
|
||||
Mcu.Pin63=PE12
|
||||
Mcu.Pin64=PE15
|
||||
Mcu.Pin65=PE13
|
||||
Mcu.Pin66=VP_SYS_VS_Systick
|
||||
Mcu.Pin7=PB6
|
||||
Mcu.Pin8=PG15
|
||||
Mcu.Pin9=PG11
|
||||
Mcu.PinsNb=67
|
||||
Mcu.ThirdPartyNb=0
|
||||
Mcu.UserConstants=
|
||||
Mcu.UserName=STM32F746NGHx
|
||||
@@ -113,6 +120,12 @@ PB7.Mode=Asynchronous
|
||||
PB7.Signal=USART1_RX
|
||||
PC1.Mode=RMII
|
||||
PC1.Signal=ETH_MDC
|
||||
PC10.Mode=SD_4_bits_Wide_bus
|
||||
PC10.Signal=SDMMC1_D2
|
||||
PC11.Mode=SD_4_bits_Wide_bus
|
||||
PC11.Signal=SDMMC1_D3
|
||||
PC12.Mode=SD_4_bits_Wide_bus
|
||||
PC12.Signal=SDMMC1_CK
|
||||
PC14/OSC32_IN.Mode=LSE-External-Oscillator
|
||||
PC14/OSC32_IN.Signal=RCC_OSC32_IN
|
||||
PC15/OSC32_OUT.Mode=LSE-External-Oscillator
|
||||
@@ -124,6 +137,10 @@ PC4.Mode=RMII
|
||||
PC4.Signal=ETH_RXD0
|
||||
PC5.Mode=RMII
|
||||
PC5.Signal=ETH_RXD1
|
||||
PC8.Mode=SD_4_bits_Wide_bus
|
||||
PC8.Signal=SDMMC1_D0
|
||||
PC9.Mode=SD_4_bits_Wide_bus
|
||||
PC9.Signal=SDMMC1_D1
|
||||
PCC.Checker=false
|
||||
PCC.Line=STM32F7x6
|
||||
PCC.MCU=STM32F746NGHx
|
||||
@@ -146,6 +163,8 @@ PD13.Mode=Single Bank 1
|
||||
PD13.Signal=QUADSPI_BK1_IO3
|
||||
PD14.Signal=FMC_D0_DA0
|
||||
PD15.Signal=FMC_D1_DA1
|
||||
PD2.Mode=SD_4_bits_Wide_bus
|
||||
PD2.Signal=SDMMC1_CMD
|
||||
PD8.Signal=FMC_D13_DA13
|
||||
PD9.Signal=FMC_D14_DA14
|
||||
PE10.Signal=FMC_D7_DA7
|
||||
@@ -221,71 +240,72 @@ ProjectManager.StackSize=0x400
|
||||
ProjectManager.TargetToolchain=MDK-ARM V5
|
||||
ProjectManager.ToolChainLocation=
|
||||
ProjectManager.UnderRoot=false
|
||||
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true,4-MX_USART1_UART_Init-USART1-false-HAL-true,5-MX_QUADSPI_Init-QUADSPI-false-HAL-true,6-MX_ETH_Init-ETH-false-HAL-true,7-MX_FMC_Init-FMC-false-HAL-true
|
||||
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true,4-MX_USART1_UART_Init-USART1-false-HAL-true,5-MX_QUADSPI_Init-QUADSPI-false-HAL-true,6-MX_ETH_Init-ETH-false-HAL-true,7-MX_FMC_Init-FMC-false-HAL-true,8-MX_SDMMC1_SD_Init-SDMMC1-false-HAL-true
|
||||
QUADSPI.ChipSelectHighTime=QSPI_CS_HIGH_TIME_6_CYCLE
|
||||
QUADSPI.ClockPrescaler=1
|
||||
QUADSPI.FifoThreshold=4
|
||||
QUADSPI.IPParameters=ClockPrescaler,FifoThreshold,SampleShifting,ChipSelectHighTime
|
||||
QUADSPI.SampleShifting=QSPI_SAMPLE_SHIFTING_HALFCYCLE
|
||||
RCC.AHBFreq_Value=216000000
|
||||
RCC.AHBFreq_Value=50000000
|
||||
RCC.APB1CLKDivider=RCC_HCLK_DIV4
|
||||
RCC.APB1Freq_Value=54000000
|
||||
RCC.APB1TimFreq_Value=108000000
|
||||
RCC.APB1Freq_Value=12500000
|
||||
RCC.APB1TimFreq_Value=25000000
|
||||
RCC.APB2CLKDivider=RCC_HCLK_DIV2
|
||||
RCC.APB2Freq_Value=108000000
|
||||
RCC.APB2TimFreq_Value=216000000
|
||||
RCC.APB2Freq_Value=25000000
|
||||
RCC.APB2TimFreq_Value=50000000
|
||||
RCC.CECFreq_Value=32786.88524590164
|
||||
RCC.CortexFreq_Value=216000000
|
||||
RCC.EthernetFreq_Value=216000000
|
||||
RCC.FCLKCortexFreq_Value=216000000
|
||||
RCC.CortexFreq_Value=50000000
|
||||
RCC.EthernetFreq_Value=50000000
|
||||
RCC.FCLKCortexFreq_Value=50000000
|
||||
RCC.FamilyName=M
|
||||
RCC.HCLKFreq_Value=216000000
|
||||
RCC.HCLKFreq_Value=50000000
|
||||
RCC.HSE_VALUE=25000000
|
||||
RCC.HSI_VALUE=16000000
|
||||
RCC.I2C1Freq_Value=54000000
|
||||
RCC.I2C2Freq_Value=54000000
|
||||
RCC.I2C3Freq_Value=54000000
|
||||
RCC.I2C4Freq_Value=54000000
|
||||
RCC.I2SFreq_Value=96000000
|
||||
RCC.IPParameters=AHBFreq_Value,APB1CLKDivider,APB1Freq_Value,APB1TimFreq_Value,APB2CLKDivider,APB2Freq_Value,APB2TimFreq_Value,CECFreq_Value,CortexFreq_Value,EthernetFreq_Value,FCLKCortexFreq_Value,FamilyName,HCLKFreq_Value,HSE_VALUE,HSI_VALUE,I2C1Freq_Value,I2C2Freq_Value,I2C3Freq_Value,I2C4Freq_Value,I2SFreq_Value,LCDTFToutputFreq_Value,LPTIM1Freq_Value,LSI_VALUE,MCO2PinFreq_Value,PLLCLKFreq_Value,PLLI2SPCLKFreq_Value,PLLI2SQCLKFreq_Value,PLLI2SRCLKFreq_Value,PLLI2SRoutputFreq_Value,PLLM,PLLN,PLLQCLKFreq_Value,PLLQoutputFreq_Value,PLLSAIPCLKFreq_Value,PLLSAIQCLKFreq_Value,PLLSAIRCLKFreq_Value,PLLSAIoutputFreq_Value,PLLSourceVirtual,RNGFreq_Value,SAI1Freq_Value,SAI2Freq_Value,SDMMCFreq_Value,SPDIFRXFreq_Value,SYSCLKFreq_VALUE,SYSCLKSource,UART4Freq_Value,UART5Freq_Value,UART7Freq_Value,UART8Freq_Value,USART1Freq_Value,USART2Freq_Value,USART3Freq_Value,USART6Freq_Value,USBFreq_Value,VCOI2SOutputFreq_Value,VCOInputFreq_Value,VCOOutputFreq_Value,VCOSAIOutputFreq_Value
|
||||
RCC.LCDTFToutputFreq_Value=48000000
|
||||
RCC.LPTIM1Freq_Value=54000000
|
||||
RCC.I2C1Freq_Value=12500000
|
||||
RCC.I2C2Freq_Value=12500000
|
||||
RCC.I2C3Freq_Value=12500000
|
||||
RCC.I2C4Freq_Value=12500000
|
||||
RCC.I2SFreq_Value=200000000
|
||||
RCC.IPParameters=AHBFreq_Value,APB1CLKDivider,APB1Freq_Value,APB1TimFreq_Value,APB2CLKDivider,APB2Freq_Value,APB2TimFreq_Value,CECFreq_Value,CortexFreq_Value,EthernetFreq_Value,FCLKCortexFreq_Value,FamilyName,HCLKFreq_Value,HSE_VALUE,HSI_VALUE,I2C1Freq_Value,I2C2Freq_Value,I2C3Freq_Value,I2C4Freq_Value,I2SFreq_Value,LCDTFToutputFreq_Value,LPTIM1Freq_Value,LSI_VALUE,MCO2PinFreq_Value,PLLCLKFreq_Value,PLLI2SPCLKFreq_Value,PLLI2SQCLKFreq_Value,PLLI2SRCLKFreq_Value,PLLI2SRoutputFreq_Value,PLLM,PLLN,PLLP,PLLQCLKFreq_Value,PLLQoutputFreq_Value,PLLSAIPCLKFreq_Value,PLLSAIQCLKFreq_Value,PLLSAIRCLKFreq_Value,PLLSAIoutputFreq_Value,PLLSourceVirtual,RNGFreq_Value,SAI1Freq_Value,SAI2Freq_Value,SDMMCFreq_Value,SPDIFRXFreq_Value,SYSCLKFreq_VALUE,SYSCLKSource,UART4Freq_Value,UART5Freq_Value,UART7Freq_Value,UART8Freq_Value,USART1Freq_Value,USART2Freq_Value,USART3Freq_Value,USART6Freq_Value,USBFreq_Value,VCOI2SOutputFreq_Value,VCOInputFreq_Value,VCOOutputFreq_Value,VCOSAIOutputFreq_Value
|
||||
RCC.LCDTFToutputFreq_Value=100000000
|
||||
RCC.LPTIM1Freq_Value=12500000
|
||||
RCC.LSI_VALUE=32000
|
||||
RCC.MCO2PinFreq_Value=216000000
|
||||
RCC.PLLCLKFreq_Value=216000000
|
||||
RCC.PLLI2SPCLKFreq_Value=96000000
|
||||
RCC.PLLI2SQCLKFreq_Value=96000000
|
||||
RCC.PLLI2SRCLKFreq_Value=96000000
|
||||
RCC.PLLI2SRoutputFreq_Value=96000000
|
||||
RCC.PLLM=25
|
||||
RCC.PLLN=432
|
||||
RCC.PLLQCLKFreq_Value=216000000
|
||||
RCC.PLLQoutputFreq_Value=216000000
|
||||
RCC.PLLSAIPCLKFreq_Value=96000000
|
||||
RCC.PLLSAIQCLKFreq_Value=96000000
|
||||
RCC.PLLSAIRCLKFreq_Value=96000000
|
||||
RCC.PLLSAIoutputFreq_Value=96000000
|
||||
RCC.MCO2PinFreq_Value=50000000
|
||||
RCC.PLLCLKFreq_Value=50000000
|
||||
RCC.PLLI2SPCLKFreq_Value=200000000
|
||||
RCC.PLLI2SQCLKFreq_Value=200000000
|
||||
RCC.PLLI2SRCLKFreq_Value=200000000
|
||||
RCC.PLLI2SRoutputFreq_Value=200000000
|
||||
RCC.PLLM=12
|
||||
RCC.PLLN=96
|
||||
RCC.PLLP=RCC_PLLP_DIV4
|
||||
RCC.PLLQCLKFreq_Value=100000000
|
||||
RCC.PLLQoutputFreq_Value=100000000
|
||||
RCC.PLLSAIPCLKFreq_Value=200000000
|
||||
RCC.PLLSAIQCLKFreq_Value=200000000
|
||||
RCC.PLLSAIRCLKFreq_Value=200000000
|
||||
RCC.PLLSAIoutputFreq_Value=200000000
|
||||
RCC.PLLSourceVirtual=RCC_PLLSOURCE_HSE
|
||||
RCC.RNGFreq_Value=216000000
|
||||
RCC.SAI1Freq_Value=96000000
|
||||
RCC.SAI2Freq_Value=96000000
|
||||
RCC.SDMMCFreq_Value=216000000
|
||||
RCC.SPDIFRXFreq_Value=96000000
|
||||
RCC.SYSCLKFreq_VALUE=216000000
|
||||
RCC.RNGFreq_Value=100000000
|
||||
RCC.SAI1Freq_Value=200000000
|
||||
RCC.SAI2Freq_Value=200000000
|
||||
RCC.SDMMCFreq_Value=50000000
|
||||
RCC.SPDIFRXFreq_Value=200000000
|
||||
RCC.SYSCLKFreq_VALUE=50000000
|
||||
RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK
|
||||
RCC.UART4Freq_Value=54000000
|
||||
RCC.UART5Freq_Value=54000000
|
||||
RCC.UART7Freq_Value=54000000
|
||||
RCC.UART8Freq_Value=54000000
|
||||
RCC.USART1Freq_Value=108000000
|
||||
RCC.USART2Freq_Value=54000000
|
||||
RCC.USART3Freq_Value=54000000
|
||||
RCC.USART6Freq_Value=108000000
|
||||
RCC.USBFreq_Value=216000000
|
||||
RCC.VCOI2SOutputFreq_Value=192000000
|
||||
RCC.VCOInputFreq_Value=1000000
|
||||
RCC.VCOOutputFreq_Value=432000000
|
||||
RCC.VCOSAIOutputFreq_Value=192000000
|
||||
RCC.UART4Freq_Value=12500000
|
||||
RCC.UART5Freq_Value=12500000
|
||||
RCC.UART7Freq_Value=12500000
|
||||
RCC.UART8Freq_Value=12500000
|
||||
RCC.USART1Freq_Value=25000000
|
||||
RCC.USART2Freq_Value=12500000
|
||||
RCC.USART3Freq_Value=12500000
|
||||
RCC.USART6Freq_Value=25000000
|
||||
RCC.USBFreq_Value=100000000
|
||||
RCC.VCOI2SOutputFreq_Value=400000000
|
||||
RCC.VCOInputFreq_Value=2083333.3333333333
|
||||
RCC.VCOOutputFreq_Value=200000000
|
||||
RCC.VCOSAIOutputFreq_Value=400000000
|
||||
SH.FMC_A0.0=FMC_A0,11b-sda1
|
||||
SH.FMC_A0.ConfNb=1
|
||||
SH.FMC_A1.0=FMC_A1,11b-sda1
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
/* #define HAL_RNG_MODULE_ENABLED */
|
||||
/* #define HAL_RTC_MODULE_ENABLED */
|
||||
/* #define HAL_SAI_MODULE_ENABLED */
|
||||
/* #define HAL_SD_MODULE_ENABLED */
|
||||
#define HAL_SD_MODULE_ENABLED
|
||||
/* #define HAL_MMC_MODULE_ENABLED */
|
||||
/* #define HAL_SPDIFRX_MODULE_ENABLED */
|
||||
/* #define HAL_SPI_MODULE_ENABLED */
|
||||
|
||||
@@ -67,6 +67,8 @@ ETH_HandleTypeDef heth;
|
||||
|
||||
QSPI_HandleTypeDef hqspi;
|
||||
|
||||
SD_HandleTypeDef hsd1;
|
||||
|
||||
UART_HandleTypeDef huart1;
|
||||
|
||||
SDRAM_HandleTypeDef hsdram1;
|
||||
@@ -82,6 +84,7 @@ static void MX_USART1_UART_Init(void);
|
||||
static void MX_QUADSPI_Init(void);
|
||||
static void MX_ETH_Init(void);
|
||||
static void MX_FMC_Init(void);
|
||||
static void MX_SDMMC1_SD_Init(void);
|
||||
/* USER CODE BEGIN PFP */
|
||||
|
||||
/* USER CODE END PFP */
|
||||
@@ -123,6 +126,7 @@ int main(void)
|
||||
MX_QUADSPI_Init();
|
||||
MX_ETH_Init();
|
||||
MX_FMC_Init();
|
||||
MX_SDMMC1_SD_Init();
|
||||
/* USER CODE BEGIN 2 */
|
||||
|
||||
/* USER CODE END 2 */
|
||||
@@ -154,27 +158,21 @@ void SystemClock_Config(void)
|
||||
/**Configure the main internal regulator output voltage
|
||||
*/
|
||||
__HAL_RCC_PWR_CLK_ENABLE();
|
||||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
|
||||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE3);
|
||||
/**Initializes the CPU, AHB and APB busses clocks
|
||||
*/
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
|
||||
RCC_OscInitStruct.PLL.PLLM = 25;
|
||||
RCC_OscInitStruct.PLL.PLLN = 432;
|
||||
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
|
||||
RCC_OscInitStruct.PLL.PLLM = 12;
|
||||
RCC_OscInitStruct.PLL.PLLN = 96;
|
||||
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4;
|
||||
RCC_OscInitStruct.PLL.PLLQ = 2;
|
||||
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
/**Activate the Over-Drive mode
|
||||
*/
|
||||
if (HAL_PWREx_EnableOverDrive() != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
/**Initializes the CPU, AHB and APB busses clocks
|
||||
*/
|
||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|
||||
@@ -184,12 +182,13 @@ void SystemClock_Config(void)
|
||||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
|
||||
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
|
||||
|
||||
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_7) != HAL_OK)
|
||||
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_USART1;
|
||||
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_USART1|RCC_PERIPHCLK_SDMMC1;
|
||||
PeriphClkInitStruct.Usart1ClockSelection = RCC_USART1CLKSOURCE_PCLK2;
|
||||
PeriphClkInitStruct.Sdmmc1ClockSelection = RCC_SDMMC1CLKSOURCE_SYSCLK;
|
||||
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
@@ -276,6 +275,42 @@ static void MX_QUADSPI_Init(void)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SDMMC1 Initialization Function
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_SDMMC1_SD_Init(void)
|
||||
{
|
||||
|
||||
/* USER CODE BEGIN SDMMC1_Init 0 */
|
||||
|
||||
/* USER CODE END SDMMC1_Init 0 */
|
||||
|
||||
/* USER CODE BEGIN SDMMC1_Init 1 */
|
||||
|
||||
/* USER CODE END SDMMC1_Init 1 */
|
||||
hsd1.Instance = SDMMC1;
|
||||
hsd1.Init.ClockEdge = SDMMC_CLOCK_EDGE_RISING;
|
||||
hsd1.Init.ClockBypass = SDMMC_CLOCK_BYPASS_DISABLE;
|
||||
hsd1.Init.ClockPowerSave = SDMMC_CLOCK_POWER_SAVE_DISABLE;
|
||||
hsd1.Init.BusWide = SDMMC_BUS_WIDE_1B;
|
||||
hsd1.Init.HardwareFlowControl = SDMMC_HARDWARE_FLOW_CONTROL_DISABLE;
|
||||
hsd1.Init.ClockDiv = 0;
|
||||
if (HAL_SD_Init(&hsd1) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
if (HAL_SD_ConfigWideBusOperation(&hsd1, SDMMC_BUS_WIDE_4B) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN SDMMC1_Init 2 */
|
||||
|
||||
/* USER CODE END SDMMC1_Init 2 */
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief USART1 Initialization Function
|
||||
* @param None
|
||||
@@ -358,11 +393,11 @@ static void MX_GPIO_Init(void)
|
||||
/* GPIO Ports Clock Enable */
|
||||
__HAL_RCC_GPIOE_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOG_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOD_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOF_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOK_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOH_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOJ_CLK_ENABLE();
|
||||
|
||||
@@ -302,6 +302,94 @@ void HAL_QSPI_MspDeInit(QSPI_HandleTypeDef* hqspi)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SD MSP Initialization
|
||||
* This function configures the hardware resources used in this example
|
||||
* @param hsd: SD handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_SD_MspInit(SD_HandleTypeDef* hsd)
|
||||
{
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
if(hsd->Instance==SDMMC1)
|
||||
{
|
||||
/* USER CODE BEGIN SDMMC1_MspInit 0 */
|
||||
|
||||
/* USER CODE END SDMMC1_MspInit 0 */
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_SDMMC1_CLK_ENABLE();
|
||||
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOD_CLK_ENABLE();
|
||||
/**SDMMC1 GPIO Configuration
|
||||
PC12 ------> SDMMC1_CK
|
||||
PC11 ------> SDMMC1_D3
|
||||
PC10 ------> SDMMC1_D2
|
||||
PD2 ------> SDMMC1_CMD
|
||||
PC9 ------> SDMMC1_D1
|
||||
PC8 ------> SDMMC1_D0
|
||||
*/
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_12|GPIO_PIN_11|GPIO_PIN_10|GPIO_PIN_9
|
||||
|GPIO_PIN_8;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF12_SDMMC1;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_2;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF12_SDMMC1;
|
||||
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
||||
|
||||
/* USER CODE BEGIN SDMMC1_MspInit 1 */
|
||||
|
||||
/* USER CODE END SDMMC1_MspInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SD MSP De-Initialization
|
||||
* This function freeze the hardware resources used in this example
|
||||
* @param hsd: SD handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
|
||||
void HAL_SD_MspDeInit(SD_HandleTypeDef* hsd)
|
||||
{
|
||||
|
||||
if(hsd->Instance==SDMMC1)
|
||||
{
|
||||
/* USER CODE BEGIN SDMMC1_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END SDMMC1_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_SDMMC1_CLK_DISABLE();
|
||||
|
||||
/**SDMMC1 GPIO Configuration
|
||||
PC12 ------> SDMMC1_CK
|
||||
PC11 ------> SDMMC1_D3
|
||||
PC10 ------> SDMMC1_D2
|
||||
PD2 ------> SDMMC1_CMD
|
||||
PC9 ------> SDMMC1_D1
|
||||
PC8 ------> SDMMC1_D0
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_12|GPIO_PIN_11|GPIO_PIN_10|GPIO_PIN_9
|
||||
|GPIO_PIN_8);
|
||||
|
||||
HAL_GPIO_DeInit(GPIOD, GPIO_PIN_2);
|
||||
|
||||
/* USER CODE BEGIN SDMMC1_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END SDMMC1_MspDeInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief UART MSP Initialization
|
||||
* This function configures the hardware resources used in this example
|
||||
|
||||
@@ -32,6 +32,13 @@ menu "Onboard Peripheral Drivers"
|
||||
select PHY_USING_LAN8720A
|
||||
default n
|
||||
|
||||
config BSP_USING_SDCARD
|
||||
bool "Enable SDCARD (sdio)"
|
||||
select BSP_USING_SDIO
|
||||
select RT_USING_DFS
|
||||
select RT_USING_DFS_ELMFAT
|
||||
default n
|
||||
|
||||
endmenu
|
||||
|
||||
menu "On-chip Peripheral Drivers"
|
||||
@@ -60,6 +67,12 @@ menu "On-chip Peripheral Drivers"
|
||||
select RT_USING_SPI
|
||||
default n
|
||||
|
||||
config BSP_USING_SDIO
|
||||
bool "Enable SDIO"
|
||||
select RT_USING_SDIO
|
||||
select RT_USING_DFS
|
||||
default n
|
||||
|
||||
endmenu
|
||||
|
||||
menu "Board extended module Drivers"
|
||||
|
||||
@@ -13,7 +13,10 @@ if GetDepend(['BSP_USING_ETH']):
|
||||
|
||||
if GetDepend(['BSP_USING_QSPI_FLASH']):
|
||||
src += Glob('ports/drv_qspi_flash.c')
|
||||
|
||||
|
||||
if GetDepend(['BSP_USING_SDCARD']):
|
||||
src += Glob('ports/sdcard_port.c')
|
||||
|
||||
path = [cwd]
|
||||
path += [cwd + '/CubeMX_Config/Inc']
|
||||
path += [cwd + '/ports']
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2019-02-17 jinsheng add sdcard port file
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
#ifdef BSP_USING_SDCARD
|
||||
|
||||
#include <dfs_elm.h>
|
||||
#include <dfs_fs.h>
|
||||
#include <dfs_posix.h>
|
||||
|
||||
#define DBG_ENABLE
|
||||
#define DBG_SECTION_NAME "app.card"
|
||||
#define DBG_COLOR
|
||||
|
||||
#define DBG_LEVEL DBG_INFO
|
||||
#include <rtdbg.h>
|
||||
|
||||
void sd_mount(void *parameter)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
rt_thread_mdelay(500);
|
||||
if(rt_device_find("sd0") != RT_NULL)
|
||||
{
|
||||
if (dfs_mount("sd0", "/", "elm", 0, 0) == RT_EOK)
|
||||
{
|
||||
LOG_I("sd card mount to '/'");
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_W("sd card mount to '/' failed!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int stm32_sdcard_mount(void)
|
||||
{
|
||||
rt_thread_t tid;
|
||||
|
||||
tid = rt_thread_create("sd_mount", sd_mount, RT_NULL,
|
||||
1024, RT_THREAD_PRIORITY_MAX - 2, 20);
|
||||
if (tid != RT_NULL)
|
||||
{
|
||||
rt_thread_startup(tid);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_E("create sd_mount thread err!");
|
||||
}
|
||||
return RT_EOK;
|
||||
}
|
||||
INIT_APP_EXPORT(stm32_sdcard_mount);
|
||||
|
||||
#endif /* BSP_USING_SDCARD */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user