cancel
Showing results for 
Search instead for 
Did you mean: 

How select address for I2C multislave stm32l4 in interrupt callback ?

bfran.1
Associate II

My target is select more slaves in callback I2C RX , I have tryed with

void HAL_I2C_MasterRxCpltCallback(I2C_HandleTypeDef *hi2c)

{

   if (hi2c1.Instance->CR2 & I2C_CR2_SADD == I2C_ADDRESS)

 {

..

...}

}

but don't work !!

When I try to use the field in static void MX_I2C1_Init(void) :

hi2c1.Init.OwnAddress1 = 0xA0; (address slave 1)

.

.

-

hi2c1.Init.OwnAddress2 = 0xA2; (address slave 2)

In this case when i put the filed in callback rx I"C the condition is verified

void HAL_I2C_MasterRxCpltCallback(I2C_HandleTypeDef *hi2c)

{

   if (hi2c1.Init.OwnAddress1 == 0xA0)

 {

..

...}

}

My question is how can addressing 5 slave I have just hi2c1.Init.OwnAdd2 ess1 and

hi2c1.Init.OwnAddress2.

It's very important for my company ,i lost 4 days with no results.

BR.

Francesco

  •  

0 REPLIES 0