AnsweredAssumed Answered


Question asked by roofie01 on Nov 4, 2015

I have a target application using the STM32F405. On this board I have a USB port. To get started, I found some sample code written by someone for the STM32F4 Discovery board with a few lines of code for main, and the USB libraries (ub_lib) The project was written in Coocox OS.
I took this project, made a few changes for pin assignments, loaded it in Coocox and I was able to run this on my target board (not the Discovery); open a file on the USB, write data, close it with no problems.

Now I want to use these same libraries on my program environment (Atollic TS) which is for all intents and purposes, almost the same as Coocox. I also have FreeRTOS running. So I planted the USB and FAT fs driver directories in, and in main.c, way before the scheduler starts, I put in the same 15 lines of code as the example file has.

Well, nothing could be easier, but nothing could be more difficult to figure out. The USB OTG seems to initialize OK, but it will not actually detect the USB device - it keeps returning "USB_MSC_DEV_DETACHED", as if for some reason it doesn't see it. But, this is only on my programming environment, and Coocox (as said) works fine on my same board.

I've verified system files such as clocks are all matching. It comes down to interrupts, and this is where I'm at a loss to understand, and perhaps where the problem is. Does (would) FreeRTOS have anything to do with the way the interrupt handlers are set for the USB OTG? Where could I start looking to establish where the problem might be?

Has anyone else worked with USB OTG on this platform using FreeRTOS and experienced this? Thanks for any suggestions or help.


Note - I updated this issue after discovering that FreeRTOS is not causing any issues, The USB is tested *before* the start of the scheduler. So it comes down to why the same USB code, same target, will run in one environment and not the other.