when i using a very time cost function(2s to 12s) in usbFunctionWrite or usbFunctionRead (hid-data sample)the usb device disconnected.
i use usbPoll function in my function and upgrate my crystal to 20mhz .but stay my problem
how can i solve this problem?
thank you
very time cost function in v-usb
Re: very time cost function in v-usb
You must not perform any long lasting actions in these functions. And you must not call usbPoll() from within usbFunction*().
If you have to do long lasting processing, collect the data in a buffer and perform the processing in the main loop. You can easily call usbPoll() from there.
If you have to do long lasting processing, collect the data in a buffer and perform the processing in the main loop. You can easily call usbPoll() from there.