I've been trying to create an wav encoder to store an sine wave to an .wav file on SD card, using esp32 and have tried interfacing the SD card with esp32 and it worked perfectly this is the working program https://pastebin.com/z5AVVB74for SD card interfacing without the wav encoder integrated. But if i try to use this modified programhttps://pastebin.com/qwh86Efx , i get the error while opening the SD card "E (442) example: Failed to open file for writing" , I can still read the card details, but it refuses to open file for writing. What could be the possible error.
The pin configuration is in SD in SPI mode and the connections are specified in the program.
Board: ESP32 WROOM 32.
Error interfacing SD card with board.
-
- Posts: 52
- Joined: Thu Jun 22, 2023 12:50 pm
Re: Error interfacing SD card with board.
Hello.
I looked at your code and I see you use FATFS as your filesystem. Your file name is "output_audio.wav", which is too long for SFN (short file name) / 8.3 filename standard - which means maximum 8 characters for filename + dot + 3 characters for file extension. You either need to shorten your file name or enable LFN (long file name) support in `idf.py menuconfig` under `(Top) → Component config → FAT Filesystem support`.
You can also try and add `#include <errno.h>` to your code, check global `errno` variable and print it with `strerror()` or use `perror()` function after C stdlib function calls to see what was the latest error code, helps a lot with debugging.
I looked at your code and I see you use FATFS as your filesystem. Your file name is "output_audio.wav", which is too long for SFN (short file name) / 8.3 filename standard - which means maximum 8 characters for filename + dot + 3 characters for file extension. You either need to shorten your file name or enable LFN (long file name) support in `idf.py menuconfig` under `(Top) → Component config → FAT Filesystem support`.
You can also try and add `#include <errno.h>` to your code, check global `errno` variable and print it with `strerror()` or use `perror()` function after C stdlib function calls to see what was the latest error code, helps a lot with debugging.
Who is online
Users browsing this forum: Baidu [Spider], Majestic-12 [Bot] and 146 guests