小学生
最后登录1970-1-1
在线时间 小时
注册时间2024-7-17
|
使用野火H743的例程移植到H750的芯片。(1)在例程中单块读写正常。多块写入正常,但是多块读取失败。(2)将多块写入注释掉,可以成功多块读取。(3)在回调函数里面增加关闭DMA也第一第二点一样。代码如下 if(Status == HAL_OK)
{
/* 起始地址为0,写入NUMBER_OF_BLOCKS*512个字节的内容 */
TIM6->CNT = 0;
Status = HAL_SD_WriteBlocks_DMA(&uSdHandle, (uint8_t *)Buffer_Block_Tx, 0,NUMBER_OF_BLOCKS);
CPU_TS_Tmr_Delay_US(1000);
while(TX_Flag == 0);
w_time = TIM6->CNT;
printf("write 32kB time:%d\r\n",w_time);
printf("写入速度:%d kB/s\r\n",NUMBER_OF_BLOCKS/2*10000/w_time);
}
/* Fill the buffer to reception */
Fill_Buffer(Buffer_Block_Rx, MULTI_BUFFER_SIZE/4, 0);
// SCB_CleanDCache_by_Addr((uint32_t*)Buffer_Block_Rx, MULTI_BUFFER_SIZE/4);
if(Status == HAL_OK)
{
/* 起始地址为0,读取NUMBER_OF_BLOCKS*512个字节的内容 */
printf("start read!\r\n");
TIM6->CNT = 0;
Status = HAL_SD_ReadBlocks_DMA(&uSdHandle, Buffer_Block_Rx,0, NUMBER_OF_BLOCKS);
CPU_TS_Tmr_Delay_US(1000);
printf("waite start read ok!\r\n");
//等待DMA传输完成
while(RX_Flag == 0);
w_time = TIM6->CNT;
printf("read 32kB time:%d\r\n",w_time);
printf("读取速度:%d kB/s\r\n",NUMBER_OF_BLOCKS/2*10000/w_time);
} void HAL_SD_TxCpltCallback(SD_HandleTypeDef *hsd)
{
TX_Flag=1;
hsd->Instance->IDMACTRL = SDMMC_DISABLE_IDMA;
}
|
|