Hello,
I'm trying to obtain the current working directory on SD1 of the Zynq Ultrascale+ device (TE0820) for FTP application. however, the command f_getcwd is returning failure. It works fine for SD0. Below is the example code:
#include "xparameters.h" /* SDK generated parameters */
#include "xsdps.h" /* SD device driver */
#include "xil_printf.h"
#include "ff.h"
#include "xil_cache.h"
#include "xplatform_info.h"
static FIL fil; /* File object */
static FATFS fatfs;
static char FileName[32] = "1:/Test.bin";
static char *SD_File;
u8 DestinationAddress[10*1024*1024] __attribute__ ((aligned(32)));
u8 SourceAddress[10*1024*1024] __attribute__ ((aligned(32)));
#define TEST 7
int main(void)
{
int Status;
xil_printf("SD Polled File System Example Test \r\n");
FRESULT Res;
UINT NumBytesRead;
UINT NumBytesWritten;
u32 BuffCnt;
BYTE work[FF_MAX_SS];
u32 FileSize = (8*1024*1024);
TCHAR *Path = "1:/";
for(BuffCnt = 0; BuffCnt < FileSize; BuffCnt++){
SourceAddress[BuffCnt] = TEST + BuffCnt;
}
Res = f_mount(&fatfs, Path, 0);
if (Res != FR_OK) {
print ("mount failed\n");
return XST_FAILURE;
}
Res = f_mkfs(Path, FM_FAT32, 0, work, sizeof work);
if (Res != FR_OK) {
print ("mkfs failed\n");
return XST_FAILURE;
}
#define SZ_STR 255
TCHAR str[SZ_STR];
/* Get current directory path */
Res = f_getcwd(str, SZ_STR);
if (Res != FR_OK) {
xil_printf ("Current working directory return failed cwd\n",);
return XST_FAILURE;
}
xil_printf ("Current working directory success cwd= %s\n", str);
}
I'm using TE0720 SOM and Vivado version is 2018.3. And below is the BSP settings of generic fat file system library

. Any idea where I am going wrong?
Thank you.
Kind regards,
Sandeep