Skip to main content
Renesas Singapore - Knowledgebase

I'm a Bit Confused about Code and Data Flash. For example, how do I count write cycles?

Latest Updated:06/16/2016


How do I count write cycles for code and data flash?


You need to make a distinction between data and code flash. 

For example, on the S7G2, the first 8 blocks of code flash are 8KB in size and after that, each block is 32KB. A block is the  smallest unit of erasure (write). The minimum unit you can write is 256 bytes. If you write less, the line will still have to be erased before writing to the rest of it. Even if you write only 128 bytes and then wish to access the other 128 bytes, the Flash Control Unit checks if the entire line is erased before proceeding to write. You cannot write to the same unit (256 bytes) more than once between erases, since the flash the bits can only by toggled one way (the other way is done only through erase). 

Data flash is made of 64 byte blocks and the minimum you can write is 4 bytes. It follows the same rules as described above for the code flash. Renesas guarantees at least 125,000 write-erase cycles on the data flash region for the S7G2. The number of erases is the most important value when it comes to write-erase cycles. You can write to 16 4-byte chunks (i.e. 16 writes) and erase one block (64 bytes) and this is still considered one write-erase cycle.

Suitable Products