/**
* @brief Reads block(s) from a specified address in a card. The Data transfer
* is managed by DMA mode.
* @note This API should be followed by a check on the card state through
* HAL_SD_GetCardState().
* @note You could also check the DMA transfer process through the SD Rx
* interrupt event.
* @param hsd: Pointer SD handle
* @param pData: Pointer to the buffer that will contain the received data
* @param BlockAdd: Block Address from where data is to be read
* @param NumberOfBlocks: Number of blocks to read.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_SD_ReadBlocks_DMA(SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks)
这个是在库文件找到的,当用HAL_SD_GetCardState().返回的结果总是4 HAL_SD_CARD_TRANSFER = 0x00000004U, /*!< Card is in transfer state */
你好,这个最新的固件库 v1.6版本里面已经木有你所说的那两个函数了,
在 v1.6 版本之前是有的,但是在 v1.6 版本里面已经找不到了
* @brief Reads block(s) from a specified address in a card. The Data transfer
* is managed by DMA mode.
* @note This API should be followed by a check on the card state through
* HAL_SD_GetCardState().
* @note You could also check the DMA transfer process through the SD Rx
* interrupt event.
* @param hsd: Pointer SD handle
* @param pData: Pointer to the buffer that will contain the received data
* @param BlockAdd: Block Address from where data is to be read
* @param NumberOfBlocks: Number of blocks to read.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_SD_ReadBlocks_DMA(SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks)
这个是在库文件找到的,当用HAL_SD_GetCardState().返回的结果总是4 HAL_SD_CARD_TRANSFER = 0x00000004U, /*!< Card is in transfer state */
我目前使用的查询貌似,dma 模式还没有去研究,除非把他替换为 v1.6 之前的版本就可以使用 dma 模式了,
刚才试了下查询的方法,速度能够达到1M每秒,但是拷贝进去以后会出现乱码的现象,再次拷贝出来说是文件损坏。
/* Write block(s) in DMA transfer mode */
if(HAL_SD_WriteBlocks(&hsd,buf, blk_addr , blk_len,0xffff) == HAL_OK){
ret = USBD_OK;
}
你参考 H7 历程的 sd 卡 dma 代码就可以解决
H7中的哪个例程?搞了好久还是没能解决,请帮忙指点指点
看看这个里面的,我已经上传了,
https://www.stmcu.org.cn/module/ ... p;page=2#pid2285905
在11楼