Hi,
In a peripheral, a notification is sent to the central every 10ms. (payload less than 20 bytes)
I use : radio_notification_init(6,NRF_RADIO_NOTIFICATION_TYPE_INT_ON_ACTIVE,NRF_RADIO_NOTIFICATION_DISTANCE_800US);
In radio notification handler, I use uint32_t err_code = sd_ble_gatts_hvx(p_pdo->conn_handle, &hvx_params);
There is no problem until then.
Now I'm developping the I2C (TWIM0). I write in an I2C device every 10ms too.
I use :
static const nrfx_timer_t i2c_timer = NRFX_TIMER_INSTANCE(1) for generate an interrupt every 10ms i2c_timer_cfg.bit_width = NRF_TIMER_BIT_WIDTH_32; i2c_timer_cfg.frequency = NRF_TIMER_FREQ_16MHz; i2c_timer_cfg.interrupt_priority = 6; i2c_timer_cfg.mode = NRF_TIMER_MODE_TIMER; err_code = nrfx_timer_init(&i2c_timer,&i2c_timer_cfg,i2c_timer_process); APP_ERROR_CHECK(err_code); time_ticks = nrfx_timer_ms_to_ticks(&i2c_timer,time_ms); nrfx_timer_extended_compare(&i2c_timer, NRF_TIMER_CC_CHANNEL0, time_ticks, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true); nrfx_timer_enable(&i2c_timer); sd_clock_hfclk_request();I
I2C is working properly.
There is a time shift between the radio notification and the time I write with I2C.
When the I2C write is superimposed when the radio frame is to be sent, I have many of notifications (sd_ble_gatts_hvx) that do not go away result
The result is full of error NRF_ERROR_RESOURCES ... and sometime peripheral lost radio connection !!! (CONN_SUP_TIMEOUT at 4s)
I need to do I2C write at a constant time, so I can't use radio notification to sync.
I think the I2C disrupts the softdevice ! I can see it with a BLE sniffer and Wireshark.
Can someone help me ? It's been 3 days since I try different ways to do. (TWI with nrf_drv_twi or directly bare metal NRF_TWIM0-> ...)
Thanks in advance for your help.
Best regards