USB interrupt conflict

General discussion on mikroC PRO for PIC32.
Post Reply
Author
Message
XLupo
Posts: 106
Joined: 24 Jun 2011 13:09

USB interrupt conflict

#1 Post by XLupo » 13 May 2013 18:55

Hi,

can any please help me to break these two funtions apart so that they can both be called without one conlicting with the other?

void USB1Interrupt() iv IVT_USB_1 ilevel 7 ics ICS_SRS{

USB_Interrupt_Proc(); //this needs to be active for USB Hide pc comm.
// USBDev_IntHandler(); //this is needed for the maasstorage, but can not activate both sametime

}



I'm tryinh to add the mass storage example to my existing project and it calls for both of these functions to be called with in the interrupt routene as shown. however when I call one of them the usb goes into a error. it seems as though both of these lines can not be compiled together. In order to make the other work i have to comment one of them out as shown and recompile otherwise they will not co-exist together. I'm only calling one at a time and still will not work. perhaps i may not understand how they are both handeled. Does anyone have any advise, Please help me to be a ble call any one of these functions when needed.

Regards

Lupo

bartt
Posts: 156
Joined: 20 Jul 2012 18:52
Location: Left coast

Re: USB interrupt conflict

#2 Post by bartt » 14 May 2013 00:33

Hi Lupo-
Without more info on your design, why not separate the functions into 2 interrupts for different ports?
Hope that helps
Bart

gzoino
Posts: 141
Joined: 05 Sep 2009 15:48

test

#3 Post by gzoino » 14 May 2013 05:53

test

XLupo
Posts: 106
Joined: 24 Jun 2011 13:09

Re: USB interrupt conflict

#4 Post by XLupo » 16 May 2013 21:33

Hi Bartt, and thanks for your help, how ever i have tried brking as follws:

void USB1Interrupt() iv IVT_USB_1 ilevel 7 ics ICS_SRS{
USB_Interrupt_Proc(); //this needs to be active for USB Hide
}



void USB2Interrupt() iv IVT_USB_1 ilevel 7 ics ICS_SRS{
USBDev_IntHandler(); //this is needed for the maasstorage, but can not activate both sametime
}


but i still get the same reult whether i combine them or put them separte. I'm not sure if perhaps i need to change something to the second interrupt. As you can see i did change the second interrupt's function name to USB2Interrupt. But still experiencing difficulty.

I'm also loading two separate descriptors one for each function as well, and not sure if this could be causing the error or conflict. But i still need to figure out how to get them to work in the same
Rogram.

Lupo

XLupo
Posts: 106
Joined: 24 Jun 2011 13:09

Re: USB interrupt conflict

#5 Post by XLupo » 17 May 2013 18:40

Hi,


Plesae can anyone show me how I can use two separate interrupts in the same program. As you can see above I have tried putting each of my USB modules in separate interrupt routene and having cloflicts. I would like to call each one individually when needed and unload the other since I only use one or the other. I have re-copied it for simplicity

void USB1Interrupt() iv IVT_USB_1 ilevel 7 ics ICS_SRS{
USB_Interrupt_Proc(); //this needs to be active for USB Hide
}



void USB2Interrupt() iv IVT_USB_1 ilevel 7 ics ICS_SRS{
USBDev_IntHandler(); //this is needed for the maasstorage, but can not activate both sametime
}

Plesae any advise i will appreciate thanks

XLupo

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: USB interrupt conflict

#6 Post by filip » 20 May 2013 09:25

Hi,

You can use separate interrupts in the program, just use different IVT for each interrupt routine.

Regards,
Filip.

XLupo
Posts: 106
Joined: 24 Jun 2011 13:09

Re: USB interrupt conflict

#7 Post by XLupo » 20 May 2013 13:32

Thanks Philip,
Since I need two separate Interrupts for two separate USB handlers as you can see above, which IVT do you advise to use for the second Interrupt? as you know there is only one IVT availablt for USB, which is USB_1. How can I incorporate the second, using which IVT? I have tried changing the IVT with a couple of others which are listed under the Interrupt assistance, but doesnt work. The first USB handler is the USB_Interrupt_Proc(); which is listed under the library's original list and the second USBDEV_IntHandler() was just added for the mass storage which was just added to the library as you know. I have tried using the same IVT as you can see but it seems as though only one works. if i state both with the same IVT only the second one in line which was stated seems to work. I then change the order which they were stated and recompile, then the other works but not the fitrst. Please advise on this or if there is another way of doing this. Thank you

Xlupo

User avatar
janko.kaljevic
Posts: 3565
Joined: 16 Jun 2011 13:48

Re: USB interrupt conflict

#8 Post by janko.kaljevic » 23 May 2013 13:05

Hello,

Running both USB libraries at the same time is not good idea.
Most probably it will not work well.

Other option is to separately run HID and Mass Storage Device.
For example at one moment you use HID and then (after a button press) you initialize MSD.

If you want to implement HID and MSD at the same time, you will need to create a composite USB device and define in descriptor both classes.
This is possible only with our latest USB device library.

Best regards.

arafatronics
Posts: 18
Joined: 04 Apr 2013 09:51

Re: USB interrupt conflict

#9 Post by arafatronics » 23 May 2013 14:25

when i tried using usb interrupts i used the general usb iterrupt then reading the iterrupt flags to call the appropriate function to be the interrupt routine

or even setting my own flag to call functions as an interrupt routine

hope that help

Post Reply

Return to “mikroC PRO for PIC32 General”