Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

FF_Format() does not work as expected on STM32F4

Posted by sanjayanvekar on May 26, 2017

Hello, I am tyring to use FF_Format() as descibed in the standrd example provided on freertos website, but unfortunatley the formated SD card is not recongnized by Windows and also after formating I cannot create any file on the embedded device. I am using FAT32 format and currently trying with 8Gb uSD card. Please help me to resolve this issue.

Thanks & Best Regards, Sanjay


FF_Format() does not work as expected on STM32F4

Posted by heinbali01 on May 27, 2017

Hi Sanjay,

When you use a pre-formatted card, can your device correctly read and write that card?

I just tried to format a card on my STM32F4 EVAL, by calling FF_SDDiskFormat() from ff_sddisk.c.

It calls FF_Format() as follows:

~~~ /* Format the drive - try FAT32 with large clusters. */ BaseTypet xPartitionNumber = 0; xError = FFFormat( pxDisk, xPartitionNumber, pdFALSE, pdFALSE); ~~~

It produces this logging with a 16GB card:

~~~ 00.000 [SvrWork ] >> format 00.000 [SvrWork ] FFFormat: Secs 31291384 Rsvd 32 Hidden 8 Root 0 Data 31291352 00.000 [SvrWork ] FFFormat: SecCluster 64 DatSec 31283704 DataClus 488807 ulClusterBeginLBA 7688 00.037 [SvrWork ] FFFormat: Clearing entire FAT (2 x 3819 sectors): 14.473 [SvrWork ] FFFormat: Clearing done 14.473 [SvrWork ] FFFormat: Clearing root directory at 00001E08: 64 sectors 14.681 [SvrWork ] FFSDDiskFormat: OK, now remounting 14.686 [SvrWork ] prvDetermineFatType: firstWord 0000FFF8 14.687 [SvrWork ] ****** FreeRTOS+FAT initialized 31291384 sectors 14.687 [SvrWork ] FF_SDDiskFormat: rc 00000001 14.687 [SvrWork ] Reading FAT and calculating Free Space 14.687 [SvrWork ] Partition Nr 0 14.687 [SvrWork ] Type 12 (FAT32) 14.688 [SvrWork ] VolLabel 'MY NAME ' 14.688 [SvrWork ] TotalSectors 31291384 14.688 [SvrWork ] SecsPerCluster 64 14.688 [SvrWork ] Size 15275 MB 14.688 [SvrWork ] FreeSize 15275 MB ( 100 perc free ) ~~~

I copied directories and files to the SD-card and checked them under Linux with fsck.vfat. It passed the tests.

Can you show any logging as here above?

Does your uSD card contain a valid partition table? Was it already formatted before you tried to format it?

Here is how you can create a partition:

FF_IOManager_t *pIoMan = sddisk_ioman( xMyDisk );
FF_PartitionParameters_t xParameters;

memset( &xParameters, '\0', sizeof xParameters );
xParameters.xSizes[0] = 100;         /* Assign 100% to the first partition. */
xParameters.ulSectorCount = pxDisk->ulNumberOfSectors;
xParameters.ulHiddenSectors = 8;     /* Keep at least these initial sectors free. */
xParameters.xPrimaryCount = 1;       /* If true, the partition will become of type "extended". */
FF_Error_t xError = FF_Partition( &xMyDisk, &xParameters );
if( FF_isERR( xError ) == 0 )
{
    /* partition OK. */
}

Regards.


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner