File tree Expand file tree Collapse file tree 3 files changed +6
-2
lines changed 
bsp/stm32f429-apollo/drivers Expand file tree Collapse file tree 3 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ rt_uint8_t SD_Init(void)
2121    SDCARD_Handler .Init .ClockPowerSave = SDIO_CLOCK_POWER_SAVE_DISABLE ;    //空闲时不关闭时钟电源 
2222    SDCARD_Handler .Init .BusWide = SDIO_BUS_WIDE_1B ;                        //1位数据线 
2323    SDCARD_Handler .Init .HardwareFlowControl = SDIO_HARDWARE_FLOW_CONTROL_DISABLE ;//关闭硬件流控 
24-     SDCARD_Handler .Init .ClockDiv = SDIO_TRANSFER_CLK_DIV ;            //SD传输时钟频率最大25MHZ 
24+     SDCARD_Handler .Init .ClockDiv = SDIO_INIT_CLK_DIV ;                  //初始化时钟为400KHZ 
2525
2626    SD_Error = HAL_SD_Init (& SDCARD_Handler ,& SDCardInfo );
2727    if (SD_Error != SD_OK ) return  1 ;
Original file line number Diff line number Diff line change @@ -526,6 +526,7 @@ struct stm32f4_spi stm32f4_spi5 =
526526    /* .spi_handle = */ {
527527        /* .Instance = */  SPI5 ,
528528    },
529+ #ifdef  SPI_USE_DMA 
529530    /* .hdma_rx = */  {   
530531        DMA2_Stream3 ,
531532        DMA_CHANNEL_2 ,
@@ -537,6 +538,7 @@ struct stm32f4_spi stm32f4_spi5 =
537538        DMA_CHANNEL_2 ,
538539    },
539540    /* .hdma_tx_irq = */  DMA2_Stream4_IRQn ,
541+ #endif  /* SPI_USE_DMA */ 
540542};
541543
542544static  struct  rt_spi_bus  spi5_bus ;
@@ -703,6 +705,7 @@ rt_err_t stm32_spi_bus_register(SPI_TypeDef * SPI,
703705        return  RT_ENOSYS ;
704706    }
705707
708+ #ifdef  SPI_USE_DMA 
706709    /* Configure the DMA handler for Transmission process */ 
707710    p_spi_bus -> hdma_tx .Init .Direction            =  DMA_MEMORY_TO_PERIPH ;
708711    p_spi_bus -> hdma_tx .Init .PeriphInc            =  DMA_PINC_DISABLE ;
@@ -727,6 +730,7 @@ rt_err_t stm32_spi_bus_register(SPI_TypeDef * SPI,
727730    p_spi_bus -> hdma_rx .Init .FIFOThreshold        =  DMA_FIFO_THRESHOLD_FULL ;
728731    p_spi_bus -> hdma_rx .Init .MemBurst             =  DMA_MBURST_INC4 ;
729732    p_spi_bus -> hdma_rx .Init .PeriphBurst          =  DMA_PBURST_INC4 ;
733+ #endif  /* SPI_USE_DMA */ 
730734
731735    spi_bus -> parent .user_data  =  & stm32f4_spi5 ;
732736
Original file line number Diff line number Diff line change 2020
2121#include  "stm32f4xx_hal.h" 
2222
23- #define  SPI_USE_DMA 
23+ // #define SPI_USE_DMA
2424
2525struct  stm32f4_spi 
2626{
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments