Multiple BS2s on a Single Serial Line?
CRussell
Posts: 15
Have a project I'm working on that would potentially require me to use up to 4 BS2's at once, each one controlling it's own set of logic, memory, inputs, etc.· Programming the chips independently I can do in the design.· However, the question is, can I wire the serial lines (0/1) to each chip together in parallel (ie all the BS2s see the same serial data coming over the serial port from the computer)?· No chip will be transmitting information at first, they'll only be receiving instructions which they'll be storing in external memory.· I plan on making a flag in the serial data being sent to identify which chip should be listening to the instruction, but the question remains, will the chips function properly if they're all listening to the exact same serial line?· And potentially, if it was setup properly, could they all transmit with SEROUT on the same serial port line if its ensured that no 2 BS2s will be talking at the same time?
Any insight would be greatly appreciated!
Any insight would be greatly appreciated!
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
This uses RS485 for the network because it's multi-drop and fairly noise resistant over significant distances.
Your post will help a lot of other Users understand;What to do. and what not to do.
I think this is A good thing
Have You looked at a "ONE WIRE" setup???. This might work for You and it might not.just A thought
_______________$WMc%______________out____
The "OpenBaud" mode is designed for a "party line" approach. In other words, you have several BS2's connected to the same party line. This works as long as you never have two BS2's trying to talk at the same time -- if you do, in the OpenBaud mode, they'll 'collide' and the messges will be garbled, but no damage will be done.
And the "party line" does need a pull-up resistor, since the "OpenBaud" mode implements a "drive low, float high" approach for the I/O pins. This insures you never have two BS2's where one "drives high" while one "drives low", which results in a dead short which can burn out I/O pins.
Another way to implement this approach is to have a "master" BS2, which has a "talk" party line and a separate "listen" party line. The others are "slave" BS2's, which listen on the 'talk' line, and talk on the 'listen' line. Then it's up to the "Master" BS2 to 'ask' for input from particular 'slave' BS2's, and make sure only one 'slave' BS2 talks at a time.
If you implement this EXACTLY as you said, I sense there may be a synchronization problem. If there is, I suspect someone here, me included, will have an almost immediate answer for you. We'll wait though to see if it occurs. This is just a forewarning, NOT an assessment of what may actually happen.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When all else fails, try inserting a new battery.
How long will they be?
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
The typical solution to this dilemma is to have a 'master' BS2 (here we go again) which 'talks' to the PC over its programming port. That BS2 then is the 'master' BS2 for the BS2 "party lines".
Note "classic" RS-232 ports, as used by the PC, ARE "Point to point" connections, NOT "Party Lines", and can't really be used as "Party Lines".· The BS2 "OpenBaud" approach only works between BS2's, and any other microprocessor that supports "Float-high, drive-low" signalling.· The PC absolutely does NOT support this approach.
Post Edited (allanlane5) : 12/2/2008 2:35:42 PM GMT
Thank you Allan. As soon as I posted that and looked at my diagrams the memory of the documentation saying 'Open Buad mode does not work if fpin is 16' came to mind. I kicked myself and quickly went back to reading docs again. Adding the switching transistors as Mike has suggested is an idea, but if I can get away with doing this with less hardware and more software, then that's a solution I can live with (my background is much heavier in software programming, then it is in hardware design). So at this point it looks like the solution will be for the PC to communicate with the first stamp (the new master) and if the message isn't for him, he'll broadcast it along the internal party line on a different pin for the other stamps to chew over. Thats if nothing else goes wrong in my memory. And Bill, the messages will always be 4 bytes in length.
The serial input lines (pin 3 on each of the 4 BS2-IC modules) can be tied together and will listen (SERIN) for the incoming 4-byte message from the PC.
For SEROUT, you can also tie together pin 4 on all 4 of the BS2-ICs. You have to understand how the p16 port is wired in the module. It is intrinsically "open" baud mode, because the transistor that drives the output is in what is called a wired-OR configuration. The wired-OR requires a pulldown resistor and that too is provided inside the BS2-IC, and in this case the 4 pulldown resistors in the 4 BS2-ICs will be in parallel. Not a problem. (The pulldown goes to the serial input, pin 3 on the BS2IC.) You propose to have only one BS2 talking (SEROUT) at a time. Great. Only the one that executes a SEROUT will pull the line high to transmit a signal. If two happen to talk at the same time by mistake, the message will be garbled, but there will be no danger of burning anything out.
You can either leave ATN open, or tie it to ground, or there might be some other scheme such as multiple reset/wakeup. But as you know, you will have to separate them when you need to reprogram the individual Stamps.
I've used the this parallel connection of multiple Stamps via p16, and it works fine.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com