This week I worked on flash programming. Previously I managed to use flash driver to accomplish erase and write operations. However, the library does not include a read functionality. The code was still using NVM library to perform a read operation. I came up with a function to perform a flash read without the NVM library. It basically reads the physical address on the memory and saves it to a variable.
The code can now receive data over an HTTPS connection and write it to the flash memory and also read it when needed. There is however, a problem during all my testings I was using only a few data and when I tried it with large number of data it crashes. I assume it is because of over-flows. I need to look into that in order to make sure it does not crash with a large data.
The flash write function now also adds a specific string to the end of the data that is being written to the flash. Since the minimum size of a flash write is 4 bytes this string needs to be added to the write buffer before a flash write is performed. This function does that by finding the modulo of the length of data by 4 and adding the data to the end of the buffer.