When communicating with twi in ble_app_NUS, error code 0x00000011 occurs.

hello,

To use twi communication in ble_app_NUS, I configured the program by referring to the twi_sensor example.

As you can see in the source code below, when the BSP_EVENT_KEY_0 event occurs, in void bsp_event_handler(bsp_event_t event)

nrf_drv_twi_tx(&m_twi, TOUCH_ADDR, TWI_reg, sizeof(TWI_reg), false); It was configured to call .


void twi_init (void)
{
    ret_code_t err_code;

    const nrf_drv_twi_config_t twi_config = {
       .scl                = I2C_CLK_PIN_NUMBER,
       .sda                = I2C_DATA_PINNUMBER,
       .frequency          = NRF_DRV_TWI_FREQ_100K,
       .interrupt_priority = APP_IRQ_PRIORITY_HIGH,
       .clear_bus_init     = false
    };

    err_code = nrf_drv_twi_init(&m_twi, &twi_config, twi_handler, NULL);
    APP_ERROR_CHECK(err_code);

    nrf_drv_twi_enable(&m_twi);
}


void bsp_event_handler(bsp_event_t event)
{
    uint32_t err_code;

    switch (event)
    {

        case   BSP_EVENT_ADVERTISING_STOP :
         
            printf("> BSP_EVENT_ADVERTISING_STOP\r\n");
           

            break;

        case BSP_EVENT_KEY_0 :


            err_code = nrf_drv_twi_tx(&m_twi, PIC_TOUCH_ADDR, TWI_reg, sizeof(TWI_reg), false);
            APP_ERROR_CHECK(err_code);

           
             break;
}

However, when nrf_drv_twi_tx is called, error 0x00000011 occurs and the fault function below is called.

__WEAK void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info)

I do not know the cause of error 0x00000011.

Parents Reply Children
No Data
Related