| Electronics > Projects, Designs, and Technical Stuff |
| Multi microcontroller communication |
| << < (4/5) > >> |
| rstofer:
--- Quote from: servoGuy on December 25, 2018, 10:47:41 am ---Thanks for the helpful replies. I thought about SPI because I need quite a high speed rate with 10Mbit/s. For UART I would therefore need high oversampling (~speed * 8). CAN Bus might be an option if I use the newer FD CAN. However CAN also needs time segments and therefore kind of oversampling. Thats why I came up with using SPI. I will do some small test setup trying to convince the MCU to only respond when the address bytes are correct although the slave select is tied high/low. --- End quote --- More often than not, it is the low going CS' signal that tells the peripheral to start listening and thus this signal frames the transaction. Look very carefully at the timing diagrams for your MCU to see if tying CS' permanently low will even work. High speed CAN runs between 40 Kbps and 1 Mbps per second depending on cable length. This is easily in the range of RS485 and nowhere near 10 Mbps as required above. https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019LzHSAU In fact, if the UART is fast enough, RS485 can run up to 25 Mbps http://www.ti.com/lit/ds/sgls367e/sgls367e.pdf |
| rstofer:
It's not just the baud rate you need to consider on the MCU side. I would assume that incoming chars are grabbed in an interrupt routine so preamble and postamble code are considerations. In addition, there is the overhead of putting the chars into a circular queue. Some MCUs have DMA and the DMA controller can manage a circular queue. This would probably be limited to the more high end MCUs. In gross terms, a serial UART stream of 10 Mbps interrupts at 1 MHz - 1 us per char. I have no idea how fast the code will run without looking at the choice of MCUs. A 16 MHz, 1 instruction per clock, probably isn't anywhere near fast enough. Plus there is the pipeline flush on entry and return to consider. Branch taken delay... At the 10 Mbps data rate, there is a lot to consider. When you need to worry about a pipeline flush, you're in serious trouble for speed. Consider writing the interrupt handler in ASM or marking the interrupt C function 'naked' and doing your own preamble/postamble in inline assembly. Every cycle is going to count! If a transaction is very long or very frequent, will there be any compute cycles for the mainline? |
| Richard Crowley:
It is not clear what level(s?) of communication you are talking about here. The Open Systems Interconnect model has seven layers from physical through application. You mentioned speed and hinted(?) at physical distance (adjacent?) But did I miss average message length? Or protocol, master/slave, contention, etc. requirements? I was impressed that ROBIN seemed like a sensible protocol standard. RJ45 connectors and UTP wiring are ubiquitous, dirt-cheap and quite high-speed. And Ethernet-type magnetics (even built into RJ45 connectors) are great for isolation. But that is just the Physical Layer and does not compel you to use TCP/IP or even CDMA/CD |
| servoGuy:
To clarify my request. I plan a single master multiple slave network containing only MCU´s. I would like to easily physically add or remove slaves which is why I would like to not use a solid backplane with slots for add-on cards or similar. Instead the add-on cards shall each connect to the previous one beside an end card for termination etc. The total maximum number of add-on cards is 10. Therefore I am looking for a communication interface which is commonly available on typical MCU´s like STM32, AVRs.... For the lowest, physical, layer M-LVDS, RS485 or similar should be sufficient. 10Mbit/s was a calculation with some margin for protocol overhead etc. One of the applications is a laser system with quite high update rates. @David Hess: Ethernet would be an elegant solution and a field I am very familiar in. But most MCU´s have only one Ethernet MAC and I need that one for the communication with a linux computer. Furthermore Ethernet would lead to EtherCat which would mean each card would get twice as expensive. Thats why I thought about SPI. |
| max_torque:
Given that there is no requirement to provide a data bus with any significant "length" (ie you haven't got much distance between your slaves) then why not just use a basic parallel architecture. An 8b wide data bus, with 4 address lines would be trivial to implement, and pretty fast without having to run high slew rates / bit rates etc Slaves could have a 4 way dip switch on them, setting their binary address, slaves could only transmit when the address lines are all lowered again by the master after the command message has been sent. simple, flexible, and you could probably do the whole thing with raw microcontroller ports these days (no buffers) and as your slaves are all local, it's trivial to provide say a 12b wide (+power) interconnection with say male/female pin headers allowing stacking of slaves etc |
| Navigation |
| Message Index |
| Next page |
| Previous page |