CH579開發(fā)RNDIS,USB卡死問題

C0010000.png



CH579開發(fā)RNDIS,功能都o(jì)k,測(cè)試ARP,Ping,udp,TCP一切正常

現(xiàn)在碰到一個(gè)棘手問題,網(wǎng)絡(luò)發(fā)小數(shù)據(jù)量一切正常,如果持續(xù)發(fā)大數(shù)據(jù)量,跑3~10分鐘左右,USB會(huì)出現(xiàn)卡死,接著就進(jìn)入SUSPEND中斷,重新復(fù)位,如此往復(fù)幾次

最后就停在SETUP OUT0類請(qǐng)求0x21上,C0010000

錯(cuò)誤定位在OUT端點(diǎn)上,其他上傳端點(diǎn)沒有問題

會(huì)不會(huì)是翻轉(zhuǎn),回復(fù)ACK 這些沒有處理好

USB卡死時(shí),CH579其他功能正常,并沒有異常產(chǎn)生,就卡死在USB上


另有個(gè)疑問,Bluk傳輸是不是每次接收到數(shù)據(jù),不管是不是64byte,都要上傳0包,還是接收完整個(gè)貞數(shù)據(jù)再上傳,比如一個(gè)包有650byte,接收完650byte再回復(fù)0?


以下是OUT端點(diǎn)代碼:

修改原因:亂碼,看樓下代碼


暈死,編碼都亂了


//----------------------------------------------------------

case?UIS_TOKEN_OUT://控制端點(diǎn)0?????????????????
????len?=?R8_USB_RX_LEN;??????????
????if(SetupReqCode==0x00)?//0x21?00?00?00?00?00?xx?xx?/卡死位置
????{??????????????????
????????if?(?(R8_USB_INT_ST?&?RB_UIS_TOG_OK)?)?//?不同步的數(shù)據(jù)包將丟棄
????????{
????????????memcpy((uint8_t*)?&rndis_buffer[0],?pEP0_DataBuf,?len);??
????????????make_rndis();?????????????????????????????????

????????????R8_UEP0_T_LEN?=?0;
????????????R8_UEP0_CTRL?|=?UEP_R_RES_ACK?|?UEP_T_RES_ACK;?//?準(zhǔn)備上傳0包

????????}

????}??????
????else//其他請(qǐng)求
????{
????????R8_UEP0_T_LEN?=?0;
????????R8_UEP0_CTRL?|=?UEP_R_RES_ACK?|?UEP_T_RES_NAK;?//狀態(tài)階段,對(duì)IN響應(yīng)NAK
????}??

????R8_UEP0_CTRL?^=?RB_UEP_R_TOG;//同步標(biāo)志位翻轉(zhuǎn)
break;

//-------------------------------------------------------------------

case?UIS_TOKEN_OUT?|?3:?//端點(diǎn)3?Out?/?RNDIS?64byte?PC->USB????????

????LAN_DATA_LED_INV();?//數(shù)據(jù)LED閃
????R8_UEP3_CTRL?^=?RB_UEP_R_TOG;???//一定要翻轉(zhuǎn),臥槽,不能自動(dòng)
????if?(?(R8_USB_INT_ST?&?RB_UIS_TOG_OK)?)?//?不同步的數(shù)據(jù)包將丟棄
????{??????????????????????????????????????????????
????????GPIOB_InverseBits(GPIO_Pin_0);??//測(cè)試LED翻轉(zhuǎn)????????????????????????
????????len?=?R8_USB_RX_LEN;????????????????????????????????????????????????????????????
????????if?(?(rndis_received?+?len)?<?RNDIS_ETH_LEN)
????????{??????
????????????memcpy(&usb_tmp_buf[rndis_received],?pEP3_OUT_DataBuf,?len);
????????????rndis_received?+=?len;

????????????if(len?<?64?)???//整包接收完全
????????????{
????????????????rndis_received?=?0;
????????????????eth_process();
????????????}
????????}
????????else
????????{
????????????rndis_received?=?0;
????????}
????}

????R8_UEP3_T_LEN?=?0;
????R8_UEP3_CTRL?|=?UEP_R_RES_ACK?|?UEP_T_RES_ACK;?//?準(zhǔn)備上傳0包
break;


case?UIS_TOKEN_IN?|?3:??//端點(diǎn)3??????????
????R8_UEP3_CTRL?^=?RB_UEP_T_TOG;
????R8_UEP3_T_LEN?=?0;??
????R8_UEP3_CTRL?=?(R8_UEP2_CTRL?&?~MASK_UEP_T_RES)?|?UEP_T_RES_NAK;????//默認(rèn)應(yīng)答NAK
break;



還有一個(gè)問題,復(fù)位后,OUT3有時(shí)會(huì)出現(xiàn)


LAN_DATA_LED_INV();?//會(huì)閃
if?(?(R8_USB_INT_ST?&?RB_UIS_TOG_OK)?)?//?不同步的數(shù)據(jù)包將丟棄
{
????GPIOB_InverseBits(GPIO_Pin_0);??//不會(huì)閃?
????...
}


同步前的LED燈會(huì)閃,同步后的燈不閃,說明接收到的數(shù)據(jù)都是不同步的。

其他端點(diǎn)數(shù)據(jù)正常,就OUT3 bluk有問題,所以懷疑是OUT3造成的SETUP 0x21卡死


您好,修改建議放到http://www.findthetime.net/bbs/thread-113145-1.html這個(gè)帖子里一并回復(fù)。


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

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