I am working on a project where master (actuator) should receive data from the slave via I2C.
Here: USB 8452 is used as a slave which simulates the sensor data.
The actuator has an internal control loop of 200ms. Therefore it is necessary to have every 200ms new and stable values of the actual sensor data.
The time period between requests, can be longer than 200ms but not shorter.
I2C communication error:
The actuator always outputs an error after the first read and write operation (error message: communication error between master and slave). After that the slave doesn't receive any event type (NI 845x Slave Wait for Event.vi) and program doesn't show any error. See attachments for program
Replaced actuator by IOWarrior24:
Therefore, in order to double check that slave write function is working properly I replaced the actuator with the IOWarrior24 and data is monitored from through "Simple-I2C software".
Read and write for the first time: The master reads the exact data what the program sends.
When attempted to write for the second time the slave receives no event type and the "Data Monitor" in Simple-I2C software shows "Failure while sending. Please check your settings and data". Please see the attached images.
When IOWarrior24 is communicated with the real time sensor write and read operation were success without any error.
Thank you and regards,
Could you please try to modify your main VI so that you can track warnings on the error cluster in the while loop? I suggest using highlight execution for that.
That would be my first suggestion, which may not bring too much help, but still ... worth a try...
What I've noticed while reading the documentation of NI-845x I2C Slave Wait for Event.vi is that each event needs to be handled by appropriate function handler. In your code, in the case structure, you are not tracking nor handling all of the events, which may lead eventually to the situation you have described ...