You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This should read: if (_submittedAddress + size > _chip.capacity) {
Say we have a chip with capacity 12 bytes. We want to erase the last quarter of the flash. So we erase from address 9 and we erase 3 bytes. So we erase bytes 9, 10 and 11. Using the above formula one would get that 9 + 3 >= 12 will be true, and prevent us from erasing. The problem is one should add size-1 to the address to get the last address. And the last address may not be equal to the capacity of the chip. The last addressable byte is capacity-1. So in other words a valid addressing is where address + (size-1) <= (capacity-1). Or in other words address + size <= capacity. So the invalid case is therefore where address + size > capacity.
The text was updated successfully, but these errors were encountered:
SPIMemory/src/SPIFlashIO.cpp
Line 57 in 1f1e4de
This should read:
if (_submittedAddress + size > _chip.capacity) {
Say we have a chip with capacity 12 bytes. We want to erase the last quarter of the flash. So we erase from address 9 and we erase 3 bytes. So we erase bytes 9, 10 and 11. Using the above formula one would get that 9 + 3 >= 12 will be true, and prevent us from erasing. The problem is one should add size-1 to the address to get the last address. And the last address may not be equal to the capacity of the chip. The last addressable byte is capacity-1. So in other words a valid addressing is where address + (size-1) <= (capacity-1). Or in other words address + size <= capacity. So the invalid case is therefore where address + size > capacity.
The text was updated successfully, but these errors were encountered: