Getting HAL_ERROR while using I2C in Fast mode pulse
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-07 1:52 AM
Hi All,
I trying to interface MAX6651 Device using I2C module using STM32F410C8U6 MCU.
Device address is 0x36 But when i'm using
HAL_FMPI2C_IsDeviceReady(&hfmpi2c1, 0x36 , 2, 100); this API returning the value
HAL_ERROR.
Here are some snaps
 
Anybody look into it send some solutions
 
- Labels:
-
I2C
-
STM32CubeMX
-
STM32F4 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-08 5:16 AM
Hello @Advance_tech,
Thank you for your question.
In the MAX6650 document from Analog Devices you shared, it specified that the rise/fall time should be between 20ns and 300ns (cf the figure below)
But on your CubeMx screenshot, you enter 0 ns, please change it and try again.
Let me know !
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-09 1:17 AM
Hello,
I think I2C start bit not generating.
FMPI2C1->CR1 |= (1 << 0);
FMPI2C1->CR2 |= (1 << 13);
printf("Hi\r\n");
while(!(FMPI2C1->CR2 & (1 << 13)));
printf("Hello\r\n");
program is struct inside the while(1)
after while(1) nothing is executing.
Is there is any chance the I2C Peripheral is gone
please answer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-09 9:58 PM
uint32_t error_code = HAL_FMPI2C_GetError(&hfmpi2c1);
i am getting error code as 2 that means
HAL_FMPI2C_ERROR_ARLO arbitration error
please let me know what are the causes of this error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-13 1:58 AM
Hello @Advance_tech,
Several I2C multi-masters can be connected to the same I2C bus and operate concurrently. By constantly monitoring SDA and SCL for start and stop conditions, they can determine whether the bus is currently idle or not. If the bus is busy, masters delay pending I2C transfers until a stop condition indicates that the bus is free again.
However, it may happen that two masters start a transfer at the same time. During the transfer, the masters constantly monitor SDA and SCL. If one of them detects that SDA is low when it should actually be high, it assumes that another master is active and immediately stops its transfer. This process is called arbitration.
Here some remark :
- Have you corrected the rise/fall time ?
- How many masters does your I2C bus have ?
- Check your data frame with an analyzer if possible
- Do you switch the I2C device on your microcontroller between slave and master mode in your code ?
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-20 2:28 AM
we have single master and two slave devices in I2C line.
HAL_FMPI2C_IsDeviceReady(&hfmpi2c1, max6551_add_2 , 1, 2000);
when i use this API error code is 32 means timeout error
HAL_FMPI2C_Master_Transmit(&hfmpi2c1, i,(uint8_t *)&pdata, sizeof(pdata), HAL_MAX_DELAY);
when i use this API the error code is 2 means arbitration error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-20 2:38 AM
Hello @Advance_tech,
Before I investigate further, can you please confirm you corrected the rise/fall time. (Timeout fault can be the consequence because the slave cannot follow...)
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-20 2:43 AM
hi @Pierre_Paris thanks for quick response
i have given rise time and fall time as 300ns as mentioned in datasheet.
But i don't know how to calculate rise time and fall time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-20 6:46 AM - edited ‎2023-11-20 6:47 AM
Hello @Advance_tech,
300ns is the maximum limit value, please check with 200ns (just in case).
You don't need to calculate rise and fall time. There is, indeed, a calculation with the I2C_TIMINGR but it's unnecessary to do it (tools do). However, if you want to learn more, you can read the chapter 2.2.4 of AN4235 by clicking here.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-21 1:54 AM
Hi @Pierre_Paris i would like to thank for all your responses. i slowly heading into solve the problem.
retval = HAL_FMPI2C_IsDeviceReady(&hfmpi2c1, max6551_add_2, 1, 100);
error_code = HAL_FMPI2C_GetError(&hfmpi2c1);
printf("return value %d\r\n",retval);
HAL_Delay(100);
printf("error code is = %ld\r\n",error_code);
HAL_Delay(100);
Now i getting HAL_BUSY From this HAL_FMPI2C_IsDeviceReady API and error code is 32 which means
HAL_FMPI2C_ERROR_TIMEOUT
please let me know what may cause these problems
