Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Need Help with LMP91000 IC Programming

    Scheduled Pinned Locked Moved MicroPython
    1 Posts 1 Posters 18 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • O Offline
      Oridroo
      last edited by

      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.hold(1)
      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.
      lmp91000_Compressed.pdf

      1 Reply Last reply Reply Quote 0

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      • 1 / 1
      • First post
        Last post

      Pycom on Twitter

      Pycom