+ Post New Thread
Results 1 to 5 of 5
  1. #1
    Junior Member level 1
    Points: 812, Level: 6

    Join Date
    Feb 2016
    Posts
    18
    Helped
    0 / 0
    Points
    812
    Level
    6

    XMEGA UART TO RS485 problem

    Hi

    I wrote simply program to send data from uC to PC. I use PIC UART and ft232. It works.

    Now, I would like to transfer my weather measuring system from my room to the garden. USB does not work at such distances (20m). That's why I decided to use RS485. I think, the easiest solution is to use RS485 in full duplex configuration. Unfortunately, the microprocessor does not send or receive messages from PC. My connection cables are very short, 0.2m. In my opinion, this is a hardware problem. I cant find solution to fix it. Could you check if I have a mistake in the electrical schematic?

    I tried to add a 120ohm resistor and a 3.3V to 5V converter. It doesn't help.


    https://datasheets.maximintegrated.c...487-MAX491.pdf

    Click image for larger version. 

Name:	rs_485fullduplex.jpg 
Views:	6 
Size:	111.0 KB 
ID:	157339

    •   AltAdvertisement

        
       

  2. #2
    Super Moderator
    Points: 83,027, Level: 70
    Achievements:
    7 years registered
    Awards:
    2nd Helpful Member
    betwixt's Avatar
    Join Date
    Jul 2009
    Location
    Aberdyfi, West Wales, UK
    Posts
    13,648
    Helped
    4535 / 4535
    Points
    83,027
    Level
    70

    Re: XMEGA UART TO RS485 problem

    You haven't enabled the MAX489!
    Tie '/RE' to ground and 'DE' to 5V to enable the receiver and transmitter circuits. You should ideally add a resistor of about 120 Ohm across the receiving end of each pair. It might work without them over short wire lengths but you certainly need them if the distance between ends is greater than about 5m.

    Incidentally, this is RS422 not RS485, electrically they are very similar but full-duplex.

    Brian.
    PLEASE - no friends requests or private emails, I simply don't have time to reply to them all.
    It's better to share your questions and answers on Edaboard so we can all benefit from each others experiences.



    •   AltAdvertisement

        
       

  3. #3
    Junior Member level 1
    Points: 812, Level: 6

    Join Date
    Feb 2016
    Posts
    18
    Helped
    0 / 0
    Points
    812
    Level
    6

    Re: XMEGA UART TO RS485 problem

    DE and RE are on constant potential:
    DE - 5V
    _RE - 0V

    I added resistors: 2x 120ohm to AB and 2x to ZY.
    Still no transmission. Is the wiring diagram correct?

    Click image for larger version. 

Name:	QlY0hWwl.png.jpg 
Views:	5 
Size:	29.6 KB 
ID:	157341

    Why this is not RS485 but RS422?



    •   AltAdvertisement

        
       

  4. #4
    Super Moderator
    Points: 83,027, Level: 70
    Achievements:
    7 years registered
    Awards:
    2nd Helpful Member
    betwixt's Avatar
    Join Date
    Jul 2009
    Location
    Aberdyfi, West Wales, UK
    Posts
    13,648
    Helped
    4535 / 4535
    Points
    83,027
    Level
    70

    Re: XMEGA UART TO RS485 problem

    RS485 uses only two wires and has a protocol for deciding which direction the bus information is traveling, it also specifies how devices in parallel on the bus are addressed so only one device at a time tries to drive the bus.

    RS422 is electrically almost the same but it uses four wires (as in your schematic), two for transmit and two for receive. Because there are different wires for outgoing and incoming data, there is no need for the bus direction to reverse. The idea behind the 'DE' pin is it electrically isolates both the transmit pins so other devices can share them. Obviously, only one device on a shared bus should have 'DE' enabled at any time or there would be a data collision.

    Your schematic should work. Try temporarily removing the MAX489 and linking the TX and RX wires from the FT232. It should echo back everything sent to it from the PC. If that works, refit the IC then remove the uC and link the RO and DI pins that were connected to it. Again, it should echo back as before. If it does, the problem is in the uC, if it doesn't the problem is in the connections between the two MAX489s.

    Note that you only need the terminating resistors at one end of the wire pair, normally the end receiving data.

    Brian.
    PLEASE - no friends requests or private emails, I simply don't have time to reply to them all.
    It's better to share your questions and answers on Edaboard so we can all benefit from each others experiences.



  5. #5
    Super Moderator
    Points: 81,029, Level: 69
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    16,431
    Helped
    3730 / 3730
    Points
    81,029
    Level
    69

    Re: XMEGA UART TO RS485 problem

    Hi,

    You need to add a GND connection.

    Do you have a proper twisted pair cable with about 120 Ohms characteristic impedance?

    Klaus

    Additionally I recognized: you crossed the differential lines: --> connect A with Y and B with Z.
    You should use a 3.3V RS422 device for the right hand side 3.3V logic circuit.
    Each device needs to be connected to the same GND (uC, both RS422, FT232, PC)
    Please don´t contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



--[[ ]]--