ccschen 发表于 2023-7-29 21:46:57

在目录下新建文件FR_DENIED

先说组件:STM32L4 V 1.17.2的库,FATFS+DMA+SDIO,在根目录下新建文件成功,在文件里面写数据也成功,



然后在根目录下新建个目录也成功了,

结果在目录下再新建文件失败,FR_DENIED

属性用的FA_OPEN_ALWAYS | FA_WRITE| FA_READ

文件路径用的绝对路径。

eric2013 发表于 2023-7-30 09:58:11

这个不正常,FatFS对此的解释如下:

FR_DENIED
The required access was denied due to one of the following reasons:
Write mode open against the read-only file. (f_open)
Deleting the read-only file or directory. (f_unlink)
Deleting the non-empty directory or current directory. (f_unlink)
Reading the file opened without FA_READ flag. (f_read)
Any modification to the file opened without FA_WRITE flag. (f_write, f_truncate, f_expand)
Could not create the object due to root directory full or disk full. (f_open, f_mkdir)
Could not find a contiguous area for the file. (f_expand)

ccschen 发表于 2023-7-30 13:13:39

问题已经解决,以前目录名比较长,现在是短目录名,不足的地方就是0x00,所以出这种情况。。。笔误。目录名长度改短就是了。是说嘛。。。

Y1ng 发表于 2023-7-31 08:33:17

那文件能创建成功,内容写不进去是什么问题呀

ccschen 发表于 2024-4-7 00:26:52

Y1ng 发表于 2023-7-31 08:33
那文件能创建成功,内容写不进去是什么问题呀

是不是写的内容超过512了?分批写?
页: [1]
查看完整版本: 在目录下新建文件FR_DENIED