Main Site Documentation

SI7021 Temperature & Humidity sensor I2C Exception


#1

Hi folks,
does somebody successfully used a Silicon Labs SI7021 Temp & Hum sensor with TinyCLR? Yesterday a struggled connecting to that device with TinyCLR V1.0.0 installed in my G30 based board. I got I2cClockStretchTimeoutException. Just before you ask, I successfully connected to other kind of device such a Real Time Clock (DS1307). So I know my I2C port is working well. Furthermore, I’ve checked my connections to the SI7021 many times and I am very confident it is correct. The Silicon Labs manual talks about a “Clock stretch during measurement”. Apparently it looks related to the exception I got.

Does I2C on TinyCLR support the clock stretching?


#2

Might be a bug. Is there a breakout I can buy somewhere to try? I need your code s well.


#3

Hi Gus, in fact I am using old GHI Gadgeteer stuff. My board is a Fez Lemur flashed with TinyCLR, the temperature module is the TempHumid Si70 Gadgeteer and I use the Gadgeteer extender to connect the module to the board. You probably have some of them hidden in a closet. You can refer to the Silicon Labs documentation here. The code I use is the Following:

Imports GHIElectronics.TinyCLR.Devices.I2c
Imports GHIElectronics.TinyCLR.Pins

Module Module1
    Public Sub Main()
        Dim i2c_temp_settings = New I2cConnectionSettings(&H40) With {
                           .BusSpeed = I2cBusSpeed.FastMode, .AddressFormat = I2cAddressFormat.SevenBit}
        Dim i2c_controller = I2cController.FromName(G30.I2cBus.I2c1)
        Dim TEMP_device = i2c_controller.GetDevice(i2c_temp_settings)
        Dim HUM_Buffer As Byte() = New Byte(1) {}
        Dim TEMP_Buffer As Byte() = New Byte(1) {}

        Try
            While True
                TEMP_device.WriteRead(New Byte() {&HE5}, TEMP_Buffer)
                Thread.Sleep(3000)
            End While
        Catch ex As Exception

        End Try
    End Sub
End Module

#4

@Greg_Norris do you have one of these models still? Maybe you can help us and give it a try.


#5

Any development on this topic? If mister Norris has Nothing in hand you can give a try with this one : Si7021