Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

CSMA/CD or CSMA/CA on RS-485 Network

Status
Not open for further replies.

Sobakava

Full Member level 6
Full Member level 6
Joined
Mar 27, 2002
Messages
350
Helped
8
Reputation
16
Reaction score
8
Trophy points
1,298
Activity points
3,342
rs485 collision

I am imlementing a full duplex RS-485 network (2pairs for send, 2 pairs for receive) with microcontrollers.

It is based on master-slaves architecture now.

I would like to implement multi-master bus also. Is it possible to CSMA/CD/CA with hardware or software way? Or is there something
different to make multi master bus?

And... Which protection diode are you using for RS-485?

Regards
 

csma cd vs csma ca

Why don't you use serial protocol with 485? It is easier. 8051 microcontrollers have a special 9 bit UART mode used for multiprocessor communications. Take a look at www.atmel.com for some documentation on this issue.

/pisoiu
 

csma/cd rs485

How to use 9th bit for multi-master communications?
 

rs485 collision detection

Usually, this mode is used as follow: A master transmit an address byte with the 9bit set. The slave is programmed to interrupt when 9 bit is active. The slave check if the address transmitted matches its own address, and if so, slave programm serial port to ignore the 9th bit. After that, exchange of data between master and slave occurs, all with 9 bit off, thus causing other slaves to ignore data. When done, slave set serial port to be sensitive to 9th bit again. To implement multiprocessor, you'll have to use some tricks. Obviously, only one master can speak at a time. Use a timeslot algorythm. Assign a timeslot to each master. A master can initiate a connection with a slave only when its timeslot is active. When its timeslot is active, he can send address to slaves. Use the sent packet to syncronise other masters. Eventually use 2 bytes packet for communication of address, one byte with master address, one with slave's. Knowing master address of the device which talk will help other masters to synchronise timeslots.

/pisoiu
 

csma/cd vs csma/ca

while using timeslots, how to start first data transfer? Can only first address master start data transfer?
In such system, how to avoid hot-swapping problems?
 

rs485 csma/cd

For multimaster the problem is complicated for all masters. Slaves have only to do their business and they just have to check an incoming address, with the 9 bit set. If two byte address are sent (both with 9 bit set) , slaves have to check both. If you plan to use no more than 16 masters and 16 slaves, then you can still use one byte for address (high nibble-master addr, low nibble-slave addr), or any combination which result in 8 bit word (ex. 8 masters+32 slaves=3+5bits). Unadressed slaves are unsensitive to all traffic with 9 bit cleared. But masters have to be sensitive to all traffic. Masters can send dummy addressing from time to time, to syncronise other masters. The main issue is to prevent two or more masters to talk at the same time. Example: after startup the master with tslot0 send dummy packet in the network (ex. for a non-existant slave, important is to know which master sent the packet). This synchronises other masters (use timers). When a certain master have to send data, waits untill its timeslot became active, then sends address to slave. The communication begins. In the mean time, other masters must sniff the traffic, and forget any action if a data transfer is in progress (use 9th bit to see this). After the data transfer is closed, the master which ended transmission can send again another dummy packer to resynchronise the timeslot algorythm in other masters. About hot swapping, it is more complicated, I can give you only general hints. I would not reccoment this, because if you insert a device into 485 net when a data transfer is in progress, most probably you will corrupt the data. This means you'll have to implement CRC/checksums. If you want to use dynamic addresses for masters and slaves, then...dunno...you'll have a loooot of work to do. Try first to avoid hotswaping and use static addresses for devices.

/pisoiu
 

csma cd rs485

I think CAN bus is what you want.
 

csma rs485

modbus is a good protocol and simple,but single master
 

rs485 csma

My current protocol is almost the same with modbus but as I said, I need multi-master protocol. Because I've some trigger inputs, I've to tell the host about triggers immediately. I can not wait to ask 100 slaves one by one... Because most slaves are idle mostly... I need more efficient method...

Is it possible to sense RS-485 bus is empty or not electrically or by software?

Regards
 

csma cd and csma ca

Sobakava, CAN is the answer.

Of course you can sense RS485 bus is idle by simply implementing time out on the serial receive. If no byte received in say 1 second, the bus is idle. However, what happens when two devices start sending data at the same time?

If you can implement Master/slave system, it is easy. But as you mentioned, polling could be a problem. Multi master protocol can only be done if the units can recover from a bus collision (like the CAN hardware) or are disciplined about when to send data (like a token ring passing network).

Ajay
 

csma/cd in rs-485

Yes, CAN bus is suitable.

If I am not wrong, the electrical standard of CAN bus is same as RS485, but with collision detection built-in.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top