gregwa
Posts: 31
Joined: Tue Feb 02, 2021 10:15 am

I2C.start() returns an error

Thu Feb 11, 2021 7:22 pm

When using i2c.start() I get an error...

Code: Select all

MicroPython v1.14 on 2021-02-05; Raspberry Pi Pico with RP2040
Type "help()" for more information.
>>> from machine import I2C
>>> i2c = I2C(0)
>>> i2c.scan()
[57, 119]
>>> i2c.start()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: I2C operation not supported
>>> 
Is this simply not included in the current version of MicroPython and will be included in the future?

I seems that it is supposed to be implemented...

Code: Select all

>>> dir(I2C)
['__class__', '__name__', 'readinto', 'start', 'stop', 'write', '__bases__', '__dict__', 'init', 'readfrom', 'readfrom_into', 'readfrom_mem', 'readfrom_mem_into', 'scan', 'writeto', 'writeto_mem', 'writevto']
>>> 

espresso1736
Posts: 19
Joined: Fri Jan 22, 2016 11:43 pm
Location: El Cerrito, CA USA

Re: I2C.start() returns an error

Fri Feb 12, 2021 9:59 pm

Not sure, but I think you may need to specify the SCL and SDA pins, either in the construction, or via a call to init().

fivdi
Posts: 579
Joined: Sun Sep 23, 2012 8:09 pm

Re: I2C.start() returns an error

Sat Feb 13, 2021 7:36 am

The MicroPython I2C documentation lists several Primitive I2C operations which are only available on the machine.SoftI2C class and not on the machine.I2C class. I2C.start() is one of these operations.

For further information see GitHub issue https://github.com/micropython/micropython/issues/6856.
https://github.com/fivdi

gregwa
Posts: 31
Joined: Tue Feb 02, 2021 10:15 am

Re: I2C.start() returns an error

Sat Feb 13, 2021 10:56 am

Thank you for the link and the explanation.

fivdi
Posts: 579
Joined: Sun Sep 23, 2012 8:09 pm

Re: I2C.start() returns an error

Sat Feb 13, 2021 11:00 am

You're welcome :)
https://github.com/fivdi

Return to “MicroPython”