Skip to main content
Visitor II
August 1, 2024
Question

HAL_GetTick() returns the value -128 when called

  • August 1, 2024
  • 1 reply
  • 910 views

HAL_GetTick() returns the value -128 when called in I2C write memory bite 
Here are the code snipets how to resolve this errorScreenshot (19).pngScreenshot (20).pngScreenshot (21).pngScreenshot (22).png

    This topic has been closed for replies.

    1 reply

    Super User
    August 1, 2024

    > HAL_GetTick() returns the value -128

    Why do you think this?

    The return value is uint32_t. It cannot be negative.

     

    Use HAL_I2C_IsDeviceReady and ensure it returns HAL_OK before using any other I2C function.

    If it's not returning HAL_OK, there is likely a hardware error. Perhaps SDA/SCL is miswired, or you have missing external pullup resistors, or other issue.

    NeevMehtaAuthor
    Visitor II
    October 10, 2024

     it's not returning HAL_OK,.SDA/SCL is wired properly and external pullup resistors are also present. Do let me know what other issue can be there and how can i solve it