I have a strange behaviour in my application: ATMEGA 1284 + EMC 2305 fan controller.
I am using the i2C as TWI hardware interface (twimaster.c) coming from Peter Fleury already used in the past with satisfaction.
i2C set at 100KHz frequency.
The EMC2305 fan controller must be interfaced by SMbus.
I set the CONFIGURATION REGISTER of the EMC2305 so to be "almost fully" i2C compliant (really the SMBus timeout function is disabled).
When I write/read a byte to/from the EMC2305 I do not receive any "error" from i2c_start i2c_start_wait i2c_rep_start i2c_write i2c_readAck i2c_readNak.
So when I write or read a register I have returned always a "valid" byte.
It seems that the EMC2305 fan controller is working "well".
It seems I can set all the parameters properly because the fans run as expected, tested both Direct Setting Mode (I impose the duty cycle) and the Fan Speed Control Mode (the inner algorithm of the EMC2305 set the duty cycle so to have the wanted RPM of the fans).
It is possible to set and change the speed; I checked by oscilloscope and the duty cycle is varying as expected.
All the fans are at the same speed.
Impossible to read properly the registers so to monitor the fans running.
What it is wrong is what I read from any register inside the EMC2305.
The values read have no sense.
I did a straight/direct test without compliments:
write into a register, echo at the LCD, read the same register, echo at the LCD.
The byte write and the byte read are totally different.
And this for any register.
What I write is not what I read.
So when I read a inner register to have the RPM of the fans the data is totally a no sense.
All the functions I can implement reading the EMC2305 registers are not working.
Any help is really welcome. After 4 days I do not know what else I have to check.