SMBus on STM32C031
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2024-05-22 12:47 AM
Hi ST tesam,
When I use HAL_SMBUS_Master_Receive_IT( ) to receive data from device ,I can not got the information directly after the HAL_SMBUS_MasterRxCpltCallback( SMBUS_HandleTypeDef *hsmbus ) was complete.
(I had set a flag when HAL_SMBUS_MasterRxCpltCallback( SMBUS_HandleTypeDef *hsmbus ) done)
I had to wait for a while and then I can read data from register, but what can I do to know when the saving process was complete?
Regards,
LSN
Solved! Go to Solution.
- Labels:
-
I2C
-
STM32C0 Series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2024-05-27 1:13 AM
Hello @LsnLeeJW
Could you please try to check the state in the SMBUS handle instead of checking bSMBusRxCpltFlag flag?
Please refer to the snippet code below to implement this solution:
HAL_SMBUS_Master_Receive_IT( &hsmbus1, BATTERY_ADD, &ucCalTemp[ 3 ], dataLength + 1 , SMBUS_LAST_FRAME_NO_PEC );
while (hsmbus1.State == HAL_SMBUS_STATE_MASTER_BUSY_RX);
Saket_Om
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2024-05-22 1:31 AM
Hello @LsnLeeJW and welcome to the community
Could you please provide the source code for this implementation?
Saket_Om
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2024-05-26 11:59 PM
Hello,Omar.
Thank for your reply,I've attached the snippet of the code.
Here I try to use 'HAL_SMBUS_MasterRxCpltCallback' to notify me whether the data was received,but it don't works.Is there a better way for me to know whether the data has been stored in memory?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2024-05-27 1:13 AM
Hello @LsnLeeJW
Could you please try to check the state in the SMBUS handle instead of checking bSMBusRxCpltFlag flag?
Please refer to the snippet code below to implement this solution:
HAL_SMBUS_Master_Receive_IT( &hsmbus1, BATTERY_ADD, &ucCalTemp[ 3 ], dataLength + 1 , SMBUS_LAST_FRAME_NO_PEC );
while (hsmbus1.State == HAL_SMBUS_STATE_MASTER_BUSY_RX);
Saket_Om
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2024-05-27 6:31 PM
It works , thanks for your help.
