Shop OBEX P1 Docs P2 Docs Learn Events
DMX protocol levels — Parallax Forums

DMX protocol levels

The logical level of DMX communication is built upon serial sending with 250.000 baud according the RS-485 definition using no parity bits and 2 stop bits.

Can someone give me a quick example of what this might actually look like sending?
im using "C" simpleIDE.

writeChar?
fdserial_txChar?
string?

thanks for any help.

Comments

  • JonnyMacJonnyMac Posts: 9,102
    edited 2021-09-30 23:13

    If you have your output assigned to a standard serial driver you won't be able to issue the required break (92us minimum per spec) -- the serial driver will hold the pin high in the idle state. It's best to use a dedicated driver, especially since DMX out is one direction and doesn't require bouncing between TX and RX. You're welcome to lift the PASM code from the attached object which I've deployed at Disneyland, Legoland, and in many other places (i.e., it's well tested). Sorry, I don't know how to convert a Spin object to a C library, but others do and can help you.

    This project uses that driver. The P1 is a DMX master controlling the output from several DMX "bricks" from a lighting company. The DMX output array is updated by five animation cogs that handle the various elements (four trees, bear, girl).

  • JonnyMacJonnyMac Posts: 9,102
    edited 2021-09-30 18:39

    Another thought: You can use the FlexProp compiler to write your program in C and include Spin objects. This code compiles with FlexProp, but I didn't try to run it.

    #include <stdio.h>
    #include <propeller.h>
    
    #define TX  20
    #define TXE 21
    
    unsigned char dmxbuf[513];
    
    struct __using("jm_dmx_tx") dmx;
    
    void main()
    {
        dmx.start(TX, TXE, dmxbuf);
    
        while(true) {
          // light 'em up, Danno!
        }
    }
    
  • ok so ive been trying different things, comparing a dmx signal with mine on an oscilloscope. i believe its either my "TTL to rs485" adapter or i need to speed up my baud some how.

    `

    include "simpletools.h"

    int i;

    long reset = 0b00000000000000000000000000;
    long marker = 0b1111;

    int valuestart = 0b00000000011;//dec 50
    int valueled = 0b00011001011;//dec 50

    int main(void)
    {

    // DMX = fdserial_open(-1, 14, 0, 250000);

    while(1)
    {

    shift_out(14, 12, LSBFIRST, 26, reset); // Value for MCTL register
    shift_out(14, 12, LSBFIRST, 4, marker); // Value for MCTL register

    shift_out(14, 12, LSBFIRST, 11, valuestart); // Value for MCTL register

    for( i=0; i<=4; i++ )
    {
    shift_out(14, 12, LSBFIRST, 11, valueled); // Value for MCTL register
    }

    //pulse_out(14, 1);
    //print(" = %d, \n", value00);

    }
    }`

  • JonnyMacJonnyMac Posts: 9,102
    edited 2021-10-26 00:35

    DMX baud is fixed at 250K -- which seems to be what you're using. Remember, though, that FDS does not know how to generate the BREAK condition, and this could be causing a problem. DMX devices wait for a valid BREAK condition before monitoring the DMX stream for their channel(s).

  • jmgjmg Posts: 15,173

    @JonnyMac said:
    DMX baud is fixed at 250K -- which seems to be what you're using. Remember, though, that FDS does not know how to generate the BREAK condition, and this could be causing a problem. DMX devices wait for a valid BREAK condition before monitoring the DMX stream for their channel(s).

    I think some TX systems change the base baud rate, to send break. They need to know when TX Shifter is done, to know when to restore 250k baud speed.

    If you send 1 stop bit at BreakBaud rate, then flip baud that's ~ 83k baud for timing.
    If you send 7 low and last bit high, (0x80) that gives 8 low bits and 2 high bits, so ~85k Baud delivers 94us Break and 23us MAB

  • im not sure fdserial is capable of 250000 baud, i set up a loop to receive all the data from a dmx controller and i just got a stream garbage.

  • JonnyMacJonnyMac Posts: 9,102
    edited 2021-10-26 17:57

    @bnikkel said:
    im not sure fdserial is capable of 250000 baud, i set up a loop to receive all the data from a dmx controller and i just got a stream garbage.

    You may be correct; even if receive is not deployed, the underlying software ping-pongs between TX and RX code segments which does limit its speed. If there is a transmit only library for SimpleIDE this would probably be the better choice for DMX.

Sign In or Register to comment.