Skip to main content
charlieincanada69
Associate III
December 1, 2011
Question

Using STM32 USB-FS-Device library with uCOS

  • December 1, 2011
  • 1 reply
  • 613 views
Posted on December 01, 2011 at 14:32

OK so I got the USB library with custom HID example (from ST) and uCOSII in IAR v6 compiling/linking/downloading, however the USB does not enumerate properly.

I assume that I have got the setup/architecture wrong. How should I successfully integrate the driver with uCOS? What approach should I take? At the moment the USB driver does not link to any tasks, just to interrupts.

Thanks for any advice!
    This topic has been closed for replies.

    1 reply

    charlieincanada69
    Associate III
    December 5, 2011
    Posted on December 05, 2011 at 15:37

    Replying to my own post in case anyone else is interested...

    After removing all of the ST dev board specific stuff from the code I then did the following things to get it running:

    *Edit the Board Support Package (BSP) code to initialize the USB port on the dev board I am using (ST32F103ZE from IAR) during boot.

    *Create a new ISR function within the uCOS BSP that is called when the USB interrupt fires. This function just calls the USB_Istr() function from the ST USB library.

    *Initialize the Interrupt vector table using the uCOS BSP function BSP_IntInit and adding a line so that the USB interrupt points at the function I created (see above).

    *Initialize the USB LP interrupt.

    *Call the USB_Init() function from the ST USB driver library to prepare the device for enumeration.

    *The board now waits to be plugged in...

    This may (probably?!?) not be the best architecture/approach for this type of thing so I would still be interested in opinions from others out there.

    I feel like the USB_Istr() function should be moved to a task within uCOS and just respond to a semaphore so that it is subject to all the same priority stuff as the other tasks.