I2C Troubles - Netduino 3 wi-fi

I need some help getting the I2C communication working with my N3.

I’ve tried running a few devices over I2C with no luck.

The first device was an AM2320 Temp/Humidity sensor (
I was attempting to write my own drivers for this one. First I tried the examples from Wilderness labs using I2CDevice, but then after that didnt work I tried the foundation’s I2CBus, no luck there either.

I decided to purchase a second sensor, the SI7021 Temp/Humidity sensor (
This time I was going to use the foundations peripheral driver because I thought, hey maybe I’m doing something wrong with the code. Or maybe I didn’t wire the pull-up resistors correctly (this second device has built in pull-ups)
Peripheral driver used:
I then followed these instructions and took the polling route:

All I end up with is a “WriteRead: Retry count exceeded” error. I ran into this error in the first attempt as well. I even hooked everything up to a second/spare N3 controller, same result.

Can anybody point me in the right direction or tell me what I am doing wrong?

I’m still trying to figure out how to toggle the internal pull-up resistors. I read about that in other I2C issues around the web, but still havent figured out how to control that internally.


I have a stripped back example of a couple of I2C device drivers on my blog…

Have a look at

This post has an example of a light-weight I2C temperature & humidity sensor (different model Silicon Labs device to yours but a reasonable starting point) including the port strobe on startup magic.


Hey, thanks KiwiBryn. That was helpful, I was able to get temperature to read out. Not humidity, but hey, it’s a start!

With enough tinkering around I’m sure I can make this work :]

Okay, so this was the magic solution:

using (OutputPort i2cPort = new OutputPort(Pins.GPIO_PIN_SDA, true)) {

If I insert that right before I create a device using the foundation si7021 driver it works flawlessly. So no need for me to write a new driver, yay!

Hi…the problem I have is that I can only get the SparkFun module to work with the Netduino; I can’t get the Adafruit one to work. It fails when I try to do a Soft Reset.
I have been successful in getting both modules to work with an Arduino type MCU (Teensy 3.1), using the exact same code.
I read your comments with interest and have tried connecting VIn on the HTU21D-F to 5V rather than to 3.3V. It didn’t make a difference for me.

pcb manufacturing and assembly


Could you post a photo of your setup and code and I’ll have a look.