Flash storage mount stops working (urgent)
Flash storage mount stops working (urgent)
I think it was working fine before.
My custom partition.
# Name, Type, SubType, Offset, Size
nvs, data, nvs, 0x9000, 0x4000
otadata, data, ota, 0xd000, 0x2000
phy_init, data, phy, 0xf000, 0x1000
ota_0, app, ota_0, 0x10000, 0x1A0000
ota_1, app, ota_1, , 0x1A0000
storage, data, fat, ,0x80000
on start ram usage
Stack free: 2680
Internal Heap free: 346288
Heap free: 267068:346288
on start free heap=267068
D (6258) nvs: nvs_erase_key serial_num
D (6262) CPPNVS: >> set: key: serial_num, u32: value=456
D (6266) nvs: nvs_set serial_num 4 456
D (6271) CPPNVS: << set
D (6273) nvs: nvs_get serial_num 4
serial num=456
V (6278) wl_flash: config start_addr=0x00000000, full_mem_size=0x00080000, pag
e_size=0x00001000, sector_size=0x00001000, updaterate=0x00000010, wr_size=0x00
000010, version=0x00000001, temp_buff_size=0x00000020
V (6296) wl_flash: config - this->addr_state1=0x0007d000
V (6302) wl_flash: config - this->addr_state2=0x0007e000
D (6307) wl_flash: init - config ID=1, stored ID=1, access_count=0, block_size
=4096, max_count=16, pos=0, move_count=0
D (6318) wl_flash: init starts: crc1=-1312139876, crc2 = -1312139876, this->st
ate.crc=-1312139876, state_copy->crc=-1312139876
D (6329) wl_flash: init: crc1=-1312139876, crc2 = -1312139876, result=0
D (6336) wl_flash: recoverPos - this->state.pos=0x00000000, result=00000000
D (6343) vfs_fat_spiflash: using pdrv=0
V (6347) ff_diskio_spiflash: ff_wl_ioctl: cmd=2
V (6352) ff_diskio_spiflash: ff_wl_read - pdrv=0, sector=0, count=1
V (6358) wl_flash: read - src_addr=0x00000000, size=0x00001000
V (6364) wl_flash: calcAddr - addr=0x00000000 -> result=0x00001000
W (6371) vfs_fat_spiflash: f_mount failed (13)
I (6376) vfs_fat_spiflash: Formatting FATFS partition, allocation unit size=52
4288
V (6384) ff_diskio_spiflash: ff_wl_ioctl: cmd=3
V (6389) ff_diskio_spiflash: ff_wl_ioctl: cmd=2
V (6393) ff_diskio_spiflash: ff_wl_ioctl: cmd=1
E (6398) vfs_fat_spiflash: f_mkfs failed (14)
ESP_ERROR_CHECK failed: esp_err_t 0xffffffff at 0x401152aa
file: "C:/Work/LibDev/esp32/esp-idf/components/cpp_utils/FATFS_VFS.cpp" line 4
9
func: void FATFS_VFS::mount()
expression: esp_vfs_fat_spiflash_mount(m_mountPath.c_str(), m_partitionName.c_
str(), &mountConfig, &m_wl_handle)
Backtrace: 0x4008ac8b:0x3ffbd0f0 0x4008b175:0x3ffbd110 0x401152aa:0x3ffbd130 0
x400d4187:0x3ffbd160 0x400d4331:0x3ffbd1b0 0x400d26a8:0x3ffbd200
Entering gdb stub now.
$T0b#e6
My custom partition.
# Name, Type, SubType, Offset, Size
nvs, data, nvs, 0x9000, 0x4000
otadata, data, ota, 0xd000, 0x2000
phy_init, data, phy, 0xf000, 0x1000
ota_0, app, ota_0, 0x10000, 0x1A0000
ota_1, app, ota_1, , 0x1A0000
storage, data, fat, ,0x80000
on start ram usage
Stack free: 2680
Internal Heap free: 346288
Heap free: 267068:346288
on start free heap=267068
D (6258) nvs: nvs_erase_key serial_num
D (6262) CPPNVS: >> set: key: serial_num, u32: value=456
D (6266) nvs: nvs_set serial_num 4 456
D (6271) CPPNVS: << set
D (6273) nvs: nvs_get serial_num 4
serial num=456
V (6278) wl_flash: config start_addr=0x00000000, full_mem_size=0x00080000, pag
e_size=0x00001000, sector_size=0x00001000, updaterate=0x00000010, wr_size=0x00
000010, version=0x00000001, temp_buff_size=0x00000020
V (6296) wl_flash: config - this->addr_state1=0x0007d000
V (6302) wl_flash: config - this->addr_state2=0x0007e000
D (6307) wl_flash: init - config ID=1, stored ID=1, access_count=0, block_size
=4096, max_count=16, pos=0, move_count=0
D (6318) wl_flash: init starts: crc1=-1312139876, crc2 = -1312139876, this->st
ate.crc=-1312139876, state_copy->crc=-1312139876
D (6329) wl_flash: init: crc1=-1312139876, crc2 = -1312139876, result=0
D (6336) wl_flash: recoverPos - this->state.pos=0x00000000, result=00000000
D (6343) vfs_fat_spiflash: using pdrv=0
V (6347) ff_diskio_spiflash: ff_wl_ioctl: cmd=2
V (6352) ff_diskio_spiflash: ff_wl_read - pdrv=0, sector=0, count=1
V (6358) wl_flash: read - src_addr=0x00000000, size=0x00001000
V (6364) wl_flash: calcAddr - addr=0x00000000 -> result=0x00001000
W (6371) vfs_fat_spiflash: f_mount failed (13)
I (6376) vfs_fat_spiflash: Formatting FATFS partition, allocation unit size=52
4288
V (6384) ff_diskio_spiflash: ff_wl_ioctl: cmd=3
V (6389) ff_diskio_spiflash: ff_wl_ioctl: cmd=2
V (6393) ff_diskio_spiflash: ff_wl_ioctl: cmd=1
E (6398) vfs_fat_spiflash: f_mkfs failed (14)
ESP_ERROR_CHECK failed: esp_err_t 0xffffffff at 0x401152aa
file: "C:/Work/LibDev/esp32/esp-idf/components/cpp_utils/FATFS_VFS.cpp" line 4
9
func: void FATFS_VFS::mount()
expression: esp_vfs_fat_spiflash_mount(m_mountPath.c_str(), m_partitionName.c_
str(), &mountConfig, &m_wl_handle)
Backtrace: 0x4008ac8b:0x3ffbd0f0 0x4008b175:0x3ffbd110 0x401152aa:0x3ffbd130 0
x400d4187:0x3ffbd160 0x400d4331:0x3ffbd1b0 0x400d26a8:0x3ffbd200
Entering gdb stub now.
$T0b#e6
Re: Flash storage mount stops working (urgent)
SD card mount work but not spiflash mount.
Any idea?
Any idea?
Re: Flash storage mount stops working (urgent)
This example is working.
https://github.com/espressif/esp-idf/tr ... _levelling
But below example does not work. crash.
https://github.com/nkolban/ESP32_Explorer
Strange?
https://github.com/espressif/esp-idf/tr ... _levelling
But below example does not work. crash.
https://github.com/nkolban/ESP32_Explorer
Strange?
Re: Flash storage mount stops working (urgent)
Fix by specifying allocation_unit_size
Code: Select all
void FATFS_VFS::mount() {
esp_vfs_fat_mount_config_t mountConfig;
mountConfig.max_files = m_maxFiles;
mountConfig.format_if_mount_failed = true;
mountConfig.allocation_unit_size = 4096;
ESP_LOGD(LOG_TAG, "FATFS_VFS::mount(%s,%s)", m_mountPath.c_str(), m_partitionName.c_str());
ESP_ERROR_CHECK(esp_vfs_fat_spiflash_mount(m_mountPath.c_str(), m_partitionName.c_str(), &mountConfig
Re: Flash storage mount stops working (urgent)
Very good find and AWESOME work. This field was apparently added back in January and the code library you are playing with pre-dates that and wasn't upgraded (or known) to be changed. What we can now do is make sure that it has a "good value" by default.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: Flash storage mount stops working (urgent)
Hmmm ... it gets more interesting. I went to examine this problem in more depth and found that it appears that this option is not present in v3.0 (the current latest stable) of ESP-IDF ... see:
https://github.com/espressif/esp-idf/bl ... _vfs_fat.h
Are you working with ESP-IDF master or with a stable release of the ESP-IDF?
https://github.com/espressif/esp-idf/bl ... _vfs_fat.h
Are you working with ESP-IDF master or with a stable release of the ESP-IDF?
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: Flash storage mount stops working (urgent)
I download esp-idf few month back. not using latest.
I will try latest code base.
I will try latest code base.
Re: Flash storage mount stops working (urgent)
kolban wrote:Very good find and AWESOME work. This field was apparently added back in January and the code library you are playing with pre-dates that and wasn't upgraded (or known) to be changed. What we can now do is make sure that it has a "good value" by default.
This field was added for v3.1, back in February. It will choose a "good value" by default if the field is left unset with value zero. The problem is that the code as-written does not zero this field:kolban wrote:Hmmm ... it gets more interesting. I went to examine this problem in more depth and found that it appears that this option is not present in v3.0
Code: Select all
esp_vfs_fat_mount_config_t mountConfig;
mountConfig.max_files = m_maxFiles;
mountConfig.format_if_mount_failed = true;
Code: Select all
esp_vfs_fat_mount_config_t mountConfig = { 0 };
mountConfig.max_files = m_maxFiles;
mountConfig.format_if_mount_failed = true;
Always initializing structures declared on the stack is a very good habit to get into when writing C (or C++ with C types). Even if you set every member of the structure *now*, you never know what may change in the future (and if you do set every member of the structure now, the compiled binary will be identical whether you pre-initialize to zero or not.)
Re: Flash storage mount stops working (urgent)
ok, good advise. thanks.
Who is online
Users browsing this forum: No registered users and 75 guests