cancel
Showing results for 
Search instead for 
Did you mean: 

Why HAL_I2C_IsDeviceReady return HAL_ERROR

SKAŞ.1
Associate II

Hello folks,

Since my last post, I still couldn't solve my I2C communication problem. I thought maybe return is not HAL_OK for my function so that I couldn't find any I2C addresses. And my guess was correct. I'm getting HAL_ERROR but it doesn't mean anything to me. What could be the reason I am getting this error.

0693W00000D0kZYQAZ.jpg 

Last time I couldn't upload my file, so here it is.

RCC -> HSE -> Ceramic

My clock setting is -> 8Mhz for input freq

HCLK = 84MHz

For pins,

PG13 & PG14 for LEDs

PG13 used for every scan is over,

PG14 used for interrupt (Just check if somethings is wrong but seems not!)

PA0 user button for external interrupt

I2C3 is used since others are not available for external usage. from the datasheet.

0693W00000D0Za6QAF.jpgI connect PCF8574T directly.

I can found the address via Arduino but with STM, I can't

my SPI settings is Standard mode (100MHz) set by CubeMX

most of the things set up by CubeMX.

I am waiting for your kind support,

Kind Regards.

12 REPLIES 12

Then, is it possible to STM doesn't recognize any device? I increase the trial from 1 to 3. I can also increase the time out from 10 to 100.

SKAŞ.1
Associate II

OKAY NOW,

I got I2C addresses of

0-1-78-79-130-131

Tomorrow, I'll connect Arduino with known addresses.

So that I could say something, for now, THANKS TO ALL OF YOU!

replace your line with this one and give it a try.

HAL_I2C_IsDeviceReady(&hi2c3, (uint16_t)(counter<<1), 3, 10);