I2C Master operation inside GPIO interrupt handler

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

I2C Master operation inside GPIO interrupt handler

ソリューションへジャンプ
2,470件の閲覧回数
jayesh_joshi
Contributor IV

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 )
{
	PH_REG_SET_BIT_WO( PCR_INT_CLR_STATUS_REG , GPIO12_PAD_HIGH_INT_CLR_STATUS );
	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?

タグ(4)
0 件の賞賛
返信
1 解決策
2,288件の閲覧回数
jayesh_joshi
Contributor IV

@Fabian_R 

I did see simmilar behaviour with NXP EVK and function available in SDK. It looks like it casauing due to interrupt collision. We have moved the I2C operation to thread for now as a solution.

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
2,289件の閲覧回数
jayesh_joshi
Contributor IV

@Fabian_R 

I did see simmilar behaviour with NXP EVK and function available in SDK. It looks like it casauing due to interrupt collision. We have moved the I2C operation to thread for now as a solution.

0 件の賞賛
返信
2,407件の閲覧回数
Fabian_R
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,
Fabian