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

BLE + FDS Problem to read/write FDS

Hello there;

My setup: 

NRF52832
SDK 15.3

I'm facing some problems with FDS when i use it with BLE activated.

When i read or write on FDS using fds_record_open or fds_record_update with BLE activated i get fatal erros.
But if i dont initialize the BLE the FDS operates normal without any errors.

Some one have any advice about it? I just need to read the FDS on the initialization of the device and write in flash one or two times while the application runs.

Debug:

<info> app: Fast advertising.
<info> app: Event: FDS_EVT_INIT received (FDS_SUCCESS)
(After FDS INIT i try to read the FDS)
<error> app: Fatal error

My BLE Init:

void ble_init(void) {
    bool erase_bonds;
    ble_conn.sts.disconnected = 1;

    log_init();
    timers_init();
    power_management_init();
    ble_stack_init();
    gap_params_init();
    gatt_init();

    services_init();
    advertising_init();
    
    conn_params_init();
    peer_manager_init();

    NRF_LOG_INFO("Modelo esta sendo executado.");
    application_timers_start();

    advertising_start(erase_bonds);
}

FDS init:

void init_flash_fds(void) {
   ret_code_t rc;    
   // Registro p/ receber evento de quanto a inicialização está completa
   (void) fds_register(fds_evt_handler);
   // Inicia flash FDS    
   rc = fds_init();
   APP_ERROR_CHECK(rc);
   // Aguarda o FDS inicializar
   wait_for_fds_ready();    
   // Analisa estado do FDS
   fds_stat_t stat = {0};
   rc = fds_stat(&stat);

}

Parents
  • Hi,

    Can you build the application with the debug configuration, or with the DEBUG and DEBUG_NRF preprocessor symbols defined? That should help you get the exact error code and location of the error output on the log.

    Are you using the softdevice backend for FDS, and not the NVMC backend? The NVMC backend will generate a softdevice assert when trying to write/erase flash.

    Best regards,
    Jørgen

  • Hello Jørgen,

    At first ty for your support!

    I built the application with DEBUG and DEBUG_NRF and i got this output at my first writing:

    <info> app: Modelo esta sendo executado.
    <info> app: Fast advertising.
    <info> app: Event: FDS_EVT_INIT received (FDS_SUCCESS)
    <info> app: Escrevendo config file...
    <info> app: Event: FDS_EVT_WRITE received (FDS_SUCCESS)
    

    Then i restarted the device and got the error as you can see below:

    <info> app: Modelo esta sendo executado.
    <info> app: Fast advertising.
    <info> app: Event: FDS_EVT_INIT received (FDS_SUCCESS)
    <info> app: Encontrado Records
    <error> app: ERROR 13 [NRF_ERROR_TIMEOUT] at C:\Users\W7Pro\Desktop\Nordic_Workspace\#1_Dev\#99_EVK-ANNA-B112\BLE - Servico custom\Components\Src\Flash_FDS.c:271
    PC at: 0x0002BA8F
    <error> app: End of error report
    
    

    The line 271 represents my call of the function fds_record_open.

             rc = fds_record_find(FLASH_ID, FLASH_REC_KEY, &record_desc, &ftok);
    
             if (rc == FDS_SUCCESS)
             {
               NRF_LOG_INFO("Encontrado Records");
               //  if(!flash_mngt.ilk_fds_read) {
                 // Atualização do arquivo de config da Flash
                 fds_flash_record_t config = {0};
            
                 // Leitura Flash - Abre a flash FDS e le o conteudo
     >>>         rc = fds_record_open(&record_desc, &config);
                 APP_ERROR_CHECK(rc);
    

    About the use of the softdevice backend for FDS im using the SD:

    #define FDS_BACKEND 2


    I don't know why but the error of opening the fds is happening only when i use the device as a central.

    Best regards;

Reply
  • Hello Jørgen,

    At first ty for your support!

    I built the application with DEBUG and DEBUG_NRF and i got this output at my first writing:

    <info> app: Modelo esta sendo executado.
    <info> app: Fast advertising.
    <info> app: Event: FDS_EVT_INIT received (FDS_SUCCESS)
    <info> app: Escrevendo config file...
    <info> app: Event: FDS_EVT_WRITE received (FDS_SUCCESS)
    

    Then i restarted the device and got the error as you can see below:

    <info> app: Modelo esta sendo executado.
    <info> app: Fast advertising.
    <info> app: Event: FDS_EVT_INIT received (FDS_SUCCESS)
    <info> app: Encontrado Records
    <error> app: ERROR 13 [NRF_ERROR_TIMEOUT] at C:\Users\W7Pro\Desktop\Nordic_Workspace\#1_Dev\#99_EVK-ANNA-B112\BLE - Servico custom\Components\Src\Flash_FDS.c:271
    PC at: 0x0002BA8F
    <error> app: End of error report
    
    

    The line 271 represents my call of the function fds_record_open.

             rc = fds_record_find(FLASH_ID, FLASH_REC_KEY, &record_desc, &ftok);
    
             if (rc == FDS_SUCCESS)
             {
               NRF_LOG_INFO("Encontrado Records");
               //  if(!flash_mngt.ilk_fds_read) {
                 // Atualização do arquivo de config da Flash
                 fds_flash_record_t config = {0};
            
                 // Leitura Flash - Abre a flash FDS e le o conteudo
     >>>         rc = fds_record_open(&record_desc, &config);
                 APP_ERROR_CHECK(rc);
    

    About the use of the softdevice backend for FDS im using the SD:

    #define FDS_BACKEND 2


    I don't know why but the error of opening the fds is happening only when i use the device as a central.

    Best regards;

Children
No Data
Related