0

i2c communicate between circuitpython boards
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

i2c communicate between circuitpython boards

by gsrobotics2017 on Thu Jul 15, 2021 4:28 am

don't know if I'm in the right place but iv got a pyportal Titano and a feather 2040 I am trying to communicate between the 2 with i2c but can't find any way to do this I'm happy to move to a different communication method lice UART or USB but I can't find anything on this ether does anyone have any advice?

gsrobotics2017
 
Posts: 8
Joined: Wed Jul 14, 2021 4:20 pm

Re: i2c communicate between circuitpython boards

by dastels on Thu Jul 15, 2021 10:09 am

You can use the i2cperipheral module. See the docs as https://circuitpython.readthedocs.io/en/latest/shared-bindings/i2cperipheral/index.html.

The Feather RP2040 doesn't include i2cperipheral in its CircuitPython build, but the Titano does. So the Titano will have to be the peripheral and the Feather, the host.

See https://circuitpython.readthedocs.io/en/latest/shared-bindings/support_matrix.html for which core modules are included on each board.

Dave

dastels
 
Posts: 7305
Joined: Tue Oct 20, 2015 3:22 pm

Re: i2c communicate between circuitpython boards

by gsrobotics2017 on Fri Jul 16, 2021 3:48 pm

do you know any way of adding this module to the father 2040

gsrobotics2017
 
Posts: 8
Joined: Wed Jul 14, 2021 4:20 pm

Re: i2c communicate between circuitpython boards

by dastels on Fri Jul 16, 2021 7:59 pm

I do not. There's an open issue to add it, but it's a low priority at the moment: https://github.com/adafruit/circuitpython/issues/4536.

Dave

dastels
 
Posts: 7305
Joined: Tue Oct 20, 2015 3:22 pm

Re: i2c communicate between circuitpython boards

by gsrobotics2017 on Sat Jul 17, 2021 2:51 am

do you understand how that paceg works

gsrobotics2017
 
Posts: 8
Joined: Wed Jul 14, 2021 4:20 pm

Re: i2c communicate between circuitpython boards

by dastels on Sat Jul 17, 2021 2:57 pm

"paceg"??

Dave

dastels
 
Posts: 7305
Joined: Tue Oct 20, 2015 3:22 pm

Re: i2c communicate between circuitpython boards

by gsrobotics2017 on Sat Jul 17, 2021 3:33 pm

the i2cperipheral pacage

gsrobotics2017
 
Posts: 8
Joined: Wed Jul 14, 2021 4:20 pm

Re: i2c communicate between circuitpython boards

by dastels on Sat Jul 17, 2021 4:03 pm

"package"

In this case it's more correctly referred to as a module.

As for how it works. I linked to the docs which includes an example. From the other device (with sda, scl, and ground connected between the two boards) you use it like any I2C device, based on how you programmed it to respond.

That, as far as I know, is the extent of it.

Dave

dastels
 
Posts: 7305
Joined: Tue Oct 20, 2015 3:22 pm

Re: i2c communicate between circuitpython boards

by gsrobotics2017 on Sun Jul 18, 2021 9:06 am

I looked at the documentation but i cant understand it

gsrobotics2017
 
Posts: 8
Joined: Wed Jul 14, 2021 4:20 pm

Re: i2c communicate between circuitpython boards

by dastels on Sun Jul 18, 2021 10:56 am

Is there anything in particular that is a problem?

Dave

dastels
 
Posts: 7305
Joined: Tue Oct 20, 2015 3:22 pm

Re: i2c communicate between circuitpython boards

by gsrobotics2017 on Thu Jul 22, 2021 6:13 pm

i just don't understand the documentations

gsrobotics2017
 
Posts: 8
Joined: Wed Jul 14, 2021 4:20 pm

Re: i2c communicate between circuitpython boards

by Twisy on Mon Jul 26, 2021 11:36 am

Hi thanks for the topic. and in general thanks for the great products and the good documentation.

I have a similar problem and the topic here seems to be unfinished.
I would like to query pin A1 (analogue) and D3 (digital) from the Adafruit Trinket M0 (i2c slave) and send the results via i2c to my Adafruit ItsyBitsy M4 Express featuring (i2c master) and output.

I also don't quite understand how to do this. I followed the example from https://circuitpython.readthedocs.io/en ... index.html and loaded it onto the Trinket M0. When I do an I2C scan on the ItsyBitsy M4, the Trinket M0 does not appear in the search.

Wiring:
Trinket M0 Pin 2 <----> SCL + R10K to 3.3V ItsyBitsy
Trinket M0 Pin 0 <----> SDA + R10K to 3.3V ItsyBitsy
Trinket M0 GND <----> GND ItsyBitsy

what's wrong? why doesn't the Trinket M0 appear in the search on the ItsyBitsy?
I have not yet found out how to work with i2c.

could someone make two example programmes? to understand the whole thing better?
Trinket M0 (i2c slave) 2 x random number ----> ItsyBitsy output the random numbers.
and simultaneously ItsyBitsy (i2c Master) ----> Trinket M0 Output of random numbers.

Thank you very much in advance, it would help me a lot.

Twisy
 
Posts: 1
Joined: Mon Jul 26, 2021 10:40 am

Please be positive and constructive with your questions and comments.