I2C HAL Size Management error - STM32WL + Si7021
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-24 12:15 PM - last edited on ‎2025-01-24 2:56 PM by Tesla DeLorean
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:
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.
Solved! Go to Solution.
- Labels:
-
STM32WL series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-24 1:02 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-24 1:02 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-24 1:46 PM - last edited on ‎2025-01-25 2:00 AM by Andrew Neil
I2C doesn't see device:
According to the MX configuration, I2C3 has the following GPIO:
According to the WIO Lora E5 Mini wiki, I see that these pins are
PCO => RX1
PB14 => MISO
The Green LED on the SI7021 fires.
I checked the connections between LORA and this sensor many times, and all look good.
The ST-LINK V2 is attached to the LORA device too.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-24 1:52 PM
Do you have external pullups on the SDA/SCL lines?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-24 2:11 PM
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.
TimerCallback tutorial! | UART and DMA Idle tutorial!
If you find my solution useful, please click the Accept as Solution so others see the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-24 2:46 PM - edited ‎2025-01-24 2:55 PM
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
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://www.sparkfun.com/sparkfun-humidity-and-temperature-sensor-breakout-si7021.html
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-24 2:47 PM - edited ‎2025-01-24 2:49 PM
Board has regulator, pull-ups and level shifter.
https://learn.adafruit.com/adafruit-si7021-temperature-plus-humidity-sensor/downloads
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-24 3:28 PM - edited ‎2025-01-24 3:32 PM
@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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-24 3:32 PM
@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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-24 3:36 PM
@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.
