2022-12-24 07:29 AM
2022-12-24 09:58 AM
Which board specifically, an ST EVAL/DISCO board, or a WEACT / TAOBAO / ALIEXPRESS type thing?
Helps to be specific and provide a link or picture of board.
Well still probably an issue with connectivity, configuration or software, kind of blind to any material detail.
Top level issues with FatFS all most always relate to HW and DISKIO level failing, so instrument that and make sure basic level sector read operations work. I'd focus on reading existing cards, with unimportant content. Make sure you can read and directory those first before graduating to WRITE operations and file/format operations.
2022-12-26 05:03 AM
Hi,
This is my code.can you find any error in the code
please guide me
if(f_mount(&fs, "/", 1) != FR_OK)
{
Serial_PutString("SD Card mounted successfully");
if(f_open(&fil, "test.txt", FA_READ)!=FR_OK)
{
printf("sucessfully opened : (%i)\r\n");
if(f_read(&fil,buf,sizeof(&fil),&br)==FR_OK)
{
Serial_PutString("File read successfully");
}
// break;
}
if(f_unlink("test.txt")!=FR_OK)
{
Serial_PutString("File deleted successfully");
}
char myFilename[] = "first.txt";
if(f_open(&fil, myFilename, FA_WRITE || FA_CREATE_ALWAYS||FA_CREATE_NEW)!=FR_OK )
{
Serial_PutString("File Created successfully");
char myData[] = "Hello World";
if(f_write(&fil, myData, sizeof(myData),&bw) !=FR_OK)
{
Serial_PutString("Data written to file successfully");
}
f_close(&fil);
}
}
else
{
Serial_PutString("Failed to mount SD card");
}
f_mount(NULL, "", 0);
printf("SD Card Unmounted Successfully!!!\r\n");
2022-12-26 05:40 AM
The Double OR (logical) is wrong, but top level functionality is dependent on you having working sector read/write code. Validate that first, then integrate file system code.