Yes I understand that it is very CPU intensive... Here's the settings for the PWM:
CPU @ 48Mhz 3 PWM channels with
DEFINE SPWM_FREQ 100 'SPWM Frequency
DEFINE SPWM_RES 256 'SPWM Resolution
I tried dropping SPWM_FREQ to 40 and SPWM_RES 100 but it is still very irregular. It works well when de D+/D- lines are disconnected, so there's good chances the USB interrupt does takes too much time.
USB INT does contains much more than just USBSERVICE. There's about a dozen PBP instructions to update de status of "Plugged, RX_READY and TX_READY" and this is why I have it as a PBP interrupt. Tried turning it into an ASM interrupt and it does work too, but that's very confusing to me??!
Bookmarks