|
发表于 2013-3-18 13:44:27
|
显示全部楼层
我用lgt移植的vusb需要插入些nop, 否则通讯时会有错误的数据内容. 可能我用的12m晶振太山寨了.
分析vusb可以用逻辑分析仪配合闲置的io来分析
还有个问题也不知道我修正的对不对在usbdrvasm12.inc中- ;原始LGT 移植代码 此处可能会引起错误当开启USB_COUNT_SOF, USB_SOF_HOOK或者电平错误时将导致死循环或不执行代码
- ;通过增加新寄存器变量修正
- waitForJ:
- inc YL
- in x5, USBIN
- sbrs x5, USBMINUS
- brne waitForJ ; just make sure we have ANY timeout
- waitForK:
- ;The following code results in a sampling window of 1/4 bit which meets the spec.
- in x5, USBIN
- sbrs x5, USBMINUS
- rjmp foundK
- in x5, USBIN
- sbrs x5, USBMINUS
- rjmp foundK
- in x5, USBIN
- sbrs x5, USBMINUS
- rjmp foundK
- in x5, USBIN
- sbrs x5, USBMINUS
- rjmp foundK
- in x5, USBIN
- sbrs x5, USBMINUS
- rjmp foundK
- #if USB_COUNT_SOF
- lds YL, usbSofCount
- inc YL
- sts usbSofCount, YL
- #endif /* USB_COUNT_SOF */
- #ifdef USB_SOF_HOOK
- USB_SOF_HOOK
- #endif
- rjmp sofError
- foundK:
复制代码 |
|