cancel
Showing results for 
Search instead for 
Did you mean: 

Getting HAL_ERROR while using I2C in Fast mode pulse

Advance_tech
Associate III

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

Screenshot 2023-11-07 151633.pngScreenshot 2023-11-07 151523.png

Anybody look into it send some solutions

 

12 REPLIES 12
Pierre_Paris
ST Employee

Hello @Advance_tech,

Here some possible solution for your issue :

  • First, can you check the trace scope SCL & SDA ? The slave most likely don't ACK the master (which wait until the end of timeout) and return your "HAL_FMPI2C_ERROR_TIMEOUT" error.
  • What is your STM32F4xx HAL Drivers version ? I checked on the V1.8.0 and there are no such function HAL_FMPI2C_IsDeviceReady(). Please use the last software version and call HAL_I2C_IsDeviceReady().
  • Maybe you are not writing at the good address ? Check your ADD value. 
     

     

    Pierre_P_2-1700583156673.png

     

  • Also, Can you try to write in the component memory with HAL_I2C_Mem_Write() and then read it thanks to HAL_I2C_Mem_Read(). Choose any register existing in the doc.

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.

hello @Pierre_Paris

 

  • We have checked the SDA and SCL signals in scope refer the attached pic.
  • we cannot use HAL_I2C_IsDeviceReady(). because we are using FMPI2C In STM32F410C8U6
    only we can use HAL_FMPI2C_IsDeviceReady().
  • we have connected the 10k to ADD pin so our address becomes the 3ERigolDS10.pngplease refer to waveform only serial clock coming but there is not serial data
  • Is there any chance that IC's I2C peripheral not working???  

     
Pierre_Paris
ST Employee

Hello @Advance_tech,

  • "Is there any chance that IC's I2C peripheral not working???  " : If you comply the absolute maximum ratings given in the Datasheet, it should work.
  • Understood, have you respected the following initialization of the FMPI2C before using HAL_FMPI2C_IsDeviceReady() to check if target device is ready?
    • Enable the FMPI2Cx interface clock
    • FMPI2C pins configuration (Enable the clock for the FMPI2C GPIOs + Configure FMPI2C pins as alternate function open-drain)
    • NVIC configuration if you need to use interrupt process
    • DMA Configuration if you need to use DMA process
    •  Configure the Communication Clock Timing, Own Address1, Master Addressing mode, Dual Addressing mode, Own Address2, Own Address2 Mask, General call and Nostretch mode in the hfmpi2c Init structure.
    • Initialize the FMPI2C registers by calling the HAL_FMPI2C_Init(), configures also the low level Hardware (GPIO, CLOCK, NVIC...etc) by calling the customized HAL_FMPI2C_MspInit(&hfmpi2c) API.
  • "Pease refer to waveform only serial clock coming but there is not serial data" : It seems that's the opposite but I don't understand this behavior. You can find here the errata sheet. Please read the I2C chapter.

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.