Fix for sdio_write_sectors

The issue was found by using f_mkdir("directory_name").
The function always returned FR_DISK_ERR due to an unhadled case in sdio_write_sectors().
According to this documentation: http://www.convict.lu/pdf/ProdManualSDCardv1.9.pdf#page=92 stop transmission command should be sent after writing multiple blocks.
This patch fixes this bug also adds a test case for it.
This commit is contained in:
Robert Fancsik 2018-04-16 11:22:38 +02:00
parent 0fa4213577
commit b43c3cee2d
2 changed files with 23 additions and 13 deletions

View file

@ -12,6 +12,7 @@
#define CS_GPIO_PIN 2
#define TEST_FILENAME "/test_loooong_filename.txt"
#define TEST_DIRECTORYNAME "my_directory"
#define TEST_CONTENTS "Hello! It's FatFs on esp8266 with ESP Open RTOS!"
#define READBUF_SIZE 256
#define DELAY_MS 3000
@ -69,6 +70,19 @@ void check_fatfs()
if (failed(f_chdrive(vol)))
return;
// Create a directory if it not exists
FILINFO info;
if (failed(f_stat(TEST_DIRECTORYNAME, &info)) && info.fattrib & AM_DIR)
{
printf("f_mkdir (\"%s\")\n", TEST_DIRECTORYNAME);
if (failed(f_mkdir(TEST_DIRECTORYNAME)))
return;
}
else
{
printf("\"%s\" directory already exists\n", TEST_DIRECTORYNAME);
}
FIL f;
// Create test file
printf("f_open(&f, \"%s\", FA_WRITE | FA_CREATE_ALWAYS)", TEST_FILENAME);