I have a project in which I have to filter the incoming data with a FIR filter, and after that the uC have to send out via USB.
For this I use a dsPIC33EP256MU806.
I use the <usb_cdc.h> library for USB, and for the FIR filter I have to use a DO loop (assembly instruction) to make the processing real-time.
BUT the problem begins here...
I managed to find out that, when the DO loop is NOT implemented in the source code the USB communication works fine but if it is implemented the communication stucks everytime after a few packets.
I think the reason of this is that the interrupt of USB interrupts the DO loop.
I don't know how can I solve this issue.
Do you have any idea?
Have you ever seen anything like this? _________________ shirke
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
Posted: Fri Oct 05, 2018 2:03 pm
Interrupting the Do loop should not matter. The interrupt handler saves all registers it uses, so all that will happen is a slight pause in the loop timing.
However. The USB driver has a requirement to call usb_task at a reasonable interval. Though the main processing is interrupt driven, this performs 'housekeeping', and there is a maximum interval between calls to this if the USB is to keep working.
Add a call to this after each pass through the fast loop.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum