cancel
Showing results for 
Search instead for 
Did you mean: 

I2C errors handling in EFT

sireevenkat1
Senior

 

Hi,I am working with stm32g491re.I am communicating with TCA9537(Ioexpander) from stm32 through I2C. It will control a realy. For my product EFT(Electrical Fast Transient) testing, After starting EFT teat relay getting turned off and not recovering.

Through oscilloscope we observed, after EFT test,sclk and sda lines not recovering

Io expander it self resetting.master and slave both side issues are there.so I tried below code.

So i modified the code.

 

 

 

void ioexpandercheck(){ 

		uint8_t check[1]; 

		HAL_StatusTypeDef status=tca9537_read(&hmcp, TCA9537_REGISTER_INPUT,check); 

		HAL_Delay(10); 

		if(status!=HAL_OK){ 

			HAL_I2C_DeInit(&hi2c3); 

			HAL_Delay(10); 

			HAL_I2C_Init(&hi2c3); 

			HAL_Delay(50); 

			HAL_GPIO_WritePin(GPIOB, GPIO_PIN_2, 0); 

			HAL_Delay(5); 

			HAL_GPIO_WritePin(GPIOB, GPIO_PIN_2, 1); 

			HAL_Delay(5); 

			tca9537_init(&hmcp, &hi2c3, TCA9537_I2C_ADDR); 

			tca9537_iodir(&hmcp, TCA9537_CONFIG_IO12_OUTPUT); 



		} 

} 

 

Here continuously I am reading the expander pin if read is not ok I am resetting both I2C and ioexpander and reinitializing the ioexpander. With this i can able to recover the relay operation in EFT but its not stable.
In above ioexpander reset i done using reset pin of ioexpander.Which is not part of our present h/w set up.We made it now gor testing is there any other way can we reset instead of using reset pin.

 

In datasheet also they mentioned how to do with software.but i am conused about implementation.

Since I am reinitializing the i2c in above code,i2c lines are active so,can I do softreset
Can anyone suggest.

sireevenkat1_0-1724937646761.png

 

uint8_t reset_command = 0x06;  
HAL_StatusTypeDef status = HAL_I2C_Master_Transmit(&hi2c3, 0x00, &reset_command, 1, 100);

 

Thanks

0 REPLIES 0