Search found 11 matches

by kernic
Mon Aug 26, 2024 8:13 am
Forum: General Discussion
Topic: can't fail to open file
Replies: 11
Views: 3011

Re: can't fail to open file

so when you flash the esp32, it execute the main at least once without showing you, that's why it had problem with showing me the first init. If I flash the esp32 without the sd card it works fine. also for some reason, calling the f_expand function inside the conditional statement was problematic, ...
by kernic
Mon Aug 26, 2024 12:33 am
Forum: General Discussion
Topic: can't fail to open file
Replies: 11
Views: 3011

Re: can't fail to open file

At this point reading microsoft fat32 implementation and the wikipedia page is easier, I'm just gonna do it myself :lol: Did you try the code I gave you? even the simplest sample I gave at the end? please try it. I tried formatting my card more than 100 times while trying to debug this. I and about ...
by kernic
Sat Aug 24, 2024 3:36 am
Forum: General Discussion
Topic: can't fail to open file
Replies: 11
Views: 3011

Re: can't fail to open file

So this is my last consecutive post(since I don't want to overwhelm the chat with consecutive posts) but I found this very simple snippet: f_open(&file, FILE_PATH, FA_OPEN_ALWAYS | FA_READ | FA_WRITE); if(f_size(&file) != 0) { printf("File opened with success\n"); } else { printf("File opened for th...
by kernic
Sat Aug 24, 2024 2:06 am
Forum: General Discussion
Topic: can't fail to open file
Replies: 11
Views: 3011

Re: can't fail to open file

Ok, I just noticed a very strange behavior. Even if my code is behaving as 'expected' (provided you delay 3 seconds and execute the weird conditional logic), the file doesn't exist when I insert my sd card in my laptop.. Even if the esp32 is able to read it back again when I mount back the sd card i...
by kernic
Sat Aug 24, 2024 1:40 am
Forum: General Discussion
Topic: can't fail to open file
Replies: 11
Views: 3011

Re: can't fail to open file

Hello. I am not sure why is it happening, but can you try something like this? I am using `access` to see if the file exists. #include <unistd.h> //... FIL* file = (FIL*) ff_memalloc(sizeof(FIL)); if (file == NULL) { ;/* handle NULL */ } memset(file, 0, sizeof(FIL)); FRESULT fr = 0; if (access(FILE...
by kernic
Fri Aug 23, 2024 7:03 pm
Forum: General Discussion
Topic: can't fail to open file
Replies: 11
Views: 3011

Re: can't fail to open file

hahaha, I love your solution where you check if the file exists, I came to a similar conclusion, except my solution doesn't work unless I do a weird conditional check with the file and then do a wait call for at least 3 seconds, sorry if its a bit convoluted with the function: FRESULT checkFileExist...
by kernic
Fri Aug 23, 2024 2:55 pm
Forum: General Discussion
Topic: can't fail to open file
Replies: 11
Views: 3011

Re: can't fail to open file

well, for example I definitely tried to change the filename, like if it was "filetext.txt" I rename it "filetex2.txt". normally I would expect that opening the same file twice execute the 1st code block(FA_CREATE_NEW creates a new file), then the second open would execute the 2nd code block(FA_OPEN_...
by kernic
Fri Aug 23, 2024 8:02 am
Forum: General Discussion
Topic: can't fail to open file
Replies: 11
Views: 3011

can't fail to open file

I am currently using the fatfs library to allocate a contiguous file for my project. The problem is that I think I found a bug in the fatfs library, for example I want to first try opening a file with FA_OPEN_EXISTING, and if the file doesn't exist and the function return fail, I'd like to fall back...
by kernic
Thu Aug 22, 2024 11:13 pm
Forum: ESP-IDF
Topic: some esp_vfs_fat and FatFs functions are unavailable
Replies: 3
Views: 1081

Re: some esp_vfs_fat and FatFs functions are unavailable

I'm pretty sure I had the esp extension in visual studio at 5.3, since I remember downgrading it to 5.0 with no success(these days with the millions lines of code I expect newer versions of software to break, so my first instinct was to downgrade to 5.0 instead of trying to upgrade). I found out abo...
by kernic
Tue Aug 20, 2024 11:45 pm
Forum: ESP-IDF
Topic: some esp_vfs_fat and FatFs functions are unavailable
Replies: 3
Views: 1081

some esp_vfs_fat and FatFs functions are unavailable

In the documentation, we are told to use the #include "esp_vfs_fat.h" header. then the documentation proceed do define a bunch of functions like esp_vfs_fat_test_contiguous_file, and esp_vfs_fat_create_contiguous_file which I need for performance reasons since I want to allocate a contiguous file fo...