DS3232 RTC and I2C
Guyvo
Posts: 21
Hi props,
On my custom made board I put a DS3232 RTC interfaced bij I2C. I used the I2CWrite/read functions of the I2Cobject written by James Burrows based on the code of Jon Williams. This works fine but if I do some measurements with logic analyser I noticed that the SCL frequency is only 25KHz which is far from the maximum I2C bus speed of 400KHz. (some chips have even 1M !) Of course the main reason is that it's written totally in SPIN code. It would be more appropriate to write the low level clockings in assembler driven by a software BitDelay and HalfBitDelay. I don't know if somebody did this before but I love to give it try.
I could start a seperate COG given the data byte for I2C read/write by the PAR mechanism do the clockings and than stop the COG. I'm not sure this is the good approach because i'm rather new in the prop world. But because it is not obvious to do inline assembler maybe this is the only way to do so.
If anyone can give me some other ideas they are welcome. And if I have an object proper working which can deal with maximum I2C bus speed I will post it on the object collector.
Cheers
Guy
On my custom made board I put a DS3232 RTC interfaced bij I2C. I used the I2CWrite/read functions of the I2Cobject written by James Burrows based on the code of Jon Williams. This works fine but if I do some measurements with logic analyser I noticed that the SCL frequency is only 25KHz which is far from the maximum I2C bus speed of 400KHz. (some chips have even 1M !) Of course the main reason is that it's written totally in SPIN code. It would be more appropriate to write the low level clockings in assembler driven by a software BitDelay and HalfBitDelay. I don't know if somebody did this before but I love to give it try.
I could start a seperate COG given the data byte for I2C read/write by the PAR mechanism do the clockings and than stop the COG. I'm not sure this is the good approach because i'm rather new in the prop world. But because it is not obvious to do inline assembler maybe this is the only way to do so.
If anyone can give me some other ideas they are welcome. And if I have an object proper working which can deal with maximum I2C bus speed I will post it on the object collector.
Cheers
Guy
Comments
The PCA9698 provides 40-bit parallel input/output (I/O) port expansion for I2C-bus applications organized in 5 banksof 8 I/O. If you must fast interact with I/O changes on the chip the more speed you have on the bus the better.
Guy
This chip could also benefit from a faster i2c driver (assuming there's a free cog).
On a side note:· I bet the Prop ROM has a fast i2c driver in it somewhere...· I suppose we could "just" dissassemble the ROM and find the i2c driver...