Skip to main content
bfran.1
Associate III
March 3, 2021
Question

How select address for I2C multislave stm32l4 in interrupt callback ?

  • March 3, 2021
  • 0 replies
  • 459 views

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

  •  

This topic has been closed for replies.