cancel
Showing results for 
Search instead for 
Did you mean: 

I2C HAL Size Management error - STM32WL + Si7021

markpow
Senior

What does this error mean for the I2C interface? I have it on the connection between the LORA E5 Mini and the SI7021 sensor.


The debugger stops here:

markpow_0-1737749096645.png

Exactly at his method call:

 

 

/* Wait until TXIS flag is set */
  if (I2C_WaitOnTXISFlagUntilTimeout(hi2c, Timeout, Tickstart) != HAL_OK)
  {
    return HAL_ERROR;
  }

 

 

 

 As you can see, the I2C is in the HAL_I2C_STATE_READY.

I have four items of the same sensor tested with this LORA device, and all behave the same, so I think a hardware error should be excluded.

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

ErrorCode=32 indicates HAL_I2C_ERROR_TIMEOUT.

Devaddress=0 suggests an invalid slave address.

Ensure HAL_I2C_IsDeviceReady returns HAL_OK before using any other HAL_I2C_* command.

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

View solution in original post

10 REPLIES 10
TDK
Guru

ErrorCode=32 indicates HAL_I2C_ERROR_TIMEOUT.

Devaddress=0 suggests an invalid slave address.

Ensure HAL_I2C_IsDeviceReady returns HAL_OK before using any other HAL_I2C_* command.

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

I2C doesn't see device:

markpow_0-1737754546834.png

According to the MX configuration, I2C3 has the following GPIO:

markpow_1-1737754674519.png

According to the WIO Lora E5 Mini wiki, I see that these pins are
PCO => RX1
PB14 => MISO

markpow_2-1737754848155.png

markpow_3-1737755039299.png

 

The Green LED on the SI7021 fires.

I checked the connections between LORA and this sensor many times, and all look good.

markpow_4-1737755134753.png

 

The ST-LINK V2 is attached to the LORA device too.

 

 



 

TDK
Guru

Do you have external pullups on the SDA/SCL lines?

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

That board is clearly labeled with SCL and SDA which is I2C2. So it's PA15 and PB15 that needs to be used.

By default when enabling I2C2, it chooses PA12 for SCL. So you override it and choose PB15 for SCL.

Don't worry, I won't byte.
TimerCallback tutorial! | UART and DMA Idle tutorial!

If you find my solution useful, please click the Accept as Solution so others see the solution.

There are 7-bits in the I2C address used, the high order bits. You should be cycling 0..127 with counter<<1 passed as the address. Address of SI7021 should be 0x80 from ST perspective (0x40 << 1)

https://www.adafruit.com/product/3251

https://learn.adafruit.com/adafruit-si7021-temperature-plus-humidity-sensor/downloads#schematic-and-fabrication-print-stemma-qt-version-3070786

The AdaFruit board has 10K pull-up, and a level shifter. Looks to be built on the assumption of a 5V supply/signalling. Not sure of what the regulator's going to do with 3.3V and both VCC and 3V3 need to be present. The SparkFun board is less encumbered, can find on eBay, Amazon, Mouser, DigiKey.

Enumerating what you've wired to what. Pictures help, but have to decipher colours, and placement

 

Would expect to need VCC,3V3,SCL,SDA,GND minimum. If providing VCC, check the voltage at 3V3 pin for drop-out

 

https://cdn-learn.adafruit.com/assets/assets/000/035/931/original/Support_Documents_TechnicalDocs_Si7021-A20.pdf

https://www.sparkfun.com/sparkfun-humidity-and-temperature-sensor-breakout-si7021.html

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

@Karl Yamashita  I choose I2C3, so PC0 and PB14 will the pins to connect.

 

But I think my LORA was destroyed, and it caused my problem. I got another LORA, and SI7021 worked with this device.

Thanks to all of you who tried to help me.

@TDK  According to the MX documentation for this chip under the STMCubeIDE, these GPIOs (for I2C) don't need any pullups or pulldowns.

I have several sensors attached to the LORA devices without those pulls.

@TDKThis helped me to discover the real cause of my problem. I debugged the code and found that LORA couldn't find the sensor attached to it.