I'm using a device through I2C interface and I'm having some issues when the I2C bus fails, I don't know if it fails because an interferance in the cable or just timing issues in the Raspberry over high loads.
The thing is that checking the way this device is used in Arduino and Raspberry there is a difference.
In arduino you use it like this:
Wire.beginTransmission(0x27);
Wire.write(0x80);
Wire.write(75);
Wire.endTransmission();
And in RPi you first set the channel into a pointer and then write to it, but never "endTransmission" or "beginTransmission" when you need to send the message.
I just init the i2c channel at the start:
dimmer = wiringPiI2CSetup(0x27);
And then use this to set the values.
wiringPiI2CWrite (dimmer, pin) ;
wiringPiI2CWrite (dimmer, value) ;
The problem is that once in a while it stops working, maybe a message got lost in the middle and now those 2 writes never are together waiting for the next byte. So, is there a difference between the Arduino version and the wiringPi version for this? is there a way to set the begin and end of a transmission?
The device in question is the Kryda AC Dimmer: https://www.tindie.com/products/bugrovs2012/i2c-4ch-ac-led-dimmer-module/
int wiringPiI2CWriteReg8 (int fd, int reg, int data);
instead of a pair of writes.