NVM write

This week I started on integrating the code and finalizing all the functions so that later on I can include them as libraries in my code. I also worked on writing the bit stream on the flash which will be done using a PUT command and also reading it from the flash which is done using a HEAD command in CORS protocol. The RNG and HMAC and HOTP functions are all completed. I have also listed some of the error and successful responses that are supposed to be sent.

The problem that I faced this week was that in order to write to the flash, I am using the NVM library functions and by default, the write operation writes to the flash in rows (2048 bytes). The issue comes when one tries to write to the flash while receiving the data from a different source, the receiver buffer might not be large enough or the data received is shorter than the buffer size.  This will result in empty bytes on the flash which can cause a problem. Based on the data sheet, it should also be possible to write to the flash in words (for our case 4 bytes) and quad words (for our case 16 bytes). I was investigating to see if it is possible to write to the flash in words or quad-words. This operation is controlled using the programming control register: NVMOP<3:0>: NVM Operation bits. The value in this register verifies that currently the write operation is in default mode and it will write a row. I tried changing the value just to check if I can write anything less than a row but it does not behave expectedly. Therefore, I need to spend a little more time to test a few more things.

You may also like...

Leave a Reply