/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / USB handler redirection

Username:     
Password:     
             

Forum

# 1   2009-03-22 18:11:35 USB handler redirection

slimphony
Member
Registered: 2009-01-27
Posts: 13

USB handler redirection

Hi,

I found out that without the following code, the USB callback handler never gets called when data is written to the device (on EP1 OUT).

#define ID_IRQ_USB_LP  (0x90)
UTIL_SetIrqHandler(ID_IRQ_USB_LP, (u32)USB_Istr);

These lines are from the PrimerMouse1.1 application, an "adapted version" for the Primer of the ST sample code (from their USB Dev Kit).

Can you give me more details about it... :
* Why is it necessary ? What/Where is the default handler ?
* Where does the offset of this #define ID_IRQ_USB_LP  (0x90) come from ?
* Why isn't there anything like this in the ST sample code (nor in the ride-specific stm32f10x_vector.c) ? (or maybe I didn't look at the right place ?)
* What/Where is the corresponding code in the ST sample code if any ?

Many thanks,

Sylvain.

Offline

 

# 2   2009-03-22 19:26:15 USB handler redirection

Francis
Administrator
From: France-Grenoble
Registered: 2007-07-09
Posts: 890

Re: USB handler redirection

For the Primer1: there is no management of USB at all, and there is no default handler for USB irq.  You have to redirect the USB irq to your own application  (see as example the project 'MOUSE').

For the Primer2,  USB is managed as a Mss storage device (since CircleOS 3.5). For any other application, you have to redirect the irq to your own application (and to restore the original pointers when you exit your application).

The define matches with the irq vector address.

Offline

 

# 3   2009-03-23 12:55:10 USB handler redirection

slimphony
Member
Registered: 2009-01-27
Posts: 13

Re: USB handler redirection

Francis :

The define matches with the irq vector address.

Precisely, how do you compute the 0x90 value ??? How do you know which handler interrupt it corresponds to ?

The only reference to the vector table I have found is in CircleStartup.c where USBRXHandler is defined... but there is no way I can figure out by myself how to use this information... sad

Last edited by slimphony (2009-03-23 12:57:41)

Offline

 

# 4   2009-03-23 12:58:07 USB handler redirection

Francis
Administrator
From: France-Grenoble
Registered: 2007-07-09
Posts: 890

Re: USB handler redirection

See the table in the reference manual (http://www.st.com/stonline/products/lit … /13902.pdf, page 120, column "address".

Offline

 

# 5   2009-03-23 14:39:30 USB handler redirection

slimphony
Member
Registered: 2009-01-27
Posts: 13

Re: USB handler redirection

OK this is clear now. Thanks a lot!

Offline

 

Board footer