Showing results for 
Search instead for 
Did you mean: 

STM32L476RG FreeRTOS FATFS SDCard - USB MS read failure and buffer I/O error

Associate II

Hi everyone,

I am developing an application using the STM32L476RG MCU with FreeRTOS v2, FATFS and an SD card. I am storing sensor data in a .bin file onto the SD card and I want to enable the USB Mass Storage functionality to get .bin files onto my PC without having to remove the SD card from the device every time.

Following this tutorial ('Using SD Card' section), I added the USB Mass Storage middleware. When I connect the device to my Kubuntu 22.04 workstation the device is recognised, however, the process seems to reach a READ failure and a buffer error (see dump log below).

Does anybody understand/know what I am missing here?



Associate II

Update 1:

I corrected the block size and the errors I was encountering disappeared. However, the sd card is now recognised but not mounted. And if I try to mount it manually, via the terminal using the `sudo mount /dev/sdc` command I get the following error:

`mount: /dev/sdc: can't find in /etc/fstab.`

The SD card is accessed successfully via FATFS when writing sensor data into it. Bear in mind, that I am using a custom board developed specifically for the application. Unfortunately, I don't have an STM32L476RG discovery board available to test the firmware on.

For additional information, I have attached the output logs of when the SD card is connected using the custom board (custom_board_logs.txt) and when it's connected using an SD card reader (card_reader_logs.txt)