cancel
Showing results for 
Search instead for 
Did you mean: 

Bidirectional Interrupt based I2C communication is Failing

TheCrimsonKnight
Associate

Hi,

I am trying to communicate between 2 Nucleo boards(Nucleo-F446RE) using I2C in interrupt mode,

  1. when I am sending data from master to slave in Interrupt mode it works fine
  2. But when I try to send the data back from slave to master, it fails and while debugging the Slave it shows HAL_BUSY.

Its been several days but the problem has not been solved since, I would really appreciate your help in this issue

I'm using:

  • Cube MX version 4.1.0.0
  • STM Cube ide version 1.11.2

 

In Master device program I've defined the following in the while loop:

if(HAL_GPIO_ReadPin (GPIOC, GPIO_PIN_13) == GPIO_PIN_RESET)
            {
            Dummy_var++;
            while(HAL_GPIO_ReadPin (GPIOC, GPIO_PIN_13) == GPIO_PIN_RESET)
            {
            for(int i=0; i< RxSIZE; i++){
            TxData[i] = i+Dummy_var;
            }
            }
              //Turn LED ON
            Tx_Function(&hi2c1);
            HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET);
//             while(HAL_I2C_GetState(&hi2c1) != HAL_I2C_STATE_READY){}
            Rx_Function(&hi2c1);
            }
            else
            {
              //Turn LED OFF
              HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET);
              //HAL_I2C_Master_Receive_IT(&hi2c1, slaveADDR, I2C_REGISTERS, 16);
            }



I'm attaching my C code for reference below.

Thanks & Regards

 

0 REPLIES 0