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

Flash Open Error FDS_ERR_CRC_CHECK_FAILED

Dear Sirs,

I am trying to use the FDS Storage Library to store  4word = 16 bytes in to flash.. Which seems to be working fine. No errors and the function is shown below:-

static WriteDriverIDtoFlash(uint8_t DId[static 16])
{
//static uint32_t const m_deadbeef = 0xbeefdead;
// static char const m_hello[] = "Hello, world!";

fds_record_t record;
fds_record_desc_t record_desc;
// Set up record.
record.file_id = FILE_ID;
record.key = RECORD_KEY_1;
record.data.p_data = &DId;
record.data.length_words = 4; /* one word is four bytes. */
ret_code_t rc;
DeleteAllFiles();
nrf_delay_ms(300);
fds_gc();
nrf_delay_ms(300);
rc = fds_record_write(&record_desc, &record);
if (rc != NRF_SUCCESS)
{
NRF_LOG_INFO("Flash Write Error");
}

}

However when i try to read the data i get the following error:-

app: Flash Record Found
<info> app: Flash Open Error FDS_ERR_CRC_CHECK_FAILED

Below is my read function


static ReadDriverIDFromFlash()
{

fds_flash_record_t flash_record;
fds_record_desc_t record_desc;
fds_find_token_t ftok;
/* It is required to zero the token before first use. */
memset(&ftok, 0x00, sizeof(fds_find_token_t));
/* Loop until all records with the given key and file ID have been found. */
while (fds_record_find(FILE_ID, RECORD_KEY_1, &record_desc, &ftok) == NRF_SUCCESS)
{
NRF_LOG_INFO("Flash Record Found");
uint32_t ret_code =fds_record_open(&record_desc, &flash_record);
if (ret_code != NRF_SUCCESS)
{
NRF_LOG_INFO("Flash Open Error %s",fds_err_str(ret_code));


}
//NRF_LOG_INFO("Flash Data Read %x",(*(uint8_t[]*)flash_record.p_data));
NRF_LOG_HEXDUMP_INFO(*(uint8_t*)flash_record.p_data, 16);

/* Close the record when done. */
if (fds_record_close(&record_desc) != NRF_SUCCESS)
{
NRF_LOG_INFO("Flash Close Error");
}
}
}

Please can some one help... I can not find anywhere a solution... I am not sure if I am reading properly... Do i need to tell the flash open how many words to read?

  • Hi

    I think this is because you don't have a delay after the flash write to ensure that the write operation is finished before you try to read from the flash. Please try to add a check/delay after the write to make sure that you're finished with the write operation before calling the read operation.

    Please note that we're entering the summer vacation period here in Norway, so delays must be expected as we are low on staff for the month of July. Sorry about the inconvenience!

    Best regards,

    Simon

  • Thanks for your ans.. but i domt think its related to busy.. as i am testing the read and right functions individualy..

    The read and write work perfect if it is only 1 word. But if the number of words increase...iTs not working..

    With 4 words i can right successfully but can not open file and read.

  • Hi

    When you say that you write 4 words successfully, does that mean that you successfully get the event signaling that the operation is completed? FDS operations involving flash write, read, and erase are asynchronous, which means that a return value of FDS_SUCCESS means that an operation is successfully queued, but not yet performed.

    Best regards,

    Simon

Related