未验证 提交 37d8cc4f 编写于 作者: B Bernard Xiong 提交者: GitHub

Merge pull request #1495 from armink/fix_apollo429

Fix apollo429
...@@ -21,7 +21,7 @@ rt_uint8_t SD_Init(void) ...@@ -21,7 +21,7 @@ rt_uint8_t SD_Init(void)
SDCARD_Handler.Init.ClockPowerSave=SDIO_CLOCK_POWER_SAVE_DISABLE; //空闲时不关闭时钟电源 SDCARD_Handler.Init.ClockPowerSave=SDIO_CLOCK_POWER_SAVE_DISABLE; //空闲时不关闭时钟电源
SDCARD_Handler.Init.BusWide=SDIO_BUS_WIDE_1B; //1位数据线 SDCARD_Handler.Init.BusWide=SDIO_BUS_WIDE_1B; //1位数据线
SDCARD_Handler.Init.HardwareFlowControl=SDIO_HARDWARE_FLOW_CONTROL_DISABLE;//关闭硬件流控 SDCARD_Handler.Init.HardwareFlowControl=SDIO_HARDWARE_FLOW_CONTROL_DISABLE;//关闭硬件流控
SDCARD_Handler.Init.ClockDiv=SDIO_TRANSFER_CLK_DIV; //SD传输时钟频率最大25MHZ SDCARD_Handler.Init.ClockDiv=SDIO_INIT_CLK_DIV; //初始化时钟为400KHZ
SD_Error=HAL_SD_Init(&SDCARD_Handler,&SDCardInfo); SD_Error=HAL_SD_Init(&SDCARD_Handler,&SDCardInfo);
if(SD_Error!=SD_OK) return 1; if(SD_Error!=SD_OK) return 1;
......
...@@ -526,6 +526,7 @@ struct stm32f4_spi stm32f4_spi5 = ...@@ -526,6 +526,7 @@ struct stm32f4_spi stm32f4_spi5 =
/* .spi_handle = */{ /* .spi_handle = */{
/* .Instance = */ SPI5, /* .Instance = */ SPI5,
}, },
#ifdef SPI_USE_DMA
/* .hdma_rx = */ { /* .hdma_rx = */ {
DMA2_Stream3, DMA2_Stream3,
DMA_CHANNEL_2, DMA_CHANNEL_2,
...@@ -537,6 +538,7 @@ struct stm32f4_spi stm32f4_spi5 = ...@@ -537,6 +538,7 @@ struct stm32f4_spi stm32f4_spi5 =
DMA_CHANNEL_2, DMA_CHANNEL_2,
}, },
/* .hdma_tx_irq = */ DMA2_Stream4_IRQn, /* .hdma_tx_irq = */ DMA2_Stream4_IRQn,
#endif /* SPI_USE_DMA */
}; };
static struct rt_spi_bus spi5_bus; static struct rt_spi_bus spi5_bus;
...@@ -703,6 +705,7 @@ rt_err_t stm32_spi_bus_register(SPI_TypeDef * SPI, ...@@ -703,6 +705,7 @@ rt_err_t stm32_spi_bus_register(SPI_TypeDef * SPI,
return RT_ENOSYS; return RT_ENOSYS;
} }
#ifdef SPI_USE_DMA
/* Configure the DMA handler for Transmission process */ /* Configure the DMA handler for Transmission process */
p_spi_bus->hdma_tx.Init.Direction = DMA_MEMORY_TO_PERIPH; p_spi_bus->hdma_tx.Init.Direction = DMA_MEMORY_TO_PERIPH;
p_spi_bus->hdma_tx.Init.PeriphInc = DMA_PINC_DISABLE; p_spi_bus->hdma_tx.Init.PeriphInc = DMA_PINC_DISABLE;
...@@ -727,6 +730,7 @@ rt_err_t stm32_spi_bus_register(SPI_TypeDef * SPI, ...@@ -727,6 +730,7 @@ rt_err_t stm32_spi_bus_register(SPI_TypeDef * SPI,
p_spi_bus->hdma_rx.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL; p_spi_bus->hdma_rx.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;
p_spi_bus->hdma_rx.Init.MemBurst = DMA_MBURST_INC4; p_spi_bus->hdma_rx.Init.MemBurst = DMA_MBURST_INC4;
p_spi_bus->hdma_rx.Init.PeriphBurst = DMA_PBURST_INC4; p_spi_bus->hdma_rx.Init.PeriphBurst = DMA_PBURST_INC4;
#endif /* SPI_USE_DMA */
spi_bus->parent.user_data = &stm32f4_spi5; spi_bus->parent.user_data = &stm32f4_spi5;
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include "stm32f4xx_hal.h" #include "stm32f4xx_hal.h"
#define SPI_USE_DMA //#define SPI_USE_DMA
struct stm32f4_spi struct stm32f4_spi
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册