FreeRTOS+FAT on Altera (Intel) Cyclone V SoC

hdkn wrote on Wednesday, May 15, 2019:

Hello Hein,

Thanks for replying.

Regarding alignment. The file write/read test functions simply pass the whole data buffer directly to the ff_stdio functions. The buffer address is aligned and I use byte sizes of N x 1024. The calling code looks something like:

	/* Allocate the file buffer at a high-enough address. */
	pcFileBuffer = ( void * ) 0x10000000; // 256M
            ...
	xWritten = ff_fwrite( pcFileBuffer, 1, xSize, xFp );

According to the dev board’s manual: “This 4-bit data interface can sustain burst read operations at up to 50 MHz for a throughput of 25 MBps.”

I will check the clock and other settings today.

I am using alt_sdmmc.c, but the one from HWLib 18.0 because the one under the CORTEX_A9_Cyclone_V_SoC_DK demo lacked basic features like getting the max sectors, which is needed for initializing FF_Disk.

I do use alt_sdmmc_read() and alt_sdmmc_write(). I think that’s all they have for general read/write. I pass ulSectorCount x 512 for the size. Here’s what I use in prvFFWrite():

	void *pvDest = ( void * ) ( ulSectorNumber * 512UL );

		xResult = alt_sdmmc_write( &xCardInfo,	// card_info
			pvDest,								// dest
			( void * ) pucBuffer,				// src
			ulSectorCount * 512UL );			// size

Forgot to mention that the card was formatted with FF_SDDiskFormat() just to be complete.

I am attaching the relevant source files for your reference.

Hideki