i2c problems with mbed Rev 23

06 Jul 2010

Hello all

I had problems with the PCF 8575 16 bit IO-device, since the Rev 23 appears.

1. i2c.read did not work.

2. when the read result is 0x7F (127 dez) the programm stalls.

 

I've no Idea, the program runs fine, with the old mebd Rev.

06 Jul 2010

Thanks for reporting this - I will look into this straight away.

06 Jul 2010

Could you post the code you are using? I am using a PCF8575C on a Sparkfun breakout, and I can get it to read with the current library (including the value 0x007F), but I may be missing something.

06 Jul 2010

The problem was that

i2c.read(0x40,data40i,2,false);    !=

i2c.start();
i2c.write(0x41);                        // Address 0x40 read
data40i[0] = i2c.read(I2C::ACK);        // Read lower 8 bits, with ACK
data40i[1] = i2c.read(I2C::ACK);        // Read upper 8 bits, with ACK
i2c.stop();                                // Stop condition

 

I have changed the code last week as discussed in Problems with I2C link to SRF08 rangefinder.

suddenly the i2c.read command was out of order, now after your posting i changed from i2c.start(); to i2c.read all is fine now.

I don't know why, but the i2c.read function works now perfect.

Michael

06 Jul 2010

Shouldn't that second I2C::ACK be a I2C::NoACK?

Am I correct in thinking that this is now working, and I can close the ticket? Ironically, a SRF08 rangefinder has literally just appeared on my desk in the last 5 minutes.

06 Jul 2010
user avatar Jon Ward wrote:

Shouldn't that second I2C::ACK be a I2C::NoACK?

Am I correct in thinking that this is now working, and I can close the ticket? Ironically, a SRF08 rangefinder has literally just appeared on my desk in the last 5 minutes.

I've just put the full code I used for the SRF08 rangefinder on a notebook page: 'Testing the SRF08 ultrasonic rangefinder'.

06 Jul 2010

You are right, in the PCF 8575 dokumentation I see the diagram for a read process and they show in the example a dual readout of the PCF and the secound readout ends with NoACK.

I was wrong, nice feature of the PCF that the reading stalls only on 127d. So I thought i programmed it right.

Sorry for the time you invested.

 

Thanks for all.

Michael