Hello,
i'm sorry for asking again, but i read nearly all threads about I2C and didn't get any answer yet.
I want to use the interrupt to control the I2C sequences and safe energy (instead of using while loops)
I replaced the NRF_TWI1->INTENSET.... with sd_app function below... If i start a transmition it never goes into the handler or generates an event. can anybody tell me why?
Is the NVIC_ENABLEIRQ right to use? in the end i have the usual handler.
void init_TWI1()
{
//I2C Init start
uint32_t err_code;
NVIC_EnableIRQ(SPI1_TWI1_IRQn);
NRF_GPIO->PIN_CNF[1] = 0x60C;
NRF_TWI1->PSELSCL = 0; //P0 als SCL
NRF_TWI1->PSELSDA = 1; //P1 als SDA
NRF_TWI1->FREQUENCY = 0x06680000; //Frequenz = 400kHz
err_code = sd_ppi_channel_assign(0,
&(NRF_TWI1->EVENTS_BB),
&(NRF_TWI1->EVENTS_TXDSENT));
//I2C init end
}
void SPI1_TWI1_IRQHandler(void)
{
if(NRF_TWI1->EVENTS_RXDREADY != 0)
{
NRF_TWI1->EVENTS_RXDREADY = 0;
}
if(NRF_TWI1->EVENTS_TXDSENT != 0)
{
NRF_TWI1->EVENTS_TXDSENT = 0;
}
if(NRF_TWI1->EVENTS_BB != 0)
{
sd_app_evt_wait();
NRF_TWI1->EVENTS_BB = 0;
}
}