Path: csiph.com!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!news.szaf.org!fu-berlin.de!uni-berlin.de!news.dfncis.de!not-for-mail From: =?UTF-8?Q?Hans-Bernhard_Br=c3=b6ker?= Newsgroups: comp.arch.embedded Subject: Re: What is the best communication mechanism with collision detection/avoidance for my topology? Date: Tue, 5 Dec 2017 21:23:41 +0100 Lines: 67 Message-ID: References: <73413cab-f8f3-4a23-a89d-5996fc23f917@googlegroups.com> <956d06da-01ba-47e8-be4a-479e740a61b7@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.dfncis.de g9AWI0bkJcUucl81FVqNjg7fqrY769PcUgwVP/M2e94iXN/cxAHzTCOBlc Cancel-Lock: sha1:bqIp8e/oG/2vXWRTA0CoR8ykQE4= User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 In-Reply-To: <956d06da-01ba-47e8-be4a-479e740a61b7@googlegroups.com> Content-Language: en-US Xref: csiph.com comp.arch.embedded:27447 Am 03.12.2017 um 08:06 schrieb T Obulesu: > _____________ _____________ > | | | > | Tx |------------|--------->| Rx | > | | | | | > |ATMEGA128 | | | ATMEGA8 | > | | | | | > | Rx |------------|------|-->| Tx | > |____________| | | |____________| > | | > | | _____________ > | | | | > | |---------->| Rx | > | | | | > | | | ATMEGA8 | > | | | | > |------|---------->| Tx | > | | |____________| [...] That topology, as shown, it broken. You've connected your master Tx to one slave Rx, but also several slave Tx'es. And vice versa. I'll assume you really meant +------------+ +------------+ | Tx |>------------------*---->| Rx | | | | | | |ATMEGA128 | | | ATMEGA8 | | | | | | | Rx |<-----------*------|----<| Tx | |____________| | | +------------+ | | | | +------------+ | *---->| Rx | | | | | | | | ATMEGA8 | | | | | *------|----<| Tx | | | +------------+ . . [etc.] > Here, the atmega128 is the main controller and all other atmega8 are connected to the main controller using rs485 cable. The type of cable is much less relevant than you probably think. The real question is what kind of line interfaces (a.k.a. transceivers) you're using on those lines. Let's assume they're RS485 transceivers. > What is the best communication protocol for this to detect and avoid collision.? None, because with this kind of topology, there really shouldn't be any collisions in the first place, so nothing to detect or avoid. You have a master controller, so how about letting it actually be the controlling master of the bus? The topology you described practically begs for a query-response protocol: master tells all slaves who is to talk next, and optionally what it's to talk about. The addressed device (master itself, or one slave) then talks; all others only listen. Repeat until the cows come home. Collisions are what you get if there's not one master, but many of them. That's when you really need collision mitigation techniques. If that's where you really want to go, fell free to google CSMA/CA and CSMA/CR and the protocols mentioned in connection with those. One good choice might then be CAN --- and it would save you half the wiring, too.