CH573F的usb hid设备例程,如果程序不循环发数据,usb好像就进入休眠状态,电脑给端点1发数据就会失败,我周期调用DevWakeup,唤醒主机也不行,如果芯片不周期主动发送数据,该怎么使usb设备通信正常
int main() { uint8_t s; SetSysClock(CLK_SOURCE_PLL_60MHz); DebugInit(); //配置串口1用来prinft来debug printf("start\n"); pEP0_RAM_Addr = EP0_Databuf; //配置缓存区64字节。 pEP1_RAM_Addr = EP1_Databuf; USB_DeviceInit(); PFIC_EnableIRQ(USB_IRQn); //启用中断向量 mDelaymS(100); while(1) {//模拟传输4个字节的数据,实际传输根据用户需要自行修改 /* 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); } }
热门产品 :
CH32V317: 互联型青稞RISC-V MCU