thyanger wrote on Wednesday, September 09, 2015:
Hi,
I am developping an application to write something in a file over an USB key connected to the discovery board. A very basic example without FreeRTOS works well. This example is one of those provided by ST within Cube (STM32Cube_FW_F4_V1.5.0\Projects\STM32F429I-Discovery\Applications\FatFs\FatFs_USBDisk), which I rearranged to make it work with eclipse mars. This example, and also my application, uses the USB middleware provided within Cube. The USB is configured in HS as a host mass storage class (MSC) device.
Now, I have rearranged the code to use FreeRTOS but in this case it does not work. I am really confused by the USB middleware layer which I tried to investigate for debug purposes, so I know that also my help request is unclear. The code is organized as follow: there are one task and one queue. The task, namely userTask, is that which is in charge to write the file. The drivers are adapted to the use with an RTOS, being enough to check the flag USBH_USE_OS == 1 in a configuration file. By means of the driver initialization procedure, another task is created by the driver at startup, namely driverTask, which is in charge to detect the events occurring about the USB peripheral (i.e. connection, disconnection and so on). The userTask and the dirverTask communicates via the queue I have mentioned before. The driverTask communicates with the low level driver with other queues (by code inspection you can see this).
As an example I also gave a look at the code written for the evaluation board and provided within Cube (for the discovery there is no example with freertos+usbkey+fatfs).
So, the microcontroller starts with the USB key attached. During debug I noticed that both tasks are in blocking state, like they are waiting for something to happen. So I put a breakpoint to the IRQHanlder call and I have noticed that by repeatedly pressing the “play” button in eclipse, it always enters that piece of code as the interrupt is never served. However I checked the interrupt priority and everything looks ok.
At this point I really don’t know what to check since my lack of knowledge of this middleware (which I deem awful). Any help will be really appreciated.
Thank you and regards.
