Flash memory size

The RP2040 auto-detects its flash memory size on powerup (assuming you are using an IC that supports the method it uses).

Max flash size: 16MB (128Mbit)

Using flash memory for data storage

The entire memory is readable and writable from code. Your program is stored from address 0x00000000. The free area after it is available for data storage.

Writing flash memory

FLASH_SECTOR_SIZE is 4K / 4096 bytes (min amount to erase)

FLASH_PAGE_SIZE is 256 bytes (min write size)

Erasing resets all bits to 1 (0xFF bytes). Programming is the act of flipping zero bits from 1 to 0. So in theory, you could program a page multiple times to program less than 256 byte values at once, and simply have all bytes you are not attempting to program set to 0xFF in the buffer you are programming from. As you are not re-writing previously written 0’s, no additional wear will occur for each additional write on the same page.

USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.

Comments

Your email address will not be published. Required fields are marked *