AnsweredAssumed Answered

STM32F4: SD-Card using FatFs and USB fails

Question asked by Pfeffer.Daniel on Nov 5, 2016
Latest reply on Nov 8, 2016 by Pfeffer.Daniel
Hi,

in my application, I've set up a STM32F4, SD-Card and USB-CDC (all with CubeMX). 
Using a PC, I send commands to the STM32, which then does things on the SD-Card.

The commands are handled using a "communicationBuffer" (implemented by me) which waits for commands over USB, UART, ... and sets a flag, when a \n character was received. The main loop polls for this flag and if it is set, a parser handles the command. So far, so good.

When I send commands via UART, it works fine, and I can get a list of the files on the SD-Card or perform other access via FatFs without a problem.

The problem occurs, when I receive a command via USB-CDC. The parser works as expected, but FatFs claims "FR_NO_FILESYSTEM (13)" in f_opendir.
Also other FatFs commands fail with this error-code.

After one failed USB-command, commands via UART will also fail. It seems, as if the USB somehow crashes the initialized SD-Card-driver.

Any idea how I can resolve this behaviour?

Thanks :)

Outcomes