MAX485 Transceiver problem RS-485

Go To Last Post
72 posts / 0 new

Pages

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

After all transmitters release the TX RS485 driver, the bus may be left floating depending on termination and pull-up/pull-down resistors. Then the logic level may enter the low level after some time to discharge stray capacitances (the last defined logic level was high: stop bit). At this moment the USART circuits will detect a start bit and begin to receive a new byte. This byte will appear to have a valid start bit but with a false stop bit. Monitoring the frame bit will lead to discard the false byte. But again, if some transmitter started transmission during this process, the new data packet may be lost.

If no transmitter is active, the bus floating with a  logic level remained low (start bit condition), and a false byte was previously discarded.  Then a new transmitter activate the TX enable to drive the bus, the level is quickly defined as HIGH (the actual state of TX data bit, the STOP BIT) and as soon the start bit begins, the level goes LOW again. But now with real defined logic level. The signal at the bus is a quickly pulse at the beginning of transmission. Although the reception normally works fine, care should be taken in this case too.

 

RS485 normal and reversed pin drivers are built to be simetrical with same output/input impedance. But surges on the bus may damage the chips without taking then completely inoperative disbalancing pin impedance or damaging only one output or input. In such a condition the tri-stated logic levels may be disturbed and difficult detection. As transceivers may be far from each other and there may be several devices in the bus, identification of the damaged devices normally is very difficult. The communication is still working with downgraded service.  

 

So RS485 buses needs special care on the SW routine level to deal with boundary conditions that are normally not so known or expected. RS232 or TTL levels that works in full duplex conditions do not present such tricks.

 

 

Eng.Marco Aurélio Carvalho

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

have any one tried this ( rs-485 to TTL converter ) https://uge-one.com/index.php?ro... ?? 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've not used the max485 chip, but I have used the TI75176b which is similar. 

 

Jim

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There doesn't seem to be anything particularly magic about this board - it looks like just a max485 with the usual bias and termination resistors.

From what you described earlier about your application, you didn't need RS485 and your communications could be implemented with a few diodes and resistors. Is there a reason why you want Rs485?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It is just a plugin board assembly for the RS485 driver.
Any RS485 drivers are usable. Some one them have CMOS technology (low power), others TTL.
Some have waveform shaped to reduce high frequency components, others are faster to use high data rate, or to have higher input impedance, or other special feature that the manufacturer use to value its component.
But basically all do the same job and are even compatible at the same bus in majority of applications.

Eng.Marco Aurélio Carvalho

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

yes , i want it to be realistic ( semi pro ) in other terms , i don't want it to look as a basic simple communication channel i want it to represent somewhat the real world application . i searched for its schematic but it's pointless and time wasting , as it will be similar price after buying components . would care to illustrate what do you mean by diodes and resistors ? 

i've put alot of time and work to this , failing at the physical bus makes us ( embedded team ) look really bad 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

my main concern would be the Raspberry pi , as it's the master node which is controlling the bus would it be compatible ? meaning , when i plug the rx cable specially wouldn't i receive trash bytes ?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You may have put a lot of time into this, but you didn't put in a lot of thinking. This problem should've only taken hours to resolve had you employed a logical technique.

The diodes and resistors I explained in a previous post - maybe you didn't read it? 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

time and thinking i swear :D , can you tell me why u hate rs485 ? you want to go with simple , and professors here hate simple :D they want at-least deployable application , so they will ask me i'm sure of it will the communication still function if we take this and put it on scale 50m by 50m ? so after searching i've found rs485  by searching i mean avr freaks , here is my colleague post about it https://www.avrfreaks.net/forum/l... , back then we were just starting so we used snap the other thing was to rs485 my network :D 

 

give me a link to this thread plz 

Last Edited: Thu. Feb 9, 2017 - 10:10 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Where did I say i 'hate' RS485?? Remember - I have no idea of your constraints unless you tell me. To me, RS485 is simple - I've deployed thousands of nodes all around the world over the last 20 years. There's a handful of rules you need to follow and we've pointed this out to you. Break these rules and you'll have problems.

I've tried to point out potential problems and give you tools to solve your own problems. Solving problems is a skill you need to learn if you're going to go further in electronics. Realise that electrons are invisible to our eye - you need to formulate ways you can observe these electrons. Once you can see what is happening, then the solution is getting nearer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have used many of the various RS-485 transceivers on the market and they all pretty much work the same with the one exception that some float their RXD pin on the micro side so you have to either turn on the AVR pull up resistor, or add one to the board(safer bet).

 

