This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Use of FStorage causing failure of ADC timer used by the soft device

I am running into a very perplexing issue on my custom board involving use of fStorage and the soft device. When I attempt to write to flash memory using fStorage API (using the soft device), any writes over 444 bytes is seemingly having a cascading effect on other areas of my code using the soft device. For example, I have a ADC sampler going in the background, and once this function below is called, the ADC values are no longer accurate (become zero at all times). 

I initially thought it might be a memory overrun, but any write over 444 fails. The test code below is attempting to write a buffer sized 620. Ive tried almost every size above 444, and each have the same cascading failure effect (including the actual size of 620). Anything below writes to memory without issue...

Here is some example test code which has the aformented behavior. I am pretty stumped as to why this is causing an issue elsewhere. Can anyone tell me what is wrong with it? Other than this instance, I have been using fStorage for months without problems.

#define SIZEOF_Configuration_BYTES 620
uint8_t m_dummy[SIZEOF_Configuration_BYTES] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
uint32_t r = nrf_fstorage_write(&fstorage, row_address, (uint8_t *) &m_dummy,444, NULL);

I appreciate any and all help. Thank you!

Parents
  • Hi,

    I cannot say exactly what happens with your SAADC samples without knowing more. However, an important point that may be related to this is that the CPU is halted while flash erase of write operations are ongoing. Any interrupts will not be processed until after the flash write operation has happened. I do not know if this is the case in your firmware, but if you for instance should handle SAADC samples by the CPU in between, but a timer triggers sampling again, then you could see problems.

  • Einar-- thank you for the response. Does the size I am trying to write/erase ring any bells for you? I am fairly confident the erase process is not causing issues, as prior to each write I erase an entire page of flash memory. I wouldnt think this would be an issue, so I started thinking about the write operation. Is a write operation more intensive than an erase process, and if so, does the size where the write becomes an issue ring a bell for you? I am just trying to figure out the corrolation here, as it is a very odd issue.

Reply
  • Einar-- thank you for the response. Does the size I am trying to write/erase ring any bells for you? I am fairly confident the erase process is not causing issues, as prior to each write I erase an entire page of flash memory. I wouldnt think this would be an issue, so I started thinking about the write operation. Is a write operation more intensive than an erase process, and if so, does the size where the write becomes an issue ring a bell for you? I am just trying to figure out the corrolation here, as it is a very odd issue.

Children
Related