CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

DO loop + USB interrupt

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
shirke



Joined: 08 Nov 2016
Posts: 11
Location: Hungary

View user's profile Send private message

DO loop + USB interrupt
PostPosted: Fri Oct 05, 2018 1:55 pm     Reply with quote

Hi,

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: 19538

View user's profile Send private message

PostPosted: Fri Oct 05, 2018 2:03 pm     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group