data bus between modules - Page 1
Forum section: electronics / projects

author: alireza7
author_rank: Regular Contributor
timestamp: December 12, 2017, 05:59:55 pm
content: hii want to design a product which contains different modules.i want to design each module in a separate pcb layer and finally pcb layers will Put together like floors of a building and they connect to each other by pin headers.my design have a main pcb contains a main micro controller that manage the whole system.in each module there exist a micro controller which have data exchange with the main micro controller and also manage the work of module.for example one of the modules contains a sim800 and take care of send and receive sms.how should i manage data exchange between modules? what data bus is the best solution? i2c? spi? any ic sugestion for driveing data bus?my final product should pass Electostatic discharge , Radiated electromagnetic field , Conducted electromagneticfield , ... and various environmental tests.my final product should be capable of adding an other module in future easily.

author: ebclr
author_rank: Super Contributor
timestamp: December 12, 2017, 06:09:10 pm
content: What will be the speed / bandwidth you will need, To you want to minimize wires or get more bandwidth, It's crucial to explain what is the kind of boards, it's to generic to any help

author: alireza7
author_rank: Regular Contributor
timestamp: December 12, 2017, 06:22:34 pm
content: i want to assign maximum 5 pinsminimum required speed 28.8 kbpsit is sufficient if at a moment just two modules be capable of communicating with each other.

author: alireza7
author_rank: Regular Contributor
timestamp: December 12, 2017, 06:26:33 pm
content: also i'm not sure but i think it is better to have just a single master which is the main micro controller and other sub modules be slave

author: ajb
author_rank: Super Contributor
timestamp: December 12, 2017, 11:47:14 pm
content: 28kbps is pretty slow. Just about anything could manage that.Does 5 pins include power, or you have 5 signal pins available?Full duplex UART would be only two pins, but would require that all devices agree on a baud rate. A clocked interface might be better, because if you later decide you need more throughput you won't have to go changing baud rates everywhere. It also means you could more easily get by without crystals on some of the sub boards. That means USART, SPI, and I2C are options. All will fit into five pins easily, but wouldn't leave you enough pins for discrete chip select lines, so you will have to have some sort of addressing mechanism built into your protocol. I2C has this by default, so that's a point in its favor, but depending on the overall system size and number of devices, it may be challenging to get it working at higher speeds. SPI or USART would be somewhat easier in this regard since they're actively driven from both ends. SPI has an advantage in that the CS signal provides an inherent frame delimiter, so you can use that to allow your slave devices to identify the beginning and end of a message easily. With a USART you'd have to include either a separate framing signal (at which point you basically have SPI), or define a packet format that includes some sort of frame delimiting, or use a break signal or timeout to delimit packets.A one master/many slaves approach is definitely simpler. Multi-master systems are possible, but you have to have some sort of bus arbitration system to resolve situations where two masters try to take control of the bus at the same time. A single master system does require that the master poll all of the slaves for status changes, so it would be a good idea to include an interrupt line so that slaves can signal when they need the master's attention.

author: Jeroen3
author_rank: Super Contributor
timestamp: December 13, 2017, 10:53:54 am
content: Quote from: alireza7 on December 12, 2017, 05:59:55 pmYou can use a multi master bus like CAN bus, RS-485.But you will need a way to detect the address/number of each device if you want multiple of the same device on the bus. One way to do this would be to use one connector pin and put a small resistor on it.master - R1 - R2 - R3 - R4 - R5 - terminator.For I2C you could use this as well to determine each board address.I'm sure there are others ways as well.Other way would be to use a serial protocol, like spi, and daisy chain all modules. However, this could get slow.