具有esp-idf的ESP32上的FatF无法创建带有* .json扩展名的文件

问题描述

由于加密,我想在我的Esp32项目中从SPIFFS转换为FAT。在我的示例项目中,我有这个

esp_vfs_spiffs_conf_t conf = {
  .base_path = "/spiffs",.partition_label = NULL,.max_files = 5,// This decides the maximum number of files that can be created on the storage
  .format_if_mount_Failed = true
};
esp_err_t ret = esp_vfs_spiffs_register(&conf);

...

ESP_LOGI(TAG,"opening file 1");
FILE *f = fopen("/spiffs/hello.json","w");
if (f == NULL) {
    ESP_LOGE(TAG,"Failed to open file 1 for writing test");
}
ESP_LOGI(TAG,"opening file 2");
FILE *f2 = fopen("/spiffs/hello.txt","w");
if (f2 == NULL) {
    ESP_LOGE(TAG,"Failed to open file 2 for writing test");
    return ESP_FAIL;
}

工作正常,并按预期创建了两个文件。但这

esp_vfs_fat_mount_config_t conf = {
     .format_if_mount_Failed = true,.allocation_unit_size = CONfig_WL_SECTOR_SIZE
   };
esp_err_t ret = esp_vfs_fat_spiflash_mount("/fatfs","storage",&conf,&s_wl_handle);    

ESP_LOGI(TAG,"opening file 1");
FILE *f = fopen("/fatfs/hello.json","opening file 2");
FILE *f2 = fopen("/fatfs/hello.txt","Failed to open file 2 for writing test");
    return ESP_FAIL;
}

json文件失败。

I (3672) example: opening file 1
E (3672) example: Failed to open file 1 for writing test
I (3682) example: opening file 2
...

到目前为止,Google对FatFS的文件扩展名没有任何问题。有人可以帮我理解吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)