Hi
I'm trying to use the nrfx TWI Slave function with IRQ (No Poll), but there is no clean code available I found.
I'm using the following code:
const nrfx_twis_t m_twis_1_slave = NRFX_TWIS_INSTANCE(1); /**< TWIS slave 1 instance */
#define STEINEL_SENSORS_MY_ADDRESS 0x08
const nrfx_twis_config_t twis_config_1 =
{
.addr = { (STEINEL_SENSORS_MY_ADDRESS >> 1), 0 },
.scl = RJ11_I2C_SCL,
.sda = RJ11_I2C_SDA,
.scl_pull = NRF_GPIO_PIN_NOPULL,
.sda_pull = NRF_GPIO_PIN_NOPULL,
.interrupt_priority = APP_IRQ_PRIORITY_HIGH
};
NVIC_ClearPendingIRQ(SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQn);
NVIC_SetPriority(SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQn, 6);
NVIC_EnableIRQ(SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQn);
ret = nrfx_twis_init(&m_twis_1_slave, &twis_config_1, twis_event_handler);
if (NRF_SUCCESS == ret)
{
printf("twi slave init success\r\n");
nrfx_twis_enable(&m_twis_1_slave);
}
But even if I can see the data on the oscilloscoipe with the address 0x08, the function
static void twis_event_handler(nrfx_twis_evt_t const* const p_event)
never gets triggered. Whats the provblem here? It's not normal to spend hours and days for a I2C slave feature, but without examples its try and error...
Any inputs from Nordic side? Or a example code with IRQ?