Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i2c device memory operations #682

Open
ozanoner opened this issue Aug 28, 2020 · 3 comments
Open

i2c device memory operations #682

ozanoner opened this issue Aug 28, 2020 · 3 comments

Comments

@ozanoner
Copy link

Hi,
Is there any plan to add i2c device memory operations? as here:
https://docs.micropython.org/en/latest/library/machine.I2C.html#machine.I2C.readfrom_mem

I tried to use BME280 however the driver requires access to its internal registers. one example here:
https://randomnerdtutorials.com/micropython-bme280-esp32-esp8266/

Regards,
Ozan

@dpgeorge
Copy link
Member

No there is no plan to add those operations.

But it's possible to do memory operations with the existing 2 methods, eg:

def read_mem(i2c, addr, mem_addr):
    i2c.write(addr, bytes([mem_addr]), True)
    return i2c.read(addr, 1)[0]

@jemerlia
Copy link

jemerlia commented Aug 29, 2020 via email

@paulsijben
Copy link

I am running into serious problems trying to get an MPU6500 to work for similar reasons. On a raspbery pi it works immediately, but trying to get this chip going on the microbit with the web-based python editor I see that for starters I need to do +1 on all the writes writes for the register number, only then I can read the who_am_i register correctly. Trying to read the gyro and accel registers gives me data that suggests that the registers are somehow swapped.

Is there any point in trying to checkout this repository and run the updates manually?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants