I want to store the samples from a analogPin every millisecond. The analog pin resolution is 12 bits, values ranging from 0-4095 so 2 bytes. The external flash size is 1 MB which is 1,000,000 bytes. Hence I should be able to store 500,000 short integers.
How can I use flashee library to do this? I tried experimenting with circular buffer API’s but I ended up with red flashes.
Is there a way to write to flash on the go, instead of specifying a struct and size and passing an address of it into the write() API?
Like FLASH.write(address, data); //where address can range from 0 - 1000000
On P1, with flash->write(addr, value), I am able to write and read from the address 129000. When I choose the address as 130000, the write/read fails.
384 pages @ 4096 bytes each are available in the EEPROM. That’s 1,048,576 bytes.
Two pieces of information to consider from the readme:
The spark external flash has 384 pages, each 4096 bytes in size and is managed as the device provided via the Devices::userFlash() method. Rather than hard-code these page count and page size constants, you can make the code more flexible for future changes by using: Devices::userFlash().pageSize() and Devices::userFlash().pageCount()
At present, the maximum contiguous area that the Wear Leveling and Address Erase schemes can occupy is 1MB (256 pages). This is to keep runtime memory overhead to a minimum.
A workaround is to create 2 devices as shown below in separate regions.