The company I work for design and manufacture industrial machinery. The current control system used on said machinery works via a main control board, with separate modules as and when needed depending on the extra options that particular machine requires. Currently I'm in the initial design concept stages of updating this control system as it's approaching 10 years old, so a few of the devices have gone obsolete, and in truth I think the system's a bit over stretched as the machine(s) that it controls have been further developed.
I'd like your opinions on a proposal to improve the communication within the system. At the moment I don't have any baud rates as speed isn't really what I'm concerned with right now, I'm more interested in how messages get from the host PC running the UI application, to each device in the system. The chain so to speak.
So as it stands the system works a little like this...
Comms, Slave 1, Slave 2 and Slave 3 are all ATmega1280s, and these 4 micros are on the main control board. As I understand it when this system was first designed, though there was the capability to communicate with external modules, there was no need for it at the time and no modules to communicate with.
So originally the comms chain as you can see from the above image was PC ---> Comms ---> Slave.
Fast forward to 2017 and this system not only has modules for all three slaves, but those modules have slave modules too...
Now while this works, there are flaws which I'm sure jump out to you straight away. For me the 2 main things are that any messages to modules 4, 5 & 6 have to go through everything else before it since RS-232 is point-to-point (as is UART within the main control board). and on top of that, should Module 1 stop working, then consequently so will module 4 (In truth this is the case for the first 3 slaves on the main board too).
Now initially the 3 slaves on the main board were there because the initial designer couldn't get all of the needed functionality out of 1 device (there are other reasons too related to how the system is set up which I'm not getting into now). What I'm going to do first of all is get rid of the first chain of UARTs from comms to the slaves, and have just 1 microcontroller on the main control board (an XMega to be exact). From here the main board will communicate to external modules via RS-485 like so...
The advantage this has is that the chain that the transmissions has to go through to get to it's intended target is pretty much always the same, and also that it doesn't matter if a slave goes down or is removed, it won't affect the rest of the system.
Here's the snag: With the old system, if the last module in the chain had a message to send back to the PC, it could do so at pretty much any time (once any prior transmissions from that module had finished of course). As I understand it, and please correct me if I'm wrong by all means, with RS-485 only the master can initiate transmissions. What I was thinking to get around this was to have an extra signal shared between master and all slaves. It would be Hi-Z in normal conditions (pulled high at some point, most likely master end), and then should a module have something to send back, it would pull this line low. At that point the master can poll all the slaves to see which one it is, once it finds it carry on and get the data to send back to the PC.
What are people's thoughts on this? Does it seem like a good approach? Can anyone thing of a better alternative? All feedback and suggestions welcome.
PS this project is in the very early stages of development, so by all means point out anything you think I might have not accounted for that you feel I should have, but please appreciate that I'm merely playing with ideas at this stage! :)