Messaging between multiple Maple Mini clones

What are you developing?
joevpt
Posts: 12
Joined: Sat Aug 27, 2016 6:38 pm

Messaging between multiple Maple Mini clones

Post by joevpt » Sat Aug 27, 2016 7:06 pm

I have a project which uses 6 arduino boards which I am porting to Maple Mini clones to benefit from 32 bit and higher clock rate. As currently written the project has one master I2C and five slave I2C. I've read that Slave mode is not implemented in the Maple Mini port for Wire and wonder what solution is recommended?
The slave cards already use SPI_2 to communicate with some peripheral devices, and the master card uses SPI_2 to communicate with an Ethernet and SD card.
The port is completed except for the interboard communications which is always from the master to one or more slaves.

Does anyone know whether the I2C library for STM32F1 will include a slave mode any time soon or does anyone have a suggestion for an alternative?

Thanks in advance..

User avatar
Pito
Posts: 1502
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: Messaging between multiple Maple Mini clones

Post by Pito » Sat Aug 27, 2016 8:21 pm

You may use uarts - they can do Mbits - and the slaves will be connected to the master in a star configuration, listening on the request from the master when the id match the particular id-slave will answer. If slaves' uart tx pins allow an open drain, you may connect all slave's txs to master's rx ("wired or") and all slave's rx to master's tx directly. I did it in eighties with PC vs several 8051s and it worked :). You need to create a simple protocol, where the master will send a request to all slaves, and only one slave will answer.. Details depend on your application, however.
You may use 9bit transfer, where the 9th bit set "1" will indicate it is the slave's address (you may address 256 slaves then).
Pukao Hats Cleaning Services Ltd.

joevpt
Posts: 12
Joined: Sat Aug 27, 2016 6:38 pm

Re: Messaging between multiple Maple Mini clones

Post by joevpt » Sat Aug 27, 2016 8:43 pm

Thanks Pito. I had created a daisychain from Master to Slave1 then Slave 1 to Slave 2 etc. A simple protocol with a condition to forward the message if it's not for this Slave works ok. This solution uses two Usarts per MCU.

I didn't realise I could join several Slave Tx and Rx together and then reversed to the master. This gives me the benefit of looking exactly like I2C as far as my project is concerned. It also saves one Usart per MCU.

Do I need to condition the Rx Tx lines in this case Maple mini clone) or can I simply connect them together.
Last edited by joevpt on Sat Aug 27, 2016 9:04 pm, edited 1 time in total.

simonf
Posts: 180
Joined: Sun Jul 26, 2015 4:03 pm

Re: Messaging between multiple Maple Mini clones

Post by simonf » Sat Aug 27, 2016 9:03 pm

Pito wrote:You may use uarts - they can do Mbits - and the slaves will be connected to the master in a star configuration, listening on the request from the master when the id match the particular id-slave will answer. If slaves' uart tx pins allow an open drain, you may connect all slave's txs to master's rx ("wired or") and all slave's rx to master's tx directly.
I've used something similar. You can just use a single pull up resistor wire all the rx's together and wire the tx's to the rx's via a diode. CCTALK uses this method.
Messages usually take the form of.

<From><To><Length><........Data.......><Checksum>

The uP's receive all packets and just ignore ones where the "To" adress doesn't match its ignored. It may well be worth either sending an ACK data packet and/or checking the rx buffer on the tx uP matches the transmitted Packet IE the packet got onto the bus un-corrupted.

joevpt
Posts: 12
Joined: Sat Aug 27, 2016 6:38 pm

Re: Messaging between multiple Maple Mini clones

Post by joevpt » Sat Aug 27, 2016 9:13 pm

Thanks Simon for the connection clarification. Before I go do it, can I clarify that the pull-up is required on both lines and a diode is required on each tx line ?

Each MCU in this setup can therefore read every transmission and confirm its own message ( like Old Ethernet looking for a collision).

I like it!

simonf
Posts: 180
Joined: Sun Jul 26, 2015 4:03 pm

Re: Messaging between multiple Maple Mini clones

Post by simonf » Sat Aug 27, 2016 10:11 pm

joevpt wrote:Thanks Simon for the connection clarification. Before I go do it, can I clarify that the pull-up is required on both lines and a diode is required on each tx line ?

Each MCU in this setup can therefore read every transmission and confirm its own message ( like Old Ethernet looking for a collision).

I like it!
As for the pull up resistor(s) it depends on the bus length etc like the old ethernet 10 base T you normally had a terminator at each end. But it will depend on the length and thus the capacitance of the bus the longer the bus the more capacitance and the lower the resistor. I use 10K on a 30cm Bus. Yes you need a signal diode for each tx, the tx goes low when transmitting so the cathode goes to tx and anode to rx. Its a really cheap network.

The latest version of STM32 has TX and RX buffering so handling the packets is even easier.

joevpt
Posts: 12
Joined: Sat Aug 27, 2016 6:38 pm

Re: Messaging between multiple Maple Mini clones

Post by joevpt » Sat Aug 27, 2016 10:45 pm

Great Simon, and again thanks for the fast reply. I'll get to this tomorrow. 30 cm is more than enough for me so I will use some 10k resistors.

User avatar
RogerClark
Posts: 6729
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Messaging between multiple Maple Mini clones

Post by RogerClark » Sat Aug 27, 2016 11:05 pm

If you get this working, could you let us know and post a small schematic diagram

Thanks

Roger

simonf
Posts: 180
Joined: Sun Jul 26, 2015 4:03 pm

Re: Messaging between multiple Maple Mini clones

Post by simonf » Sat Aug 27, 2016 11:18 pm

joevpt wrote:Great Simon, and again thanks for the fast reply. I'll get to this tomorrow. 30 cm is more than enough for me so I will use some 10k resistors.
You only need two resistors one at each end you may get away with one. The higher the baud rate the lower the resistor value.

rreignier
Posts: 17
Joined: Tue Feb 16, 2016 8:52 pm
Location: Toulon, France

Re: Messaging between multiple Maple Mini clones

Post by rreignier » Sun Aug 28, 2016 1:56 pm

Hi,
What you trying to do seems to be what ST call Multiprocessor communication as explained at paragraph 27.3.6 in the F103 Reference Manual (RM0008).
I have never tried that but just wanted to let you know that is is documented by ST.

Post Reply