+ Post New Thread
Page 1 of 2 1 2 LastLast
Results 1 to 20 of 25
  1. #1
    Junior Member level 1
    Points: 90, Level: 1

    Join Date
    May 2019
    Posts
    17
    Helped
    0 / 0
    Points
    90
    Level
    1

    UART-->RS485 (transmission is finished and it may respond)

    Hello everyone,
    hope right branch I've chosen.

    UART --> RS485 interface:
    Could anyone explain me which way the slave knows that transmission is finished and it may respond to the Master?

    BR

  2. #2
    Member level 3
    Points: 2,053, Level: 10
    Achievements:
    7 years registered

    Join Date
    Dec 2009
    Location
    USA
    Posts
    54
    Helped
    15 / 15
    Points
    2,053
    Level
    10

    Re: UART-->RS485 (transmission is finished and it may respond)

    The Master should be ready to receive after it sends the last byte to the slave

    Low-latency industrial RS-485 Communications ..
    http://www.ti.com/lit/wp/spry265/spry265.pdf


    1 members found this post helpful.

  3. #3
    Junior Member level 1
    Points: 90, Level: 1

    Join Date
    May 2019
    Posts
    17
    Helped
    0 / 0
    Points
    90
    Level
    1

    Re: UART-->RS485 (transmission is finished and it may respond)

    ОК,
    What does this bit stand for? Could you tell me?
    Last edited by intiCA; 12th May 2019 at 19:50.



    •   AltAdvertisement

        
       

  4. #4
    Super Moderator
    Points: 77,827, Level: 68
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    15,771
    Helped
    3590 / 3590
    Points
    77,827
    Level
    68

    Re: UART-->RS485 (transmission is finished and it may respond)

    Hi,

    In my eyes this has nothing to to with RS485 (as physical interface), it should be defined by the protocol.
    Which is unknown by now.

    Klaus
    Please dont contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



  5. #5
    Super Moderator
    Points: 260,240, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    45,443
    Helped
    13827 / 13827
    Points
    260,240
    Level
    100

    Re: UART-->RS485 (transmission is finished and it may respond)

    Regarding DE deassertion delay, there's normally no reason to extend the driver enable beyond the stop bit, presumed the RS-485 lines are pulled to idle level by bias resistors.



  6. #6
    Member level 3
    Points: 2,053, Level: 10
    Achievements:
    7 years registered

    Join Date
    Dec 2009
    Location
    USA
    Posts
    54
    Helped
    15 / 15
    Points
    2,053
    Level
    10

    Re: UART-->RS485 (transmission is finished and it may respond)

    Quote Originally Posted by intiCA View Post
    ОК,
    What does this bit stand for? Could you tell me?
    On some hardware, detecting exactly when the last bit of the last byte is finally shifted-out the port, may be difficult to know.
    DE must go LOW, after the last BIT of the last BYTE is shifted-out.
    The "Transmit Buffer Empty" Flag might be SET when the Last Byte is initially sent to the Shift-Out Register.
    So then the software needs to DELAY as that byte is shifted out, PLUS a 1 or 2 "Bit Time" delay before changing DE to LOW.


    1 members found this post helpful.

  7. #7
    Super Moderator
    Points: 81,430, Level: 69
    Achievements:
    7 years registered
    Awards:
    2nd Helpful Member
    betwixt's Avatar
    Join Date
    Jul 2009
    Location
    Aberdyfi, West Wales, UK
    Posts
    13,349
    Helped
    4456 / 4456
    Points
    81,430
    Level
    69

    Re: UART-->RS485 (transmission is finished and it may respond)

    Settling time for the idle condition is all I can think of. The protocol shouldn't matter as the device is only a driver, the output should follow the input. I wonder if the producer of the diagram was thinking of the time to empty a UART shift register rather than the interface itself.

    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.



  8. #8
    Member level 3
    Points: 2,053, Level: 10
    Achievements:
    7 years registered

    Join Date
    Dec 2009
    Location
    USA
    Posts
    54
    Helped
    15 / 15
    Points
    2,053
    Level
    10

    Re: UART-->RS485 (transmission is finished and it may respond)

    Quote Originally Posted by intiCA View Post
    ОК,
    What does this bit stand for? Could you tell me?
    You can use an NA555 Precision Timer to control DE for "Automatic Direction Control" ...
    http://www.ti.com/lit/ug/tidubw6/tidubw6.pdf

    or you can use software.


    1 members found this post helpful.

    •   AltAdvertisement

        
       

  9. #9
    Super Moderator
    Points: 52,941, Level: 56

    Join Date
    Apr 2011
    Location
    Minneapolis, Minnesota, USA
    Posts
    12,948
    Helped
    2580 / 2580
    Points
    52,941
    Level
    56

    Re: UART-->RS485 (transmission is finished and it may respond)

    Quote Originally Posted by intiCA View Post
    What does this bit stand for?
    It's important for the receiving unit to stay in sync with each byte of data as it arrives. The sending unit sends a predictable sequence of bits, including a couple of idle bits in between.



    •   AltAdvertisement

        
       

  10. #10
    Super Moderator
    Points: 260,240, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    45,443
    Helped
    13827 / 13827
    Points
    260,240
    Level
    100

    Re: UART-->RS485 (transmission is finished and it may respond)

    The "Transmit Buffer Empty" Flag might be SET when the Last Byte is initially sent to the Shift-Out Register.
    So then the software needs to DELAY as that byte is shifted out, PLUS a 1 or 2 "Bit Time" delay before changing DE to LOW.
    That may be true for a software implementation if you have difficulties to determine the exact frame end, but what should be the purpose of delaying DE? UARTs with built-in RS485 flow control usually don't delay the transmit enable beyond the stop bit, they however may assert DE before the start bit, FT232 e.g. does.
    Note that the TXDEN is activated 1 bit period before the start bit. TXDEN is deactivated at the same time
    as the stop bit.
    - - - Updated - - -

    PIC 24/32 UART is generating a transmitter idle status bit (TRMT) which becomes valid after the stop bit. Hardware transmitter enable is operated according to TRMT, without additional delay.



  11. #11
    Junior Member level 1
    Points: 90, Level: 1

    Join Date
    May 2019
    Posts
    17
    Helped
    0 / 0
    Points
    90
    Level
    1

    Re: UART-->RS485 (transmission is finished and it may respond)

    Hello everyone,

    Roughly, it may say that getting of distorted, unreadable Chars, as a variant of course, is a result of some kind of cutting, either it is start bit or stop bit, while transmission phase. Worse yet, it may be both cutted.

    You know, both devices don't have any settings regarding mentioned above delaying. I can just imagine an answer of both manufactures regarding their firmware... "Our firmware is ok, it was tested!"

    As far as I understand the delaying bits can be implemented via firmware changing only.

    BR
    Last edited by intiCA; 13th May 2019 at 13:08.



  12. #12
    Super Moderator
    Points: 260,240, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    45,443
    Helped
    13827 / 13827
    Points
    260,240
    Level
    100

    Re: UART-->RS485 (transmission is finished and it may respond)

    Roughly, it may say that getting of distorted, unreadable Chars, as a variant of course, is a result of some kind of cutting, either it is start bit or stop bit, while transmission phase. Worse yet, it may be both cutted.

    You know, both devices don't have any settings regarding mentioned above delaying. I can just imagine an answer of both manufactures regarding their firmware... "Our firmware is ok, it was tested!"
    Useless considerations without referring to the protocol used by the devices, I think.

    Are you reporting a specific problem? If so, please mention the relevant details.

    If you are discussing the topic generally, please notice that half duplex communication can't work without a protocol followed by all involved devices. Industrial protocols like MODBUS have strict specifications of transmission timing, they can be implemented and verified straightforward.



  13. #13
    Junior Member level 1
    Points: 90, Level: 1

    Join Date
    May 2019
    Posts
    17
    Helped
    0 / 0
    Points
    90
    Level
    1

    Re: UART-->RS485 (transmission is finished and it may respond)

    Quote Originally Posted by FvM View Post
    Useless considerations without referring to the protocol used by the devices, I think.

    Are you reporting a specific problem? If so, please mention the relevant details.

    If you are discussing the topic generally, please notice that half duplex communication can't work without a protocol followed by all involved devices. Industrial protocols like MODBUS have strict specifications of transmission timing, they can be implemented and verified straightforward.
    I'm afraid, you are wrong. Many industrial devices communicate with each other and they are even not aware, that there are protocols at all, especially industrial.

    Firmware --> UART-->RS485.

    Well,
    the Master is set to so-called 'transparent' protocol. Have you ever heard about this protocol? I'm almost sure -not. Also I'm almost sure you'll never find any volueable information on this protocol. If you will. I would be much appreciated.
    The slave works on the sheme Firmware --> UART-->RS485.

    BR



  14. #14
    Member level 3
    Points: 2,053, Level: 10
    Achievements:
    7 years registered

    Join Date
    Dec 2009
    Location
    USA
    Posts
    54
    Helped
    15 / 15
    Points
    2,053
    Level
    10

    Re: UART-->RS485 (transmission is finished and it may respond)

    Quote Originally Posted by FvM View Post
    That may be true for a software implementation if you have difficulties to determine the exact frame end, but what should be the purpose of delaying DE? UARTs with built-in RS485 flow control usually don't delay the transmit enable beyond the stop bit, they however may assert DE before the start bit, FT232 e.g. does.


    - - - Updated - - -

    PIC 24/32 UART is generating a transmitter idle status bit (TRMT) which becomes valid after the stop bit. Hardware transmitter enable is operated according to TRMT, without additional delay.
    I do not see where member intiCA stated a PIC 24/32 was being used?

    But if true, then per the PIC32 UART manual, section 21 & page 31 ...
    Their example RS-485 Circuit suggests using the RS-232 RTS / CTS lines to control the RS-485 TX-Enable & RX-Enable hardware lines.
    RTS & CTS are controlled by Software, which surely has execution delays.

    You suggest using the TRMT flag ...
    But "TRMT" is just a Status Bit in a Read-Only Register for the RS-232 UART that must POLLED by Software, again execution delays.
    So, how can the TRMT ... a read-only status bit .. control the RS-485 TX-Enable & RX-Enable Hardware lines?

    - - - Updated - - -

    Quote Originally Posted by intiCA View Post
    Hello everyone,

    Roughly, it may say that getting of distorted, unreadable Chars, as a variant of course, is a result of some kind of cutting, either it is start bit or stop bit, while transmission phase. Worse yet, it may be both cutted.

    You know, both devices don't have any settings regarding mentioned above delaying. I can just imagine an answer of both manufactures regarding their firmware... "Our firmware is ok, it was tested!"

    As far as I understand the delaying bits can be implemented via firmware changing only.

    BR
    You may need to get a Digital Scope and/or a Digital Analyzer connected to the RS-485 line to determine the root cause of this problem.
    What hardware are you using?
    What Software Protocol are you using?

    - - - Updated - - -

    Did the RS-485 communications ever work properly, or is this a new install?

    - - - Updated - - -

    When does the bad comm happen?

    a) When the Master sends a message to the Slave?
    b) When the Slave replies to the Master?
    c) Both ways ?

    Do any packets get sent & received without comm errors ?
    Last edited by summitville; 13th May 2019 at 15:27.


    1 members found this post helpful.

  15. #15
    Advanced Member level 3
    Points: 7,460, Level: 20
    Achievements:
    7 years registered

    Join Date
    Jul 2010
    Location
    Sweden
    Posts
    996
    Helped
    382 / 382
    Points
    7,460
    Level
    20

    Re: UART-->RS485 (transmission is finished and it may respond)

    Standalone RS232 to RS485 converters can't know where the end of the stop bit is, because the baudrate is unknown.
    One solution I have seen is to only activate the driver for level '0' and for '0' to '1' transitions. The driver is disabled a short time after a '0' to '1' transition, shorter than the shortest possible time for one bit.
    There must be resistors that guarantee the '1' state when no driver is active on the bus, but that is normally a good idea anyway.
    With such standalone converters, the DE (driver enable) signal is handled automatically, no software control is necessary.


    1 members found this post helpful.

  16. #16
    Junior Member level 1
    Points: 90, Level: 1

    Join Date
    May 2019
    Posts
    17
    Helped
    0 / 0
    Points
    90
    Level
    1

    Re: UART-->RS485 (transmission is finished and it may respond)

    Quote Originally Posted by summitville View Post
    You may need to get a Digital Scope and/or a Digital Analyzer connected to the RS-485 line to determine the root cause of this problem.
    What hardware are you using?
    What Software Protocol are you using?
    Bingo! You are right. I think I have to purchase an oscilloscope (it is final straw).

    Quote Originally Posted by summitville View Post
    Did the RS-485 communications ever work properly, or is this a new install?
    This is a new install. Consider that as an experiment within a project.

    Quote Originally Posted by summitville View Post
    When does the bad comm happen?

    a) When the Master sends a message to the Slave?
    b) When the Slave replies to the Master?
    c) Both ways ?
    Do any packets get sent & received without comm errors ?
    Well,
    Half-Duplex variant.
    the green one is received very seldom;
    the orange one is received almost constantly. And always the same unreadable chars there are.
    What else... I think, that all commands are being transmitted by Master very well. Because I observe always the same picture - adequate answers from the slave. True, they are mostly 'orange'.

    Adequate -means correct number of Chars, e.g. the command 'A' implies 4 Chars in respective answer (as it's shown), the command 'Z' implies 9 Chars in respective answer, etc.
    Moreover, sometimes I see 'green' one.



    BR
    Last edited by intiCA; 13th May 2019 at 18:41.



  17. #17
    Super Moderator
    Points: 77,827, Level: 68
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    15,771
    Helped
    3590 / 3590
    Points
    77,827
    Level
    68

    Re: UART-->RS485 (transmission is finished and it may respond)

    Hi,

    I'm afraid, you are wrong. Many industrial devices communicate with each other and they are even not aware, that there are protocols at all, especially industrial.
    Im designing industrial electronics and this statement can only be true on (propritary) full duplex peer to peer communications.

    All Ive done so far was with a known protocol where all the communication is specified.

    This leads me to some questions:
    * are we talking about 2 pair (full duplex) or 1 pair (half duplex) interface?
    * is it a peer to peer interface or a true (multiple salves) bus?

    Standalone RS232 to RS485 converters can't know where the end of the stop bit is, because the baudrate is unknown.
    The circuits Ive seen use the RS232 control lines (usually RTS) to enable/disable the RS485 transmitter.

    Klaus
    Please dont contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



  18. #18
    Junior Member level 1
    Points: 90, Level: 1

    Join Date
    May 2019
    Posts
    17
    Helped
    0 / 0
    Points
    90
    Level
    1

    Re: UART-->RS485 (transmission is finished and it may respond)

    Quote Originally Posted by KlausST View Post
    Hi,


    Im designing industrial electronics and this statement can only be true on (propritary) full duplex peer to peer communications.

    All Ive done so far was with a known protocol where all the communication is specified.
    As I wrote above, the Master is set to so-called 'transparent' protocol. The Slave doesn't know any known industrial protocols like Modbus, etc.
    The slave just executes commands which are programmed in its firmware.


    Quote Originally Posted by KlausST View Post
    This leads me to some questions:
    * are we talking about 2 pair (full duplex) or 1 pair (half duplex) interface?
    * is it a peer to peer interface or a true (multiple salves) bus?
    RS485 half-duplex

    Master's hardware is unknown, the Slave uses MAX485.
    Still it's used Master and one slave. It's planned to hang on the bus up to five slaves.

    Quote Originally Posted by KlausST View Post
    The circuits Ive seen use the RS232 control lines (usually RTS) to enable/disable the RS485 transmitter.

    I did some study on slave's PCB and can definetely say that DE and RE are connected together.

    Klaus
    BR
    Last edited by intiCA; 13th May 2019 at 19:11.



    •   AltAdvertisement

        
       

  19. #19
    Super Moderator
    Points: 77,827, Level: 68
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    15,771
    Helped
    3590 / 3590
    Points
    77,827
    Level
    68

    Re: UART-->RS485 (transmission is finished and it may respond)

    Hi,

    The slave just executes commands which are programmed in its firmware.
    This is a protocol.
    Without protocol it can't recognize commands..

    Klaus
    Please dont contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



  20. #20
    Advanced Member level 3
    Points: 7,460, Level: 20
    Achievements:
    7 years registered

    Join Date
    Jul 2010
    Location
    Sweden
    Posts
    996
    Helped
    382 / 382
    Points
    7,460
    Level
    20

    Re: UART-->RS485 (transmission is finished and it may respond)

    Quote Originally Posted by KlausST View Post
    The circuits Ive seen use the RS232 control lines (usually RTS) to enable/disable the RS485 transmitter.
    I have two different types of standalone RS232-RS485 converters here that require no control signal, the driver is enabled/disabled automatically. There is no baudrate setting, and no specified "idle" time before another node can transmit.
    I don't have any schematic, so I can't tell all details of the designs.



--[[ ]]--