On an STM32F4 target board, I have a USB flash port that works 100% OK. By this, I mean that I am able to transfer data from an FRAM chip to the USB flash. I can do this after initializing peripheral interfaces and going through the USB flash interface to verify the device is connected, then mounted, then transfer. The transfer takes under 1 second. This is using a C program, before I initialize FreeRTOS tasks or launch the scheduler (They are essentially commented out to test this functionality)
Now, I would like to do this through FreeRTOS, after I launch the scheduler. On my board, I have a push button that I can press and detect such that, when a USB flash is inserted, the user can push and hold the button, and a transfer can be executed. In FreeRTOS, after detecting the button press in a task, I send a message into the Queue and
then call the function
USBconnected = initializeUSB();
Which returns TRUE if device is mounted successfully. It returns true, then calls the function “usbTransfer()” and begins the data transfer from RAM to flash. However - that’s as far as it goes. It never finishes, and seems to hang up. The file never gets opened but never gets finished writing and not closed. I have tried things like using vTaskSuspend on other running tasks but to no avail.
I know that the USB interfaces can be quirky, and maybe I need to do other things in FreeRTOS to use it?
Any suggestions on what might be wrong?