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.

Help! Serial communication protocol question (for RS-485)

Status
Not open for further replies.

eepty

Full Member level 2
Joined
Oct 21, 2005
Messages
143
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Activity points
2,611
I am doing a project in which two MCU communicate to each other by RS485. I used a UART to RS485 IC on each side, so the communication is actually through UART.

I have done the hardware and software, after debugging for a long time, they can communicate now. However, in my protocol, if a package is dropped, the communication will stop.

My protocol:
1. 'A' go into Tx mode (as RS485 is halfplex)
2. 'A' start to send a byte to 'B'
3. 'A' wait for 10ms and then go into Rx mode
4. 'B' is in Rx mode at the begining, if 'B' received the byte, it wait for 50ms and then go into Tx mode.
5. 'B' send a byte to 'A', and then wait for 10ms and go into Rx mode again
6. If 'A' received the byte, it wait for 50ms and go into Tx mode again.

Can you suggest a better protocol for RS485 communication?
 

Your protocol seems to be OK, but you should have a time out in receive.

---------- Post added at 10:18 ---------- Previous post was at 10:14 ----------

For example :
1. 'A' go into Tx mode (as RS485 is halfplex)
2. 'A' start to send a byte to 'B'
3. 'A' wait for 10ms and then go into Rx mode for 100ms
4. 'B' is in Rx mode at the begining, if 'B' received the byte, it wait for 50ms and then go into Tx mode.
5. 'B' send a byte to 'A', and then wait for 10ms and go into Rx mode again
6. If 'A' received the byte, it wait for 50ms and go into Tx mode again and else if after 100ms no byte received, do anything
 

if you can afford to add a little in the circuit then you can use two separate UART to RS-485 converter (E.g Max-485) for RX and TX, then the communication will be full duplex, no need for any protocols....
 

My Friend ... I recommend to use ModeBus protocol it is the best protocol for RS485

Best Regards

MedTronic
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top