Regardless of all the insight that has been already brought up, RS-485 is very easy to do.  If you are using Proteus, then use the tools it has(and Kartman has tirelessly told you to use) and look at the timing of the data lines from your micros with respect to the TX/RX line.  I am willing to bet the logic analyser will reveal the issue(s).

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i have used the scope , and doubled checked the timing , it works now , but with no 120 resistors , once i removed it , every thing is working nice and smooth but proteus doesnot simulate Raspberry pi , so this is what worrying me at this moment , i forgot to mark it solved .

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I set up here a Mega2560 as a slave, and a Mega128 as a master on the bench with MAX485's attached to both AVR's and came up with a very simple demo for you.  C files attached for teh respective AVRs

 

Make the following connections:

On both AVR's connect led's through 1kohm to PORTD  8 each.  This is where the data byte I am sending back and forth are seen

Connect the MAX485's to PORTE

 

PORTE0 to MAX485 pin1

PORTE1 to MAX485 pin4

PORTE2 to MAX485 pins 2 AND 3

 

Connect BOTH MAX485 pin7 together

Connect BOTH MAX485 pin 6 together

 

MAX485 Pins 8 and 5 connect to their respective power supplies.

 

On the Mega128 - the MASTER connect a switch to PORTE3.  Connect the other side of the switch to ground.  CLose the switch.

Connect normally open pushbuttons to the RESET lines and ground to BOTH AVRs.

 

Set a clock source for both AVR's to 3.686Mhz

 

The BAud rate for this demo is 9600

 

Compile the attached C files and load their HEX files into the proper AVR's 

The C file "Mega128_485_MSTR" is for the MEga128

 

The C file "Mega2560_485_SLV" is for the Mega2560

 

Once you have all the code compiled and loaded into the AVR's press the reset button on the slave first.  THEN the master. 

 

Now open the switch connected to PORTE 3.  If you have everything set up properly the LED's will blink in binary count up sequence.  If you close the switch on the master the counting stops.  If you break the RS485 lines the counting stops and will not restart.  You will need to reset both AVR's to get things going again.  I do not have fault tolerance in this demo. 

 

Essentially all that is happening is in each AVR there is a variable called COUNT.  Which starts at 0x00.  With each successful transmit sequence the COUNT is incremented by one and is sent again after a reception.  This happens as long as either the switch is open, or until something happens to the data lines.

 

The _delay_ms(250) is just there so you can see the LED's counting otherwise it's not very impressive. 

 

I have this running here on my desk, so I know it does work.

 

Jim

 

Edit:  In looking back I should have had the slave transmit back a different sequence, but thats irrelevant at the moment.  The whole Idea of this is to show you that your hardware is connected properly.

Attachment(s): 

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

Last Edited: Fri. Feb 10, 2017 - 05:21 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is the MAX485 man enough to drive the line as the OP has drawn it?

 

From the datasheet...

 

 

So we now need to know what current we are driving. Let's draw the circuit and simulate it...

 

 

The two generators are set to differential drive the 'line'.

 

And look at the current in the 1R resistors...

 

 

 

 

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Get rid of R4 and R8 for starters.  you only need those resistors at the host/head end, if at all.

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jgmdesign wrote:

Get rid of R4 and R8 for starters.  you only need those resistors at the host/head end, if at all.

 

Indeed. And, for the MAX range of chips under discussion you don't need them at all as the chips have fail-safe inputs.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Messiry wrote:
you want to go with simple , and professors here hate simple
What a sad indictment of academia that is. In the real world the majority of engineers spend the majority of their time trying to make things as simple as possible. Simple = less to go wrong and lower component cost. Most engineers would be fired for making things deliberately costly/complex - it's called "over engineering". If you can connect to CPUs with a couple of tin cans and a piece of string that's always going to be preferable to launching satellites and building satellite relay stations!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I like a saying that I heard, I don't recall who originated it. Paraphrasing, "a design is perfect when nothing can be taken out of it"

Tom Pappano
Tulsa, Oklahoma

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

tpappano wrote:

I like a saying that I heard, I don't recall who originated it. Paraphrasing, "a design is perfect when nothing can be taken out of it"

I think that was "Ed Muntz" looking at all the stereo systems that came into the shop when I was much younger! 

https://en.wikipedia.org/wiki/Ma...

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

yeah , i love simplicity . i had to choose between wired communication and wireless . stupidly , i choose wired thinking it should be simple , but afterwards we  hit obstacles(we didn't thought about it in planning phase) we wouldn't have faced ifwei went with wireless , sure wireless would have another issues  . i think i should have put some time into thinking as "kartman" said :S . time factor wasn't in our side .

Last Edited: Fri. Feb 10, 2017 - 11:08 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i'm out of town , will try it as soon as i'm back ( real HW i mean ) , thank you for taking time to help us :) i really appreciate this site here and all of your effort and patience ( i know i was annoying )  . 

Last Edited: Fri. Feb 10, 2017 - 11:10 PM

Pages