CH573F的usb hid設(shè)備例程,如果程序不循環(huán)發(fā)數(shù)據(jù),usb好像就進(jìn)入休眠狀態(tài),電腦給端點1發(fā)數(shù)據(jù)就會失敗,我周期調(diào)用DevWakeup,喚醒主機(jī)也不行,如果芯片不周期主動發(fā)送數(shù)據(jù),該怎么使usb設(shè)備通信正常
int?main() { ????uint8_t?s; ????SetSysClock(CLK_SOURCE_PLL_60MHz); ????DebugInit();????????//配置串口1用來prinft來debug ????printf("start\n"); ????pEP0_RAM_Addr?=?EP0_Databuf;????//配置緩存區(qū)64字節(jié)。 ????pEP1_RAM_Addr?=?EP1_Databuf; ????USB_DeviceInit(); ????PFIC_EnableIRQ(USB_IRQn);???????//啟用中斷向量 ????mDelaymS(100); ????while(1) ????{//模擬傳輸4個字節(jié)的數(shù)據(jù),實際傳輸根據(jù)用戶需要自行修改 ???????/*?if(Ready) ????????{ ????????????Ready?=?0; ????????????DevHIDReport(0x05,?0x10,?0x20,?0x11); ????????} ????????mDelaymS(100); ????????if(Ready) ????????{ ????????????Ready?=?0; ????????????DevHIDReport(0x0A,?0x15,?0x25,?0x22); ????????} ????????mDelaymS(100); ????????if(Ready) ????????{ ????????????Ready?=?0; ????????????DevHIDReport(0x0E,?0x1A,?0x2A,?0x44); ????????} ????????mDelaymS(100); */ ????????if(Ready) ????????{ ????????????Ready?=?0; ????????????DevHIDReport(0x10,?0x1E,?0x2E,?0x88); ????????} ????????mDelaymS(100); ????} }
熱門產(chǎn)品 :
CH592: RISC-V內(nèi)核BLE5.4無線MCU