This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Where to find complete list of SDK error codes?

When my program hits an error returned by an NRF API call, I get a hex number corresponding to that error from the app_error.c:

case NRF_FAULT_ID_SDK_ERROR:
    m_error_data.p_error_info = (error_info_t *)info;
    m_error_data.err_code     = m_error_data.p_error_info->err_code;
    m_error_data.line_num     = m_error_data.p_error_info->line_num;
    m_error_data.p_file_name  = m_error_data.p_error_info->p_file_name;
    printf("sdk error %08x: line %d at %s\r\n",
        m_error_data.err_code, m_error_data.line_num, m_error_data.p_file_name);
    break;

Is there a list of those codes so that I can easily find out what a specific code means? For example, now I get an err_code 0x00000011 and cannot find out what does it mean.

Parents
  • Hi,

    This question is answered here: Table of err_codes.

    Error 0x0011 is defined in nrf_error.h as:

    #define NRF_ERROR_BUSY                        (NRF_ERROR_BASE_NUM + 17) ///< Busy
    

    The nrf_error.h file defines "SoftDevice Global Error Codes". If you need help to figure out why you get the error you will need to post the name of the function that returns the error, and preferably some code that shows how you configure the input parameters that you pass to the function.

Reply
  • Hi,

    This question is answered here: Table of err_codes.

    Error 0x0011 is defined in nrf_error.h as:

    #define NRF_ERROR_BUSY                        (NRF_ERROR_BASE_NUM + 17) ///< Busy
    

    The nrf_error.h file defines "SoftDevice Global Error Codes". If you need help to figure out why you get the error you will need to post the name of the function that returns the error, and preferably some code that shows how you configure the input parameters that you pass to the function.

Children
  • Yes, that was the way I have investigated error codes, but it is pretty difficult. A simple list would be much easier. What comes to that specific error, it is actually that one:

    #define NRF_ERROR_BUSY                        (NRF_ERROR_BASE_NUM + 17) ///< Busy
    

    Because 0x11 is 17 in decimal. And the code that returns the error is:

    nrf_drv_ppi_channel_alloc(&ch);
    nrf_drv_saadc_channel_init(ch, &channel_config);
    

    Any ideas what could be the reason?

  • You are right about the hex number of course. I wasn't thinking. Anyway, it looks like the SDK team forgot to document why nrf_drv_saadc_channel_init() might return NRF_ERROR_BUSY above the function declaration in nrf_drv_saadc.h. However, if you look up the actual function definition in nrf_drv_saadc.c you will see that:

    // A channel can only be initialized if the driver is in the idle state.
    if (m_cb.adc_state == NRF_SAADC_STATE_BUSY)
    {
        return NRF_ERROR_BUSY;
    }
    

    Are you doing anything else with the saadc already? Is this example code from an SDK?

  • Thanks for coment :) The example is not from SDK, but I am trying to sample four ADC channels at a rate of 200 Hz using DMA. Simple to say, but seems like it is quite hard to implement. The rest of related questions and problems are in this thread:

    devzone.nordicsemi.com/.../

    I would appreciate if you can help on that :)

Related