OutputPort SDA = new OutputPort(pinSDA,true);
OutputPort SCL = new OutputPort(pinSCL, true);
After OutputPort constructor the values are set to the “initalstate”
EDIT: Thats not true:
[quote]No affect on this lines:
SDA.Write(c1);
SCL.Write(c2);
[/quote]
Very strange effect:
Restart Program
Breakpoint @ SDA.Write(c1);
Current: SDA and SCL --> High (from initialize)
Pressed F10 (Step over)
SDA and SCL --> High (thats ok)
F10 --> SCL.Write(c2) --> Both went to LOW (WTF???)
Step Forward to Line:
SDA.Write(c1);
F10 (nothing happens c1 is false so thats ok)
F10 -->SCL.Write(c2) --> (nothing happens c2 is true WTF???)
Next Loop
SDA.Write(c1) --> c1 is true --> SDA and SCL High (???)
SCL.Write(c2) --> c2 is false --> SDA and SCL Low(???)
I’d also try setting the initial state to opposites, and try true / false for each of them and make sure that they chance as expected when they’re constructed.
public static void Main()
{
// Blink board LED
bool ledState = false;
OutputPort led = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, ledState);
OutputPort sda = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di7, !ledState);
OutputPort scl = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di6, ledState);
while (true)
{
// Sleep for 500 milliseconds
Thread.Sleep(500);
// toggle LED state
sda.Write(ledState);
ledState = !ledState;
scl.Write(ledState);
led.Write(ledState);
}
}
thats my simple code; that toggles state as expected, I see 3v3 on my chosen pins when I expect, and ~0v when I expect.
OK reviewing your results seems to lead me to believe that SCL is not connected. I’d be checking the CPU pin and seeing if there’s not a solder issue, or at least measure (when the board is off) continuity between the cpu and the outbound pin. Can you refresh my memory on what board you have and where you have the logic probe connected (ie a breakout or connector of some form?)
By the way you can fix this by touching the 2 i2c pins with soldering iron. Do this right on the EMX module. There is probably a little tiny hair short between the pads.
Yes, I’d check if you can see a solder bridge; if there is you can see it’d be pretty easy to touch with an iron to clear it. You might need a magnifying glass or lamp to see the bridge.
It happens the other way everyday here. Someone comes with a question and after long hours of back and forth we find a big in their code, of worse, they have old firmware who gets that bill
I hope you will find development so enjoyable and fast that it compensates for what happened.