Shop OBEX P1 Docs P2 Docs Learn Events
Help with the i2cLibrary 1.3 — Parallax Forums

Help with the i2cLibrary 1.3

DarrenYDarrenY Posts: 61
edited 2007-08-27 00:32 in Propeller 1
Hi All,

I am attempting to interface to a VTI SCP1000 Pressure sensor.
The SCP1000 has a TWI interface that VTI say is i2C compatible.

Upon using the i2c Library with the SCP1000, I find the sensor on the bus via i2cObject.devicePresent OK, but when I try and read a register using i2cObject.readLocation I just get the value 80000000 (decimal) back all the time ??

I'm attempting to read the ASIC version (register location 0x00) with the following:

if i2cObject.devicePresent(i2caddress)          ' check for the sensor on the bus
      debug.str(string("Found SCP1000",10,13))
      asicversion := i2cObject.readLocation(i2caddress, $00, 8, 8)
      debug.str(string("ASIC Version: ")) 
      debug.num(asicversion)
      debug.str(string(10,13)) 




the debug object is my output to my PC terminal.

I have my hardware configured as per the i2c Library 'demo' setup, i.e 2 x 1k and 2 x 4.7k pull-ups

Any ideas as to why I get 80000000 all the time??

Thanks,
Darren.

Comments

  • deSilvadeSilva Posts: 2,967
    edited 2007-08-25 15:01
    Why do you think you ".. found the sensor on the bus..."??
    Is your i2caddress correct?
  • DarrenYDarrenY Posts: 61
    edited 2007-08-25 15:06
    devicePresent return true or false depending if it received an ACK back from the sensor or not, and i'm getting true back, so I assumed that the address I am using is correct.

    The spec sheet says the default address is 0x11, b'001 0001

    I am using

    SCP1000_Addr = %0010_0010
  • deSilvadeSilva Posts: 2,967
    edited 2007-08-25 15:50
    The reason I asked was that there are two versions of this sensor -D01 and -D11; only the latter having the I2C interface, the first one (-D01) an SPI interface
  • DarrenYDarrenY Posts: 61
    edited 2007-08-25 15:55
    Yep, I actually have an older P03 (same as D11 but have to manually perform low noise config)
    This is the reason I am trying to read the ASIC version - so my object can be generic for both P03 and D11 ASIC versions....
  • DarrenYDarrenY Posts: 61
    edited 2007-08-26 19:32
    OK, I have got a bit further on this now, but I still have a problem where it 'seems' only every other read is returning data.

    For example, if I read (for example) REVID multiple times, I get 1, 255, 1, 255, 1, 255 etc.

    I'm working through the 8-bit TWI read sequence as per the VTI spec sheet to check it matches the i2cLibrary 1.3 but has anyone got any ideas?

    Post Edited (DarrenY) : 8/26/2007 8:03:43 PM GMT
  • deSilvadeSilva Posts: 2,967
    edited 2007-08-26 20:21
    Alas, again no. But I am interested in what way you solved your initial problem!
  • DarrenYDarrenY Posts: 61
    edited 2007-08-26 20:37
    My mistake - I had missed an & when checking for a bit :-(
    So basically it wasn't doing a read at all!!

    But now it is (Phew!), but just can't work out why the read isn't consistant
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2007-08-27 00:32
    Darren,

    Just an idea because I can't see how you are doing it but many i2c devices require a NAK on the last byte transfered before the stop.

    *Peter*
Sign In or Register to comment.