Main Site Documentation

Forcing I2C SCL and SDA for a set time


#1

I continue to make progress with things, but now I’ve come up a bit short.

I am programming a sensor that has a sleep mode. I can send the sleep command just fine using I2CDevice.CreateWriteTransaction and it’s working great.

Only I can’t wake it back up.

At least not without power cycling it. That’s not gonna work. :slight_smile:

According to the documentation, I need to hold SDA low and SCL high for 33ms.

I can’t find anything on that anywhere. Maybe I’m not asking the correct question.

Anyone know how I might go about this?

TIA


#2

Can you declare SDA and SCL pins as digitalOutputPins in your driver? And hold them high/low for the amount of time needed, then continue the transactions?


#3

Well, I was just using the built in driver which I don’t think gives me pin level access.

So what would I do?

Dispose of the I2CDevice that is controlling the bus, somehow access the pins directly, then recreate the I2CDevice to control the bus again?

Or could I just drive the pins directly?


#4

Hi wiily,
first idea with no guarantee that it works and that it does not brick your mainboard:
Why not yust directly connect the SDA pin with another output pin of your mainboard. It should work like open connector logic. Set the other output to low for 33 ms and set it high if you want normal I2C activity on the I2C bus. SCL is high anyway if nothing happens on the I2C bus.
Cheers Roland


#5

roland,

Thanks.

I don’t want to brick my Ceberus. I’ve grown to like it. :slight_smile:

What you’re saying makes sense, though. So straightforward it didn’t occur to me.

This reminds me of Dirty Harry. “Do you feel lucky?”

Anyone else want to comment on Roland’s suggestion?


#6

Hello,

I2C-Driverpins are OpenCollectorDriver. Thats the reason why you need external pull up resistors at the SDA- & SCL-Line… and the reason why you can connect multiple I2C-devices at the same line.
So Rolands idea with an additional OpenCollectorPin should work.

Greetings,
Lutz


#7

Thanks, guys.

I haven’t been steered wrong yet in this forum, so I’ll give it a try after I get back from vacation in a couple of weeks.