cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_GetTick() returns the value -128 when called

NeevMehta
Associate II

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

2 REPLIES 2
TDK
Guru

> 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.

If you feel a post has answered your question, please click "Accept as Solution".

 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