I2C Multi Master

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Docara
Posts: 308
Joined: Sun Jun 23, 2013 1:29 pm
Has thanked: 28 times
Been thanked: 61 times
Contact:

I2C Multi Master

Postby Docara » Mon Oct 21, 2019 3:39 pm

Hi

Can the I2C Master Slave components operate in Multi Master configuration.
And does the Slave initiate and interrupt when data is received.
Thanks

User avatar
Benj
Matrix Staff
Posts: 14797
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4759 times
Been thanked: 4362 times
Contact:

Re: I2C Multi Master

Postby Benj » Mon Oct 21, 2019 3:43 pm

Hello,

I'm not sure about Multi master, It likely does work but there are also likely complications. The Slave is likely fine and it's the master that might have problems. If the comms is fairly sparse then the chance of a collision between masters is quite low and it should be fine.

The Slave does require the SSP interrupt which was added to devices fairly recently.

Docara
Posts: 308
Joined: Sun Jun 23, 2013 1:29 pm
Has thanked: 28 times
Been thanked: 61 times
Contact:

Re: I2C Multi Master

Postby Docara » Mon Oct 21, 2019 8:22 pm

Hi Ben

I see no mention of Interrupt in my V7 I2C Slave component.
Benj wrote:The Slave does require the SSP interrupt which was added to devices fairly recently.


So what do I do? Can this be implement in a C routine or you sent me a new component

Doesn't I2C included (albeit basic) a handshaking mechanism using ACK http://www.esacademy.com/en/library/technical-articles-and-documents/miscellaneous/i2c-bus/general-introduction/using-the-clock-synchronizing-mechanism-as-a-handshake.html

Thanks

User avatar
Benj
Matrix Staff
Posts: 14797
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4759 times
Been thanked: 4362 times
Contact:

Re: I2C Multi Master

Postby Benj » Tue Oct 22, 2019 5:11 pm

Hi,

I added the interrupts for v8. What chip are you using and i'll see if I can add the code to the v7 definition.

Docara
Posts: 308
Joined: Sun Jun 23, 2013 1:29 pm
Has thanked: 28 times
Been thanked: 61 times
Contact:

Re: I2C Multi Master

Postby Docara » Thu Oct 24, 2019 10:46 am

Hi Ben,

AH! Sorry if this has been a PITA for you personally! I thought it would be a simple matter of adding/copying some functionality to the I2C Slave macro and it would 'just' pushed through all the ranges.

I'm SOO temped to say PIC and AVR :lol: :lol: LOL.

I'm still researching my design, but thanks to China, I am hoping to use the ATMEGA2560, I will probably use both the ATMEGA328P (ATMEGA328PB) and PIC12F1840.

Further to another post I made here requesting the inclusion of a ATMEGA328PB, if this can be sorted out, then the PB variant ofthe ATMega328 would be nice. If that could be included then all my bases are covered.

There will be a number of distributed microcontrollers which will be in a sleep mode for long periods of time, only for them to wake up on an event eg GSM data, data on a bus etc.

I will be using the CAN (MCP2551 & MCP2151) macros , I2C and SPI. Will the component macro implementations for these allow for wakeup events - interrupts.

Thanks again Ben

Docara
Posts: 308
Joined: Sun Jun 23, 2013 1:29 pm
Has thanked: 28 times
Been thanked: 61 times
Contact:

Re: I2C Multi Master

Postby Docara » Wed Nov 13, 2019 10:44 am

Bumped

User avatar
Benj
Matrix Staff
Posts: 14797
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4759 times
Been thanked: 4362 times
Contact:

Re: I2C Multi Master

Postby Benj » Wed Nov 13, 2019 11:14 am

Hello,

I've done the PIC device for you with the new interrupt.
12F1840.fcdx
(18.66 KiB) Downloaded 43 times


The AVR devices do not have SPI or I2C based interrupts available so you may instead have to use pin change interrupts instead.
These users thanked the author Benj for the post:
Docara (Tue Nov 26, 2019 7:36 pm)
Rating: 5%