}else if(RESET != sdio_flag_get(SDIO_FLAG_STBITE)){ status = SD_START_BIT_ERROR; sdio_flag_clear(SDIO_FLAG_STBITE); return status; } while(RESET != sdio_flag_get(SDIO_FLAG_RXDTVAL)){ *ptempbuff = sdio_data_read(); ++ptempbuff; } /* clear the SDIO_INTC flags */ sdio_flag...
SDIO->ICR|=1<<9; //清错误标志 return SD_START_BIT_ERR; } while(SDIO->STA&(1<<21)) //FIFO里面,还存在可用数据 { *tempbuff=SDIO->FIFO; //循环读取数据 tempbuff++; } // INTX_ENABLE();//开启总中断 SDIO->ICR=0X5FF; //清除所有标记 }else if(DeviceMode==SD_DMA_MODE) ...
27 TransferError = SD_START_BIT_ERR;28 }29 30 SDIO_ITConfig(SDIO_IT_DCRCFAIL | SDIO_IT_DTIMEOUT | SDIO_IT_DATAEND |31 SDIO_IT_TXFIFOHE | SDIO_IT_RXFIFOHF | SDIO_IT_TXUNDERR |32 SDIO_IT_RXOVERR | SDIO_IT_STBITERR, DISABLE);...
(1<<9));//关闭相关中断 TransferError = SD_START_BIT_ERR; return(SD_START_BIT_ERR); } return(SD_OK); } /* 函数功能: 检查CMD0的执行状态返回值: sd卡错误码 */ SDIO_SD_ERROR_INFO SDIO_CmdErrorCheck(void) { SDIO_SD_ERROR_INFO errorstatus = SD_OK; u32 timeout=SDIO_CMD0TIMEOUT...
errorstatus = SD_START_BIT_ERR;return(errorstatus); }#elifdefined (SD_DMA_MODE)//dma模式SDIO_ITConfig(SDIO_IT_DATAEND, ENABLE);//数据传输结束中断SD_DMA_TxConfig((uint32_t*)writebuff, BlockSize);//配置dma,跟rx类似SDIO_DMACmd(ENABLE);// 使能sdio的dma请求#endifreturn(errorstatus); ...
=SD_DATA_CRC_FAIL;return(errorstatus);}elseif(SDIO_GetFlagStatus(SDIO_FLAG_RXOVERR)!=RESET){SDIO_ClearFlag(SDIO_FLAG_RXOVERR);errorstatus=SD_RX_OVERRUN;return(errorstatus);}elseif(SDIO_GetFlagStatus(SDIO_FLAG_STBITERR)!=RESET){SDIO_ClearFlag(SDIO_FLAG_STBITERR);errorstatus=SD_START_BIT...
8.2命令格式命令长度48位,1.92us25MHZ01bit 5.bit 0bit 31.bit 0bit 6.bit 01起始位host命令参数CRC7end bit7-bit CRC 计算:G(x) = x7 + x3 + 1M(x) = (start bit) x39 + (host bit) x38 +.+ (last bit before CRC) x0CRC6.O=余数(M(x) x7)/G(x)8.3命令分类SD卡命令集分为几个...
SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB; //数据传输的第一个字节为MSB SPI_InitStructure.SPI_CRCPolynomial = 7; //CRC的多项式 SPI_Init(SPI1, &SPI_InitStructure); /* 使能SPI1 */ SPI_Cmd(SPI1, ENABLE); }/*** * Function Name : SPI_FLASH_SendByte * Description : 发送一个数...
=0)if (retry+50)return 1;/Send the start byteWrite_Byte_SD(0xfe);/Read off all the bytes in the block for 13、(a=0;a24);CMD2=(addr&0x00FF0000)16);CMD3=(addr&0x0000FF00)8);CMD4=(addr&0x000000FF);/Send the read command while(Write_Command_SD(CMD)!=0)WDR();/feed the...
The main reason to use SDIO is for the much greater speed that the 4-bit wide interface gets you. However, you pay for that in pins. SPI can get by with four GPIOs for the first card and one more for each additional card. SDIO needs at least six GPIOs, and the 4 bits of the...