Hardware-I2C issue HTU21DF

Working libraries, libraries being ported and related hardware
Post Reply
fari
Posts: 23
Joined: Sun Feb 26, 2017 12:01 pm

Hardware-I2C issue HTU21DF

Post by fari » Mon Feb 27, 2017 11:15 pm

Hello!

I have been experiencing difficulties to connect to the HTU21DF sensor via I2C.
I have used the examples i2c_scanner_hwire and i2c_scanner_wire, but both of them crash on bleupill (STM32f103C).
i2c_scanner_hwire seem to hang in i2c.c

int32 i2c_master_xfer(i2c_dev *dev,
i2c_msg *msgs,
uint16 num,
uint32 timeout)
since the timeout is set to zero.
Ones you change this value to e.g. 100 it runs in the fist time, but at the second call it stops here.
ASSERT(dev->state == I2C_STATE_IDLE);

i2c_scanner_wire just freeze in wire.begin(), I did not have any time to debug it
Could it be, that I have downloaded bad version of the i2c library???

Does any one have any experience with those functions?
I am stuck here and I hope, that some one has proceeded successfully with i2c library or with the sensor HTU21DF!

zmemw16
Posts: 1449
Joined: Wed Jul 08, 2015 2:09 pm
Location: St Annes, Lancs,UK

Re: Hardware-I2C issue HTU21DF

Post by zmemw16 » Wed Mar 01, 2017 12:00 am

check this post for a fix?
http://www.stm32duino.com/viewtopic.php ... 1DF#p11507
found with search
hth
stephen

fari
Posts: 23
Joined: Sun Feb 26, 2017 12:01 pm

Re: Hardware-I2C issue HTU21DF

Post by fari » Wed Mar 01, 2017 9:14 am

Thanks for your hint! I will give a try!

fari
Posts: 23
Joined: Sun Feb 26, 2017 12:01 pm

Solved: Hardware-I2C issue HTU21DF

Post by fari » Wed Mar 01, 2017 7:44 pm

I have found the root of the problems:
- The HTU21 mini board had no connected pullup resistor, even the vendor specification states, that the pullup is active. That is why the i2c stm32 libs failed
- Now I know, that the stm32 libs enter an endless loop if the i2c pins loses the voltage. Here might be a time out exit condition and a simple diagnosis very useful
- the Hwire has 0s timeout parameter in the function int32 i2c_master_xfer(i2c_dev *dev, i2c_msg *msgs, uint16 num, uint32 timeout) which leads to an endless loop

pokemon99
Posts: 29
Joined: Wed Jun 07, 2017 9:09 am

Re: Hardware-I2C issue HTU21DF

Post by pokemon99 » Sat Jul 22, 2017 1:55 pm

A good day. Is there a solution to this problem?

User avatar
martinayotte
Posts: 1229
Joined: Mon Apr 27, 2015 1:45 pm

Re: Hardware-I2C issue HTU21DF

Post by martinayotte » Sat Jul 22, 2017 3:50 pm

No issue there ... PullUps and/or Timeout parameter.

Post Reply