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

Driver Error Interpretation

Hi Nordic, 

how do i interpret properly return errors? I l know that it depends on the base address but sometimes it does not correlate at all. 

For example, currently the nrfx_spim_xfer() function returns a 16 = 0x10 as an error but this does not correlate to any error on the list. I assume it's the NRFX_ERROR_INVALID_ADDR. 

However, this one is defined as:  NRFX_ERROR_INVALID_ADDR = (NRFX_ERROR_BASE_NUM + 10), ///< Bad memory address.

That 10 does not  seam to be in hex, but in decimal, so it won't correspond to the same error. Does it? 

Maybe I'm totally off here but it's a question that I've had for a long time now. 

I'm working with the sdk 15.3

Thanks in advance.

Parents
  • Hi,

    The errors are defined in the nrfx glue layer (integration\nrfx\nrfx_glue.h) in the SDK:

    #ifndef NRFX_CUSTOM_ERROR_CODES
    
    #include <sdk_errors.h>
    /**
     * @brief When set to a non-zero value, this macro specifies that the
     *        @ref nrfx_error_codes and the @ref ret_code_t type itself are defined
     *        in a customized way and the default definitions from @c <nrfx_error.h>
     *        should not be used.
     */
    #define NRFX_CUSTOM_ERROR_CODES 1
    
    typedef ret_code_t nrfx_err_t;
    
    #define NRFX_SUCCESS                    NRF_SUCCESS
    #define NRFX_ERROR_INTERNAL             NRF_ERROR_INTERNAL
    #define NRFX_ERROR_NO_MEM               NRF_ERROR_NO_MEM
    #define NRFX_ERROR_NOT_SUPPORTED        NRF_ERROR_NOT_SUPPORTED
    #define NRFX_ERROR_INVALID_PARAM        NRF_ERROR_INVALID_PARAM
    #define NRFX_ERROR_INVALID_STATE        NRF_ERROR_INVALID_STATE
    #define NRFX_ERROR_INVALID_LENGTH       NRF_ERROR_INVALID_LENGTH
    #define NRFX_ERROR_TIMEOUT              NRF_ERROR_TIMEOUT
    #define NRFX_ERROR_FORBIDDEN            NRF_ERROR_FORBIDDEN
    #define NRFX_ERROR_NULL                 NRF_ERROR_NULL
    #define NRFX_ERROR_INVALID_ADDR         NRF_ERROR_INVALID_ADDR
    #define NRFX_ERROR_BUSY                 NRF_ERROR_BUSY
    #define NRFX_ERROR_ALREADY_INITIALIZED  NRF_ERROR_MODULE_ALREADY_INITIALIZED
    
    #define NRFX_ERROR_DRV_TWI_ERR_OVERRUN  NRF_ERROR_DRV_TWI_ERR_OVERRUN
    #define NRFX_ERROR_DRV_TWI_ERR_ANACK    NRF_ERROR_DRV_TWI_ERR_ANACK
    #define NRFX_ERROR_DRV_TWI_ERR_DNACK    NRF_ERROR_DRV_TWI_ERR_DNACK
    
    #endif // NRFX_CUSTOM_ERROR_CODES

    The error codes in the SDK are defined in SoftDevice Global Error Codes.

    The default value for NRFX_ERROR_INVALID_ADDR if NRFX is used as a standalone driver library would be 0x0BAD0000 + 10 = 0x0BAD000A.

    Best regards,
    Jørgen

Reply
  • Hi,

    The errors are defined in the nrfx glue layer (integration\nrfx\nrfx_glue.h) in the SDK:

    #ifndef NRFX_CUSTOM_ERROR_CODES
    
    #include <sdk_errors.h>
    /**
     * @brief When set to a non-zero value, this macro specifies that the
     *        @ref nrfx_error_codes and the @ref ret_code_t type itself are defined
     *        in a customized way and the default definitions from @c <nrfx_error.h>
     *        should not be used.
     */
    #define NRFX_CUSTOM_ERROR_CODES 1
    
    typedef ret_code_t nrfx_err_t;
    
    #define NRFX_SUCCESS                    NRF_SUCCESS
    #define NRFX_ERROR_INTERNAL             NRF_ERROR_INTERNAL
    #define NRFX_ERROR_NO_MEM               NRF_ERROR_NO_MEM
    #define NRFX_ERROR_NOT_SUPPORTED        NRF_ERROR_NOT_SUPPORTED
    #define NRFX_ERROR_INVALID_PARAM        NRF_ERROR_INVALID_PARAM
    #define NRFX_ERROR_INVALID_STATE        NRF_ERROR_INVALID_STATE
    #define NRFX_ERROR_INVALID_LENGTH       NRF_ERROR_INVALID_LENGTH
    #define NRFX_ERROR_TIMEOUT              NRF_ERROR_TIMEOUT
    #define NRFX_ERROR_FORBIDDEN            NRF_ERROR_FORBIDDEN
    #define NRFX_ERROR_NULL                 NRF_ERROR_NULL
    #define NRFX_ERROR_INVALID_ADDR         NRF_ERROR_INVALID_ADDR
    #define NRFX_ERROR_BUSY                 NRF_ERROR_BUSY
    #define NRFX_ERROR_ALREADY_INITIALIZED  NRF_ERROR_MODULE_ALREADY_INITIALIZED
    
    #define NRFX_ERROR_DRV_TWI_ERR_OVERRUN  NRF_ERROR_DRV_TWI_ERR_OVERRUN
    #define NRFX_ERROR_DRV_TWI_ERR_ANACK    NRF_ERROR_DRV_TWI_ERR_ANACK
    #define NRFX_ERROR_DRV_TWI_ERR_DNACK    NRF_ERROR_DRV_TWI_ERR_DNACK
    
    #endif // NRFX_CUSTOM_ERROR_CODES

    The error codes in the SDK are defined in SoftDevice Global Error Codes.

    The default value for NRFX_ERROR_INVALID_ADDR if NRFX is used as a standalone driver library would be 0x0BAD0000 + 10 = 0x0BAD000A.

    Best regards,
    Jørgen

Children
No Data
Related