Need Help with LMP91000 IC Programming

  • Hi All, hope you guys are doing well.

    I have been trying to write a program to read the value out of an analogue gas sensor using LMP91000 IC. I have started like this:

    from machine import I2C, Timer
    import time, machine
    p_19 = Pin('P19', mode=Pin.OUT) #MEENB Pin
    p_19.value(0)       #Holding the MENB Pin to Low to awake the IC
    i2c = I2C(0, I2C.MASTER)
    i2c = I2C(0, pins=('P3','P4'))    #SDA, SCL pins of pycom
    print("I2C Address", i2c.scan())
    status = i2c.writeto_mem()  #Which command to use for reading???```

    From the datasheet, I saw that I would have to check the 'Status' of the register if it's ready for I2C connection or not. Once it's ready (output is 1), then I can send the commands for TIA, Vref etc. to configure the IC.

    So please guide me how can I read the status and then write the commands? Which I2C commands should I use? And how to implement the address of the register and relevant commands from the datasheet? For example, can I use the simple 'i2c.readfrom(addr, nbytes)' command to read the status register like this:

    status = i2c.readfrom(0x00, 1)

    Here, I believe I have to put the status register's address first which is (0x00) and the how many bytes it would return (here the register would return either '1' or '0', hence 1 byte).

    But then again I became confused by the following lines from the datasheet:

    "A read operation requires the LMP91000 address pointer to be set first, also in this case the master needs setting at low logic level the MENB, then the master needs to write to the device and set the address pointer before reading from the desired register. This type of read requires a start, the slave address, a write bit, the address pointer, a Repeated Start (if appropriate), the slave address, and a read bit (refer to Figure 27, Figure 28, and Figure 29)."

    So please help me out.

Log in to reply

Pycom on Twitter