Hi everybody,
i am new with FreeRTOS and try to learn file system with FreeRTOS + FAT. Base to Demo on STM32F4 i modified the ff_disk.c for STM32F746G-DISCO board, and used heap_4.c instead of heap_5.c.
After SD Card was initial, i had prolem with function FF_SDDiskMount called in FF_SDDiskInit.
FF_Disk_t *FF_SDDiskInit( const char *pcName )
{
…
pxDisk->xStatus.bIsInitialised = pdTRUE;
pxDisk->xStatus.bPartitionNumber = xPartitionNumber;
if( FF_SDDiskMount( pxDisk ) == 0 )
{
FF_SDDiskDelete( pxDisk );
pxDisk = NULL;
}
else
{
…
}
I tried to debug and i saw the error is no partition has been found. The function FF_PartitionSearch in ff_ioman.c returned error after it was called. The error is at line 1071
FF_Error_t FF_PartitionSearch( FF_IOManager_t *pxIOManager, FF_SPartFound_t *pPartsFound )
{
…
FF_PRINTF( “FF_PartitionSearch: [%02X,%02X] No signature (%02X %02X), no PBR neither\n”,
FF_getChar( ucDataBuffer, 0 ),
FF_getChar( ucDataBuffer, 2 ),
FF_getChar( ucDataBuffer, FF_FAT_MBR_SIGNATURE ),
FF_getChar( ucDataBuffer, FF_FAT_MBR_SIGNATURE + 1 ) );
/* No MBR and no PBR then no partition found. */
xError = FF_ERR_IOMAN_INVALID_FORMAT | FF_PARTITIONSEARCH;
break;
…
}
I was wondering if anyone has tried it on the STM32F746G-Disco, any help would be appreciated.
Thanks in advance!
Ngoc
Thanks Hein, that is the problem. The HAL_SD_ReadBlocks_DMA of STM32F7 need block address, and I still gave it the normal address like in STM32F4. Now I can go a step further.
Hi Hein,
I am also new with ST Controller. What I saw the functions HAL_SD_ReadBlocks_DMA and HAL_SD_WriteBlocks_DMA in stm32f7xx_hal_sd.c are different in stm32f4xx_hal_sd.c
In stm32f7 it do not have param BlockSize
/**
@brief Reads block(s) from a specified address in a card. The Data transfer
is managed by DMA mode.
@note This API should be followed by a check on the card state through
HAL_SD_GetCardState().
@note You could also check the DMA transfer process through the SD Rx
interrupt event.
@param hsd Pointer SD handle
@param pData Pointer to the buffer that will contain the received data
@param BlockAdd Block Address from where data is to be read
@param NumberOfBlocks Number of blocks to read.
@retval HAL status
*/
HAL_StatusTypeDef HAL_SD_ReadBlocks_DMA(SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks)
and in stm32f4 (I took it from demo sources code)
/**
@brief Reads block(s) from a specified address in a card. The Data transfer
is managed by DMA mode.
@note This API should be followed by the function HAL_SD_CheckReadOperation()
to check the completion of the read process
@param hsd: SD handle
@param pReadBuffer: Pointer to the buffer that will contain the received data
@param ReadAddr: Address from where data is to be read
The variable CardType was set during the initialisation. SDHC cards use sector numbers, older SD cards use a byte offset.
The STM32F7 uses the same logic.
I hope this answers your question. If not, please say so.