Hello,
I'm using ESP-IDF v3.3 and i need to get the actual flash size because i have 2 different boards, some with 4MB flash and others with 8MB.
I tried some API functions but none of them really helped me
spi_flash_get_chip_size() only return the size configured in the menuconfig (8MB in my case).
If I try to read the flash memory with spi_flash_read() at the address 0x7F0000, for example (which is outside 4MB), it doesn't return me any error on the board with 4MB. But 0x7F0000 shouldn't be able to be readable as long a it is outside memory, isn't it ?.
So i tried erasing the sector 1023 with spi_flash_erase_sector() on the 4MB board, it succeeded as it should. Then i tried to erase the sector 2047 and it failed, as it should.
For the moment the only way to check if my board is a 4MB or a 8MB is to erase a sector which shouldn't exist on the 4MB board, but i think it's really risky.
It must exist another way to get the actual flash size because esptool.py manage to do it.
Thanks for your help
How to get the actual flash size
-
- Posts: 75
- Joined: Fri Dec 04, 2020 9:56 pm
Re: How to get the actual flash size
Reifircax wrote: If I try to read the flash memory with spi_flash_read() at the address 0x7F0000, for example (which is outside 4MB), it doesn't return me any error on the board with 4MB. But 0x7F0000 shouldn't be able to be readable as long a it is outside memory, isn't it ?.
Work with partition table API instead.
Who is online
Users browsing this forum: Baidu [Spider] and 117 guests