2024-01-07 11:32 PM
hii,
i am using stm32 nucleo g0-b1re i am trying to receive data in interrupt mode, but cant figure out what is wrong, i am new to stm32 i2c protocol.
i have used master as nucleo-h743zi2 and transmitting data, but it is not showing anything on minicom.
2024-01-08 1:55 AM - edited 2024-01-08 1:57 AM
Hello @Rohit007,
Try this code :
/* USER CODE BEGIN 2 */
/*##- Put I2C peripheral in reception process ###########################*/
if (HAL_I2C_Slave_Receive_IT(&hi2c1, (uint8_t *)aRxBuffer, RXBUFFERSIZE) != HAL_OK)
{
/* Transfer error in reception process */
Error_Handler();
}
/*##- Wait for the end of the transfer ###################################*/
/* Before starting a new communication transfer, you need to check the current
state of the peripheral; if it�s busy you need to wait for the end of current
transfer before starting a new one.
For simplicity reasons, this example is just waiting till the end of the
transfer, but application may perform other tasks while transfer operation
is ongoing. */
while (HAL_I2C_GetState(&hi2c1) != HAL_I2C_STATE_READY)
{
}
/* USER CODE END 2 */
Best Regards,
Pierre
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-01-08 2:02 AM
actually it is not receiving a single bit of data, it is not entering into address callback function.
2024-01-08 2:07 AM - edited 2024-01-08 2:09 AM
Are you aware of this article? It explains what is I2C is and how to use it through examples.
I advise you to read it if you are new to stm32 I2C protocol. :)
What is your application ? Who is the master ?
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-01-08 3:07 AM
my application is to read variable amount of data sent by the master. my master is nucleo- h743zi2 it is sending data of variable amount, i.e. if i send 5 byte my slave should read only that much data or if 10 bytes, slave should be ready to read that too.
2024-01-08 6:32 AM
Use a logic analyzer to understand what is happening on the line.
2024-01-09 5:03 AM - edited 2024-01-09 5:05 AM
Hello @Rohit007,
Here are some remark about what may happen :
Best Regards,
Pierre
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-07-02 4:19 PM
Hi Rohit,
Can you please tell me how you implemented this? I've been trying to receive variable data automatically, without defining the number of bytes to receive each time.
We’re moving the ST Community to a new platform to give you a better and more reliable community experience.