I2C Master operation inside GPIO interrupt handler

Showing results for 
Search instead for 
Did you mean: 

I2C Master operation inside GPIO interrupt handler

Contributor III

Hi @Kan_Li,

I am using PN7462 in my system. On the I2CM bus of PN7462 and one of them is the BMA accelerometer. Now in the use case, it is important to clear BMA to interrupt as soon as possible for catching the next interrupt and make the interrupt line ideal.

For achieving the above goal we took an approach where whenever a GPIO interrupt occurs we read the status of the BMA interrupt register(1Byte register) within the interrupt handler. But in doing so controller restarts every time. Below is a snippet of the interrupt handler routine for our development.


void GPIO_12_IRQHandler( void )
	phHal_Nvic_ClearPendingInterrupt( 1U << ( PHHAL_NVIC_GPIO_12_Isr ) );

	uint32_t ulRegValue = 0;
	char usI2C_Address = 0x19;
	uint32_t ulValue = 0x1C;
	tHAL_I2CM_Write( usI2C_Address, (uint8_t *)&ulValue, 1 );
	tHAL_I2CM_Read( usI2C_Address, (uint8_t *)&ulRegValue, 1 );


Is there any reason why PN7462 is restarting in this situation?

0 Kudos
1 Reply

NXP TechSupport
NXP TechSupport

Hello Jayesh,
We appreciate your preference for our products.

Could you please test this by using our functions available in the SDK, this will help us clarify if misbehaviour is happening while performing this sequence. This test might also be helpful for you by debugging the function and following the executions.

I hope this helps in the creation of your application!

Best Regards,