35.3.2 DMX Receiver
The DMX Receiver mode is configured with the following settings:
- MODE = 1010
- TXEN = 0
- RXEN = 1
- RXPOL = 0
- UxP2 = number of first byte to receive
- UxP3 = number of last byte to receive
- UxBRG = value to achieve 250K baud rate
- STP = 10 for two Stop bits
- ON = 1
- UxRXPPS = code for desired input pin
- Input pin ANSEL bit = 0
When configured as a DMX Receiver, the UART listens for a Break character that is at least 23 bit periods wide. If the Break is shorter than 23 bit times, the Break is ignored and the DMX state machine remains in Idle mode. Upon receiving the Break, the DMX counters will be reset to align with the incoming data stream. Immediately after the Break, the UART will see the “Mark after Break” (MAB). This space is ignored by the UART. The Start Code follows the MAB and will always be stored in the receive FIFO.
After the Start Code, the first through the 512th byte will be received, but not all of
them are stored in the receive FIFO. The UART ignores all received bytes until the bytes
of interest are received. This is done using the UxP2 and UxP3 registers. The UxP2
register holds the value of the byte number to start the receive process. The byte
counter starts at ‘0
’ for the first byte after the Start Code. For
example, to receive four bytes starting at the 10th byte after the Start Code, write
009h (9 decimal) to UxP2H:L and 00Ch (12 decimal) to UxP3H:L. The receive FIFO depth is
limited, therefore the bytes must be retrieved by reading UxRXB as they come in to avoid
a receive FIFO Overrun condition.
Typically, two Stop bits are inserted between bytes. If either Stop bit is detected as a
‘0
’, the framing error for that byte will be set.
Since the DMX sequence always starts with a Break, the software can verify that it is in sync with the sequence by monitoring the RXBKIF flag to ensure that the next byte received after the RXBKIF flag is processed as the Start Code and subsequent bytes are processed as the expected data.