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

what does the 0x40000000 error of sd_app_evt_wait() mean?

I'm using FDS and define record_chunk.length_words 173. system waits for fds operation is finished and in the meanwhile, system sleeps using sd_app_wait(). Then, sd_app_evt_wait() returns 0x40000000. what does this mean?

void fstorage_upsert_data(user_data_t user_data, fds_record_desc_t * p_record_desc) {
NRF_LOG_RAW_INFO("fstorage_write_data \r\n");

fds_record_t record;
fds_record_desc_t record_desc;
fds_record_chunk_t record_chunk;
ret_code_t ret;

if (!user_data.serialize_handler((uint8_t *)m_serialized_words, p_record_desc)) {
    NRF_LOG_RAW_INFO("fstorage_write_data serialize ERROR \r\n");
    return;
}

record_chunk.p_data = m_serialized_words;
record_chunk.length_words = (user_data.data_length_in_byte % 4 == 0) ? (user_data.data_length_in_byte / 4) : (user_data.data_length_in_byte / 4) + 1;
NRF_LOG_INFO("record_chunk.length_words %d\r\n", record_chunk.length_words);NRF_LOG_FLUSH();

record.file_id  = user_data.file_id;
record.key = user_data.record_key;
record.data.num_chunks = 1;
record.data.p_chunks = &record_chunk;
m_fstorage_operating = true;

if (p_record_desc->record_id != 0) { // update already exist record.
    if (fds_record_open(p_record_desc, &flash_record) != FDS_SUCCESS) {
        NRF_LOG_RAW_INFO("fds_record_open error\r\n");
    }

    ret = fds_record_update(p_record_desc, &record);
    NRF_LOG_RAW_INFO("\r\n update already exist record. %d \r\n", p_record_desc->record_id);
} else { // create new record.
    ret = fds_record_write(&record_desc, &record);
    NRF_LOG_RAW_INFO(" create new record.\r\n"); 
}

if (ret != FDS_SUCCESS) {
    NRF_LOG_RAW_INFO("fds_record_write error ret %d \r\n", ret);
}
NRF_LOG_FLUSH();

while(m_fstorage_operating) {
    uint32_t err_code = sd_app_evt_wait();
    app_sched_execute();
    APP_ERROR_CHECK(err_code);
}

if (p_record_desc->record_id == 0) {
    NRF_LOG_RAW_INFO(" create new record. %d \n\r", record_desc.record_id);
    p_record_desc->record_id = record_desc.record_id;
}

NRF_LOG_RAW_INFO("fds_record_write success \r\n");
NRF_LOG_FLUSH();

}
Related