DMX protocol levels
bnikkel
Posts: 104
in Propeller 1
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
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).
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.
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);
}
}`
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.
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.