Im at a loss here...ive been messing around with this for 7 hours and I cant figure out why esp_partition_erase_range and esp_partition_write do not work.
All they do is return either "invalid size" or "invalid argument" errors.
ESP32-wroom32, 16MB flash.
My partition table is setup for a SPIFFS partition size 0xAF0000, starting address 0x510000, partition name is "spiffs".
esp_partition_erase_range("spiffs", 0, 0xAF0000); returns invalid argument.
0xAF0000 is divisible by 4096, so that should not be a problem.
esp_partition_write also always returns either "invalid argument" or "invalid size".
According to the IDF documentation, if invalid size is returned following a partition erase, it means "if erase would go out of bounds of the partition". Thats impossible! The partition is 0xAF0000 in length, im telling it to erase 0xAF0000.
For testing, I tried telling it to erase a shorter length (that was divisible by 4096), and it still says invalid size.
Is there some other magic involved in using esp_partition_write and esp_partition_erase_range that the IDF documents dont mention!!??
partition erase and partition write DOES NOT WORK [SOLVED]
partition erase and partition write DOES NOT WORK [SOLVED]
Last edited by dmaxben on Thu May 07, 2020 2:14 pm, edited 1 time in total.
Re: partition erase and partition write DOES NOT WORK
esp_partition_find_first
Re: partition erase and partition write DOES NOT WORK
The first argument of esp_partition_erase_range() takes a pointer to a partition structure. I'm surprised this didn't fail with a compiler error, but maybe it only issues a warning? Recommend always checking for compiler warnings if something isn't working like you expect.
There are a few partition API examples included with ESP-IDF, this one shows the sequence of function calls to erase part of a partition:
https://github.com/espressif/esp-idf/bl ... main.c#L27
(Note this is master branch, but this API is the same in ESP-IDF v4.0 & v3.3.)
There is some more information about the partition table API here:
https://docs.espressif.com/projects/esp ... -table-api
Re: partition erase and partition write DOES NOT WORK
Well I feel like a complete idiot!!
I was indeed not using the pointer to the partition struct correctly....
Im surprised it compiled and let me build it...
but once I did find partition to get the pointer, then it worked!
Thanks so much for the help everyone, much appreciated!
I was indeed not using the pointer to the partition struct correctly....
Im surprised it compiled and let me build it...
but once I did find partition to get the pointer, then it worked!
Thanks so much for the help everyone, much appreciated!
Who is online
Users browsing this forum: No registered users and 125 guests