This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Using I2C as GPIO input. CC2541

Other Parts Discussed in Thread: CC2541

Hi.

i am trying to use I2C port as GPIO. two port use as input mode button(low active). so i configured register.

I2CCFG = 0; // disable i2c

I2CWC = 0x80 // GPIO function.

IEN2 = 0x02; // enable p2 interrupt enable

But. interrupt was not generated. and interrupt handler not working.

this is abut i2c interrupt from document

I2C Interrupt

The I2C module has an interrupt line to the CPU to signal that it requires service. The I2C module uses
interrupt number 6, which is also shared with Port 2 inputs; hence, the interrupt routine must also handle
Port 2 interrupts if they are enabled.
For an interrupt request to be generated, IEN2.P2IE must be set to 1. When an interrupt request has
been generated, the CPU starts executing the ISR if there are no higher-priority interrupts pending.
An interrupt is generated from the I2C module when one of the 26 out of 27 possible I2C component states
is entered. The only state that does not cause an interrupt to be generated is state 0xF8, which indicates
that no relevant state information is available. The corresponding I2CCFG.SI flag must be cleared by
software at the end of the ISR.

Thanks.