I want to write my String into my flash via SPI Memory library once a second. My String is about 50 bytes. But it's telemetry data so it will change at every loop, so I think I need to write it different addresses. What is this address actually? Can I assign an address as an integer? And how much data can I storage in an address?
int address = 1;
I don't know the exact answer to your question because I know nothing about your device other than it is an 8Mbyte device.
An int wouldn't be my choice for an address, because
a) I can't think of many devices with a signed address space
b) if the address is a byte address, then an int would be insufficient on an AVR (you didn't say which processor you were using), though it may be adequate for a page address.
An address is a unique memory location within the flash memory of the device. The address range starts from 0 and increments by 1 for each successive memory location within the device.
At a very simple level, if you were to write your 50 byte string starting at address 0, then that would write the characters into addresses 0 to 49. Your next string would then be written to addresses 50 to 99 and so on.
There's a bit more to it than that - but that's the basics.
Ok, so KB = kilobyte = 1024 bytes (not 1000!) and therefore 64Kb = 65,536 bytes (64 x 1024). Flash memory is divided up into chunks of various sizes - and these vary (I think!) depending on the storage capacity of the chip. So Erase 64Kb block does what it says, it erases 64Kb of memory. You usually have to tell the chip which 64Kb block you want to erase.
I'm looking at a datasheet now for a flash device and it says it has 4Kb sectors, so a sector holds 4096 bytes. Therefore Erase Sector on this device will erase 4Kb of memory.
Most flash can only write in 256 byte blocks so writing 50 bytes at a time on address 0 then at address 50 a second later is not going to work.
It is better to accumulate the data first to fill a full 256 byte block (that's 5 seconds worth of data), then write it to flash, then you can increment your address pointer to the next block (address 0 to 256)