Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Switch SPI master to slave

Status
Not open for further replies.

ArticCynda

Advanced Member level 1
Joined
May 8, 2013
Messages
439
Helped
82
Reputation
164
Reaction score
81
Trophy points
1,308
Activity points
4,238
Hi everyone,

I have an application where a daughter board collects data from multiple SPI devices (ADCs) on the board, processes this data using a MCU, and then transmits the data to the motherboard also over SPI. Basically, I need an MCU with both SPI master and slave functionality for this.

Would it be an option to connect the MOSI/MISO/SCK lines of both the ADCs and the motherboard together, and only multiplex the slave select lines? That is, assuming that it's easy to switch an MCU SPI peripheral back and forth from master to slave. Or would it be better to choose a larger (and more expensive) MCU with two separate SPI ports?

All advice is more than welcome!
 

Hi,

There is a big risk that this fails. A lot of special cases and timings you have to take care.

I recommend to use a microcontroller with two SPI busses.

Klaus
 
Thanks for sharing your thoughts guys. Would you consider a multiplexer to switch the MCUs SPI port either towards the slaves or towards the motherboard? Or will this just make things even more complex? There seem to be few small MCUs with two SPI busses, and seriously overkill for my application.
 

To prevent impacts all spi devices can remains slave till they will need to send a data.
 

Hi,

SPI isn´t made for multi master...

The problem isnt´adding a MUX in the signal lines.

The problem is to avoid bus malfunction. For this you need special software in each master.

How do you manage bus arbitration?
How do you control all the CS lines of the slaves?
How to avoid short circuits at all?
Is there a "small master " and a "master - master"?
What if one master doesn´t release the bus? How is it recognized and how to overcome this?

****
Overkill:
I expect way more effort in software and debugging and troubles than when you use two SPI busses.
(or one SPI bus and one UART or I2C...)

Klaus
 

Thanks for the elaboration, Klaus. After drawing out both options, it indeed seems a lot easier to just take a larger microcontroller with 2 SPI busses, and will likely also be more reliable.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top