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

TWI Driver and SVC Handler Missing Error

Hello,

I seem to be having some errors with my current project. I am using SoftDevice S310 Version 3.0 and SDK 9.0. When i try to communicate with one of my I2C sensors I get an SVC Handler Missing Error (0x01). This doesn't appear to be a valid error code for the TWI functions.

Here is my initialization and transfer:

uint32_t err_code;

static const nrf_drv_twi_config_t twi_config = {
                                                .frequency = NRF_TWI_FREQ_400K,
					                            .scl = I2C_SCL,
					                            .sda = I2C_SDA,
				                                .interrupt_priority = APP_IRQ_PRIORITY_LOW
                                               };
err_code = nrf_drv_twi_init(&twi, &twi_config, NULL);
APP_ERROR_CHECK(err_code);
																							 
nrf_drv_twi_enable(&twi);

err_code = nrf_drv_twi_tx(&twi, 0x68, rtc_data_reg, sizeof(rtc_data_reg), true);
APP_ERROR_CHECK(err_code);

err_code = nrf_drv_twi_rx(&twi, 0x68, rtc_data, sizeof(rtc_data), false);
APP_ERROR_CHECK(err_code);

Does anyone have any explanation for what could cause the nrf_drv_twi_tx and nrf_drv_twi_rx functions to return with the SVC Handler Missing Error?

Thanks for any solutions you can help me reach,

Cory

  • This is because nrd_drv_twi.c uses CRITICAL_REGION_ENTER and CRITICAL_REGION_EXIT macros. You should include components\libraries\util\app_util_platform.h file for this

    These two macros have softdevice specific implementation if the softdevice is present. Seems like you have used some project template example which has SOFTDEVICE_PRESENT set in keil-> Target options->C/C++ ->Define, remove it if you are not using softdevice

  • Hi,

    I am having a similar problem as

    devzone.nordicsemi.com/.../

    where I am getting a ret code of 0x1 (NRF_ERROR_SVC_HANDLER_MISSING) from nrf_drv_twi_tx.

    But then it transitioned to

    0x3 (NRF_ERROR_INTERNAL), internal error.

    when I included "app_util_platform.h"

    What could be causing this?

    I am communicating to a TPS65185 PMIC and other transactions are successfully until we get to this specific one. I am not sure what is causing this fatal error in the Soft Device. I have successfully brought up many I2C devices with the same configuration.

    I am using gcc with soft device S130 v1.0.0.

    Code below:

    UINT8 readReg(UINT8 i2c_addr, UINT8 register_address,  UINT8* data)
    {
        ret_code_t transfer_succeeded;
        transfer_succeeded = nrf_drv_twi_tx(&m_twi,i2c_addr, &register_address, ONE_BYTE, TWI_ISSUE_STOP);
        transfer_succeeded &= nrf_drv_twi_rx(&m_twi, i2c_addr, data, ONE_BYTE, TWI_ISSUE_STOP);
        return transfer_succeeded;
    
    }
    
  • you should first try to investigate for which SVC call you are getting NRF_ERROR_SVC_HANDLER_MISSING

Related