I am trying to write an I2C Master for the PXI-6552 in C++. I'm running both channels (SDA/SCL) in Open-Collector. Based on reading throughout the Community Pages I understand that the PXI-6552 stores last value from previous waveform. However, this should be able to be overridden using:
niHSDIO_ConfigureInitialState(genVi, "18,12", "ZZ");
niHSDIO_ConfigureIdleState(genVi, "18,12", "ZZ");
Where "18" is my SDA, and "12" is my SCL.
But this doesn't seem to be working for me. When I run my waveform (where "2" is tristate 😞
ViUInt8 writeArray[WAVEFORM_SIZE] = { 2,2,2,0,2,2,0,0,2,2,0,0,0,0,0,0,0,0,0,0,3,3,2,2, // SDA
2,2,2,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,2,2 }; // SCL
And monitor on the O-Scope I get the expected Start+SlaveID+ACK, but with the ACK coming in as a LOW, channel "18" is pulled LOW, and if I run the waveform again (as in run the full code again from Visual Studio) channel "18" starts LOW so my start condition fails, I then get a NACK, which is HIGH, so next time I run it, it works and I get an ACK, and rinse and repeat. I tried using the InitialState and Idle to force "18" into another state "1", "0", "Z", "X" it doesn't seem to have any affect, it will always start the next run of the waveform with the previous data state. I even tried doing a device reset at the start of the InitiateSession.
I thought maybe it was related to the "3" checking for a LOW, but changing that to any other value has no affect, it always goes through this same loop. Any help on why this is happening would be greatly appreciated.