XUEPENGBIN 发表于 2013-10-10 18:07:20

STM32F4 的SDIO DMA 和 fsmc 有冲突。。有人碰到过么?(已经找...

本帖最后由 XUEPENGBIN 于 2013-10-10 18:45 编辑

如题: 单独测试 SDIO DMA 是好的。。现在架上FSMC初始化后 SD 的DMA 就在那里等待DMA响应。。又碰到么?

XUEPENGBIN 发表于 2013-10-10 18:28:37


程序执行到这里 就死了。。

这是程序停的位置。。等待DMA数据传输完成。。一直等待了。。

XUEPENGBIN 发表于 2013-10-10 18:49:51

原来是
DRESULT disk_read (
        BYTE drv,                /* Physical drive nmuber (0..) */
        BYTE *buff,                /* Data buffer to store read data */
        DWORD sector,        /* Sector address (LBA) */
        BYTE count                /* Number of sectors to read (1..255) */
)
{
        DRESULT res;
        int Status;

        switch (drv)
             {
        case ATA :
                      
                     return res;

        case MMC :
                 return res;
                case USB :
                     return res;
          case SDCard       :
                  {
                   if ( count == 1 )
                          {
                                Status = SD_ReadBlock(buff,(sector)<<9,SDCardInfo.CardBlockSize );
                                //Status = SD_ReadBlock(buff,(sector+HidDsector)<<9,SDCardInfo.CardBlockSize );
                                Status = SD_WaitReadOperation();
                while(SD_GetStatus() != SD_TRANSFER_OK);
                                if ( Status == 0 ) {return RES_OK;}
                                else {return RES_PARERR;}
                          }
                       else
                           {
                                //Status = SD_ReadMultiBlocks( buff,(sector)<<9,SDCardInfo.CardBlockSize, count );
                                Status = SD_ReadMultiBlocks( buff,(sector+HidDsector)<<9,SDCardInfo.CardBlockSize, count );
                                Status = SD_WaitReadOperation();
                while(SD_GetStatus() != SD_TRANSFER_OK);
                                if ( Status == 0 ) {return RES_OK;}
                                else {return RES_PARERR;}
                          }
                   }
        }
        return RES_PARERR;
}

HidDsector 引起的。。
执行上斌函数时候 找隐藏扇区。。

fmt = check_fs(fs, bsect = 0);
HidDsector = LD_WORD(fs->win+HidAddress);
fmt = check_fs(fs, bsect = 0);

XQL666 发表于 2023-8-1 22:02:26

XUEPENGBIN 发表于 2013-10-10 18:49
原来是
DRESULT disk_read (
        BYTE drv,                /* Physical drive nmuber (0..) */
(引用自3楼)

啥意思,大佬能不能讲明白一点
页: [1]
查看完整版本: STM32F4 的SDIO DMA 和 fsmc 有冲突。。有人碰到过么?(已经找...