• AVR Freaks

Sending a break or similar signal --using MCP2200

Author
wnovin
Starting Member
  • Total Posts : 36
  • Reward points : 0
  • Joined: 2007/01/05 17:10:37
  • Location: 0
  • Status: offline
2011/03/18 08:59:49 (permalink)
0

Sending a break or similar signal --using MCP2200

I am looking to make a USB to RS-485 converter and found this (MCP2200) to be a logical choice.

However, I need to send a long break signal, a low level for at least two complete frames, with a BAUD of 250K.

This 'break' marks the beginning of a new data packet of 512 bytes, with the usual stop and start bit, actually 2 stop bits.

This is for the DMX-512 protocol.

How best/possible to accomplish this?

Thanks
post edited by wnovin - 2011/03/18 09:07:17
#1

5 Replies Related Threads

    chinzei
    Super Member
    • Total Posts : 2250
    • Reward points : 0
    • Joined: 2003/11/07 12:39:02
    • Location: Tokyo, Japan
    • Status: offline
    Re:Sending a break or similar signal --using MCP2200 2011/03/18 15:40:44 (permalink)
    0

    This 'break' marks the beginning of a new data packet of 512 bytes, with the usual stop and start bit, actually 2 stop bits.

    Maybe, you mean two start bits?
    For usual UART, 9-bits mode does this trick.
    - Shift left the first 8-bits data by 1 bit, and fill the LSB with 0
    - Load this 9-bits data to the UART
    - The data is shifted out to the TX pin in LSB first.
    - After sending this specific first byte, the UART gets back to 8-bits mode

    Unfortunately, MCP2200 can't do such a trick. It doesn't accept 9-bits setting.
    Also, the response of GPIO pin is too slow for a bit time of 250k baud, even if you would make the timing using a GPIO pin.

    Leave from MCP2200, move to CDC implementation on a PIC18F14K50
    MCP2200 is just a factory-programmed PIC18F14K50

    Tsuneo
    #2
    newfound
    Super Member
    • Total Posts : 1822
    • Reward points : 0
    • Joined: 2003/11/07 12:35:49
    • Status: offline
    Re:Sending a break or similar signal --using MCP2200 2011/03/18 16:08:19 (permalink)
    0
    NO DMX is two stop bits.

    The MCP2200 MAY only provides a LIN bus compatible break. If so, this is too short for DMX. This is a show stopper if you want your DMX to be compliant to the DMX specs. It can work with some receivers as some DMX receivers treat any framing error as a break. This is ok only for simple systems but not for industry. 

    The two stop bits can be accomplished with 9 bit transmission and setting the 9th bit to '0' However the MCP2200 does not allow this mode.

    Chinzei is right, forget the MCP2200 and instead use a PIC18F14K50. I can see no reason why you cannot reprogram the MCP2200 with the CDC stack and alter the CDC code to provide a true break in firmware and the 9-bit mode for the two stop bits.

    Doable with the PIC18F14K50 and some coding changes to the CDC stack but not with the MCP2200.

     
    EDIT: In fact the MCP2200 may not only provide a LIN bus compatible break. I am not sure where I got this information from and if it is accurate.

    post edited by newfound - 2011/03/22 20:12:13
    #3
    Deenayd
    Super Member
    • Total Posts : 905
    • Reward points : 0
    • Joined: 2004/09/08 06:15:13
    • Location: Poland
    • Status: offline
    Re:Sending a break or similar signal --using MCP2200 2011/03/21 08:01:31 (permalink)
    0
    You might want to try temporary slowing down baudrate when sending your break signal.
     
    I am doing something similar with my plug'n'play RS485 protocol - I'm temporary switching baudrate to slowest supported speed so that I can be sure all devices attached to the bus will see it as break signal (that signal works as plug'n'play 'anybody new out there?' call)

    Slawek Piotrowski
    Rejestracja Czasu Pracy Ewidencja Czasu Pracy
    #4
    DarioG
    Allmächtig.
    • Total Posts : 54081
    • Reward points : 0
    • Joined: 2006/02/25 08:58:22
    • Location: Oesterreich
    • Status: offline
    Re:Sending a break or similar signal --using MCP2200 2011/03/21 13:32:21 (permalink)
    0
    Hey, this is smart! Smile

    GENOVA :D :D ! GODO
    #5
    chinzei
    Super Member
    • Total Posts : 2250
    • Reward points : 0
    • Joined: 2003/11/07 12:39:02
    • Location: Tokyo, Japan
    • Status: offline
    Re:Sending a break or similar signal --using MCP2200 2011/03/22 17:52:57 (permalink)
    0
    I searched for DMX-512 and found the spec PDF, USITT DMX512-A, is floating over there. This chapter of the spec describes the exact timing.

    8.11 Timing diagram - data+
     
       |<--10 -->|<--1 -->| 2 | 4|<------ 14 ------->|7 |8 |
        _________          ___    __________________  __ __
       |         |        |   |  | : : : : : : : : : |  |  |
       |         |________|   |__|___________________|  |  |

                                  min   / typ    / max
     10 "Mark" before break       0     /  ---   / 1.00 sec
      1 "Space" for break         96 us / 176 us / ---
      2 "Mark" after break        12 us /  ---   / 1.00 sec
      4 START bit
     14 Start CCODE (slot 0 Data)
      7 STOP bit
      8 STOP bit


    Umm, I completely misunderstood the original post.
    It was Break AND two STOP bits.

    Just for the break, these Win32 API starts/stops break on TX pin of MCP2200.
    - Start break: EscapeCommFunction( SETBREAK ) or SetCommBreak()
    - Stop break:  EscapeCommFunction( CLRBREAK ) or ClearCommBreak()
    The length of break is tunable by the timing between these calls on a PC application. As the break and mark periods are rough on the spec, it's easy to make this timing on an application.

    Rather, two STOP bits may be the problem, because MCP2200 doesn't accept setting change other than baudrate.

    In this post, bmwman91 has posted scope observation of TX signal of 230400bps, which is closer to 250kbps for DMX-512.
    http://www.microchip.com/forums/m559736.aspx

    On this capture, STOP bit doesn't seem to have two bit time.

    Tsuneo
    post edited by chinzei - 2011/03/22 17:59:59
    #6
    Jump to:
    © 2019 APG vNext Commercial Version 4.5