fds_init() not work

5287.sdk_config.h

Hi,
I'm developing an application using fds.
I merged fds into ble_app_uart and built complete
But when program run fds_init() nRF was crashed
I called fds_registered before.
What is the reason here ? Thank you
I attached my sdk_config.h
Debug terminal does not show any info about that

Parents Reply Children
  • Hi, Jared
    I have an problem when try to read flash the second time. The first time It show data correctly. And the second time It show FDS_ERR_NOT_FOUND.  May flash is deleted ?.

     

    static void fds_evt_handler(fds_evt_t const *p_fds_evt) {
      switch (p_fds_evt->id) {
      case FDS_EVT_INIT:
        if (p_fds_evt->result != NRF_SUCCESS) {
          NRF_LOG_INFO("init error");
        } else {
          NRF_LOG_INFO("init success");
        }
        break;
      case FDS_EVT_WRITE:
        NRF_LOG_INFO("write done")
        flash_flag = true;
        memset(&ftok, 0x00, sizeof(fds_find_token_t));
        break;
      // case FDS_EVT_READ:
      default:
        break;
      }
    }
    
    int main(){
        
        static char const m_hello[] = "12!";
        record.file_id = FILE_ID;
        record.key = RECORD_KEY_1;
        record.data.p_data = &m_hello;
        record.data.length_words = (sizeof(m_hello) + 3) / 4;
        fds_record_write(&record_desc, &record);
        for(;;){
        
            if (flash_flag) {
          NRF_LOG_INFO("start read flash");
    
          // Read FDS
          // require memset(&ftok, 0x00, sizeof(fds_find_token_t));
         // fds_record_find(FILE_ID, RECORD_KEY, &record_desc, &ftok);
    
          while (fds_record_find(FILE_ID, RECORD_KEY, &record_desc, &ftok) == NRF_SUCCESS) {
            if (fds_record_open(&record_desc, &flash_record) != NRF_SUCCESS) {
              NRF_LOG_INFO("open FDS fail");
            }
    
            NRF_LOG_INFO("data from flash = %s", flash_record.p_data);
            /* Access the record through the flash_record structure. */
            /* Close the record when done. */
            if (fds_record_close(&record_desc) != NRF_SUCCESS) {
              NRF_LOG_INFO("close FDS fail");
            }
          }
    
          nrf_delay_ms(2000);
    
          // flash_flag = false;
        }
        
        }
        }

  • Hi,

    Do you reprogram the chip between or do you only reset it?

    regards

    Jared 

  • When I use debug terminal and use restart button" <- " at top-right. After I restart I got more data. The sencond start I got 2 time successfully and 3th time will return like as I mentiond above "FDS_ERR_NOT_FOUND". And so on, in third start, I got 3 time successfully and 4th return FDS_ERR_NOT_FOUND.

    Please clarify for me what is the purpose of FILE_ID, RECORD_ID, page. Thank you

  • Pham Tam said:
    Please clarify for me what is the purpose of FILE_ID, RECORD_ID, page. Thank you

    This is explained here.

    Could you share a minimal example that would reproduce this on a development kit?

    regards

    Jared 

Related