# USB - STR71x and FreeRTOS

**URL:** <https://forums.freertos.org/t/usb-str71x-and-freertos/3762>\
**Category:** Kernel\
**Created:** [January 2, 2006, 2:06pm UTC](https://forums.freertos.org/t/usb-str71x-and-freertos/3762 "2006-01-02T14:06:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [January 2, 2006, 2:06pm UTC](https://forums.freertos.org/t/usb-str71x-and-freertos/3762/1 "2006-01-02T14:06:04Z")

</div>

**nobody** wrote on [Monday, January 02, 2006](https://sourceforge.net/p/freertos/discussion/382005/thread/a6a02f69/#ad4b):

Hi!

Do I need to make the RTOS handle all the USB standard requests or can I just let it happend in interrupts?

I will then use the RTOS queues for collecting data from the data endpoints.

Best regards,

Frank Andersen

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [January 2, 2006, 6:24pm UTC](https://forums.freertos.org/t/usb-str71x-and-freertos/3762/2 "2006-01-02T18:24:04Z")

</div>

**nobody** wrote on [Monday, January 02, 2006](https://sourceforge.net/p/freertos/discussion/382005/thread/a6a02f69/#ad4b/e89d):

Not quite sure what you are asking here.&nbsp; You have the design choice of handling USB events from the interrupt service routine if you want.&nbsp; If the event is going to take a long time to process then it is best to let a task perform the processing.&nbsp; Maybe you want some events processed directly in the ISR and some passed to a task.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [January 5, 2006, 7:43am UTC](https://forums.freertos.org/t/usb-str71x-and-freertos/3762/3 "2006-01-05T07:43:38Z")

</div>

**nobody** wrote on [Thursday, January 05, 2006](https://sourceforge.net/p/freertos/discussion/382005/thread/a6a02f69/#ad4b/8ba4):

Hello, I’m trying to do the same thing.&nbsp; Use an str711 with usb and IAR.&nbsp; What interrupt handlers do I need to include to get the usb to work, so far I only have an example of how to use the uart handler with freeRtos (that was included with the iar build)

thanks for any help

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [January 9, 2006, 9:03am UTC](https://forums.freertos.org/t/usb-str71x-and-freertos/3762/4 "2006-01-09T09:03:26Z")

</div>

**nobody** wrote on [Monday, January 09, 2006](https://sourceforge.net/p/freertos/discussion/382005/thread/a6a02f69/#ad4b/70e7):

You need to write an interrupt handler like the one for uart

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RSEG ICODE:CODE  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CODE32

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXTERN USB\_Istr  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PUBLIC vUSBISREntry

; Wrapper for the USB interrupt service routine.&nbsp; This can cause a  
; context switch so requires an assembly wrapper.

; Defines the portSAVE\_CONTEXT and portRESTORE\_CONTEXT macros.  
#include "ISR\_Support.h"

vUSBISREntry:

&nbsp;&nbsp;&nbsp; portSAVE\_CONTEXT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; Save the context of the current task.

&nbsp;&nbsp;&nbsp; bl&nbsp;&nbsp;&nbsp; USB\_Istr&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; Call the ISR routine.

&nbsp;&nbsp;&nbsp; portRESTORE\_CONTEXT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; Restore the context of the current task -  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; which may be different to the task that  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; was interrupted.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; END

and then exchange the DefaultISR with vUSBISREntry at the USBLP\_Addr and the USBHP\_Addr

Best regards,

Frank Andersen
