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?

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).

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.

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 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.

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.