Synching two M2s

Is there any way to set the clocks of M2s same time? Or is there any other way to synchronized two M2s?

You could try using this library https://github.com/MarkusLange/RTCDue to set the RTCs of each M2, however it will require installing a backup button battery (with a voltage of 3.0V) to keep the M2 RTC alive during power disconnections. The battery will need to be installed with a blocking diode connected to the positive side of the battery & TP5 on the processor card with the correct orientation of the diode to prevent the M2 power supply from trying to charge the battery & possibly causing the battery to explode. The negative side of the battery could be connected to any easily accessible GRND point. If you select a battery with a small enough size it could be installed in between the XBEE connectors & secured with a small amount of silastic or double sided tape & thus still allow the XBEE connector & any of the enclosures to be used. If you intend to use the RTC time in say M2RET you will need to modify M2RET to use say UNIXTIME that is available from the RTC library.

You can probably use the SPI interface available on the external port.

If this is shared with other components on the board through it MAY require another device to act as a bridge.

I say this because I believe you need one master and everything else are slaves. If you were to connect both buses together you have two masters trying to talk to one another. If you install a slave unit as a bridge between the two devices then it can mediate between the two.

You MAY also be able to connect a wireless connection through the XBEE port and communicate with the two devices directly. I would suggest using something that is a direct connection such as Bluetooth, wifi or other wireless protocol and not something like Cellular because cellular has to talk to a tower and there will be a delay.

Otherwise if you are just looking at time syncing them you could do as @t_doust says or add a GPS module and set the time according to the time on the GPS at every start up.

Note, I have NEVER dealt with SPI directly to know how it works but I shared what I UNDERSTAND to be true. Others that have actually used it hopefully will chime in but atleast gives you somewhere to look.

Thank you for your replies. It seems very useful.