CH32V307 例程SDIO出現(xiàn)問題

在例程中

/*********************************************************************
?*?@fn???????SDEnWideBus
?*
?*?@brief???Enable?bus?width
?*
?*?@param???enx?-?0-disable?1-enable
?*??????????????
?*?@return??SD_Error?-??ERR?code
?*/
SD_Error?SDEnWideBus(?u8?enx?)
{
????SD_Error?errorstatus?=?SD_OK;
????u32?scr[2]?=?{0,?0};
????u8?arg?=?0X00;
????if(?enx?)
????{
????????arg?=?0X02;
????}
????else
????{
????????arg?=?0X00;
????}
????if(?SDIO->RESP1?&?SD_CARD_LOCKED?)
????{
????????return?SD_LOCK_UNLOCK_FAILED;
????}
????errorstatus?=?FindSCR(?RCA,?scr?);
????if(?errorstatus?!=?SD_OK?)
????{
????????return?errorstatus;
????}
????if(?(?scr[1]&SD_WIDE_BUS_SUPPORT?)?!=?SD_ALLZERO?)
????{
????????SDIO_CmdInitStructure.SDIO_Argument?=?(?uint32_t?)?RCA?<<?16;
????????SDIO_CmdInitStructure.SDIO_CmdIndex?=?SD_CMD_APP_CMD;
????????SDIO_CmdInitStructure.SDIO_Response?=?SDIO_Response_Short;
????????SDIO_CmdInitStructure.SDIO_Wait?=?SDIO_Wait_No;
????????SDIO_CmdInitStructure.SDIO_CPSM?=?SDIO_CPSM_Enable;
????????SDIO_SendCommand(?&SDIO_CmdInitStructure?);

????????errorstatus?=?CmdResp1Error(?SD_CMD_APP_CMD?);

????????if(?errorstatus?!=?SD_OK?)
????????{
????????????return?errorstatus;
????????}

????????SDIO_CmdInitStructure.SDIO_Argument?=?arg;
????????SDIO_CmdInitStructure.SDIO_CmdIndex?=?SD_CMD_APP_SD_SET_BUSWIDTH;
????????SDIO_CmdInitStructure.SDIO_Response?=?SDIO_Response_Short;
????????SDIO_CmdInitStructure.SDIO_Wait?=?SDIO_Wait_No;
????????SDIO_CmdInitStructure.SDIO_CPSM?=?SDIO_CPSM_Enable;
????????SDIO_SendCommand(?&SDIO_CmdInitStructure?);

????????errorstatus?=?CmdResp1Error(?SD_CMD_APP_SD_SET_BUSWIDTH?);
????????return?errorstatus;
????}
????else
????{
????????return?SD_REQUEST_NOT_APPLICABLE;
????}
}

在進行SD_EnableWideBusOperation 切換的時候 會卡死在函數(shù) SD_Error FindSCR中,一直在等待

/*?sdio.c?1932行?*/
????while(?!(?SDIO->STA?&?(?SDIO_FLAG_RXOVERR?|?SDIO_FLAG_DCRCFAIL?|?SDIO_FLAG_DTIMEOUT?|?SDIO_FLAG_DBCKEND?|?SDIO_FLAG_STBITERR?)?)?)
????{
????????if(?SDIO_GetFlagStatus(?SDIO_FLAG_RXDAVL?)?!=?RESET?)
????????{
????????????*(?tempscr?+?index?)?=?SDIO_ReadData();
????????????index++;
????????????if(?index?>=?2?)
????????????{
????????????????break;
????????????}
????????}
????}

在函數(shù)中一直獲取對應(yīng)的標志位, 卡死在該函數(shù)中.


?若不進行數(shù)據(jù)寬度切換, 似乎后面無法掛載SD卡??

已解決, 使用開發(fā)板的時候需要注意引腳是否外連了其他設(shè)備


只有登錄才能回復(fù),可以選擇微信賬號登錄

国产91精品新入口,国产成人综合网在线播放,九热这里只有精品,本道在线观看,美女视频a美女视频,韩国美女激情视频,日本美女pvp视频