[RS485] can't perform handshake.

Started by SarAVR July 10, 2007
Hello all.

I am just a novice who wants to use ATmega8535 as a means to control RS485
communication devices.

Communication type to implement is full duplex and I used two MAX485
transceiver ICs per one board, one for transmitting and the other for
receiving.

As I burned ATmega microcontroller of main board with my code by ISP
programmer, RS485 communication seemed work well without any error between
main board and slave board and handshake was performed.

But when I reset ATmega microcontroller of main board and tried to start 
RS485 communication, frame error occurred or receive complete interrupt
did not occur at ATmega microcontroller of main board even though RS485
device of slave board finished transmitting, and receive function of main
board failed to work until next burning ATmega microcontroller of main
board in main board.

It seemed start bit of frame was not detected by ATmega microcontroller of
main board until next burning ATmega microcontroller of main board but I
don’t understand why such malfunction occurred.

So I would be much grateful if you tell me clue to solve such a problem as
I described.

I am just a novice so my way of explanation might be obscure, if that is
so, I beg pardon.

Thanks for reading my words and I wish good luck for everyone who dares to
go through difficult and creative ways while other people keep away.

						You’re sincerely.



SarAVR wrote:

> Hello all. > > I am just a novice who wants to use ATmega8535 as a means to control RS485 > communication devices. > > Communication type to implement is full duplex and I used two MAX485 > transceiver ICs per one board, one for transmitting and the other for > receiving. > > As I burned ATmega microcontroller of main board with my code by ISP > programmer, RS485 communication seemed work well without any error between > main board and slave board and handshake was performed. > > But when I reset ATmega microcontroller of main board and tried to start > RS485 communication, frame error occurred or receive complete interrupt > did not occur at ATmega microcontroller of main board even though RS485 > device of slave board finished transmitting, and receive function of main > board failed to work until next burning ATmega microcontroller of main > board in main board. > > It seemed start bit of frame was not detected by ATmega microcontroller of > main board until next burning ATmega microcontroller of main board but I > don’t understand why such malfunction occurred. > > So I would be much grateful if you tell me clue to solve such a problem as > I described. > > I am just a novice so my way of explanation might be obscure, if that is > so, I beg pardon. > > Thanks for reading my words and I wish good luck for everyone who dares to > go through difficult and creative ways while other people keep away. > > You’re sincerely. > > >
There is two type of handshacking: hardware and software. You need to understand which is used when. donald
SarAVR wrote:
> > Communication type to implement is full duplex and I used two MAX485 > transceiver ICs per one board, one for transmitting and the other for > receiving. > > As I burned ATmega microcontroller of main board with my code by ISP > programmer, RS485 communication seemed work well without any error > between main board and slave board and handshake was performed.
Like RS232, RS485 is only a hardware, not a software protocol. Before we can criticize we need to see _all_ the controlling software. -- <http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt> <http://www.securityfocus.com/columnists/423> <http://www.aaxnet.com/editor/edit043.html> cbfalconer at maineline dot net -- Posted via a free Usenet account from http://www.teranews.com
> But when I reset ATmega microcontroller of main board and tried to start > RS485 communication, frame error occurred or receive complete interrupt > did not occur at ATmega microcontroller of main board even though RS485 > device of slave board finished transmitting, and receive function of main > board failed to work until next burning ATmega microcontroller of main > board in main board. > > It seemed start bit of frame was not detected by ATmega microcontroller of > main board until next burning ATmega microcontroller of main board but I > don&#2013265922;?Tt understand why such malfunction occurred. >
Do you use failsafe termination? When the lines are floating the state is unknown and could be the same logic level as the start bit. If the start bit is send the line wouldn't change and the receiver is not seeing this bit. For fail-safe you need, besides the line termination, two resistors to bring the lines in well known states when floating.
On Jul 11, 9:23 am, "SarAVR" <furt4...@naver.com> wrote:
> Hello all. > > I am just a novice who wants to use ATmega8535 as a means to control RS485 > communication devices. > > Communication type to implement is full duplex and I used two MAX485 > transceiver ICs per one board, one for transmitting and the other for > receiving. > > As I burned ATmega microcontroller of main board with my code by ISP > programmer, RS485 communication seemed work well without any error between > main board and slave board and handshake was performed. > > But when I reset ATmega microcontroller of main board and tried to start > RS485 communication, frame error occurred or receive complete interrupt > did not occur at ATmega microcontroller of main board even though RS485 > device of slave board finished transmitting, and receive function of main > board failed to work until next burning ATmega microcontroller of main > board in main board. > > It seemed start bit of frame was not detected by ATmega microcontroller of > main board until next burning ATmega microcontroller of main board but I > don't understand why such malfunction occurred. > > So I would be much grateful if you tell me clue to solve such a problem as > I described. > > I am just a novice so my way of explanation might be obscure, if that is > so, I beg pardon. > > Thanks for reading my words and I wish good luck for everyone who dares to > go through difficult and creative ways while other people keep away. > > You're sincerely.
Snip:
> But when I reset ATmega microcontroller of main board and tried to start > RS485 communication, frame error occurred or receive complete interrupt
It seems device initialization is creating trouble here, sending some dummy data at device initialization might solve the problem. Write all the ISRs for used peripherals or write all the ISRs of your device with empty bodies (if you are not using one). ali