Skip to content

Break condition not avaliable. #6

@robgal519

Description

@robgal519

I had issues with break condition that starts the DMX message.

I realized that on Linux I get following error:

.local/lib/python3.10/site-packages/serial/serialposix.py", line 62, in _update_break_state
OSError: [Errno 95] Operation not supported

I was able to overcome this issue and get my DMX device to work by modifying the send method:

    def start_frame(self):
        settings = self.ser.get_settings()
        settings["baudrate"] = int(4.0/11.0 * self.baudrate)
        settings["stopbits"] = 1
        self.ser.apply_settings(settings)
        self.ser.write([0])
        settings["baudrate"] = self.baudrate
        settings["stopbits"] = 2
        self.ser.apply_settings(settings)
    
    def send(self):
        self.start_frame()
        self.ser.write(bytearray(self.data))

As You may see, I lower the baudrate and send one byte of value 0 to simulate break condition.

About the coefficient, I read somewhere that break condition for DMX should take about 22bits.

so the time of transmiting 8 bits in slow baudrate should be greater than time to transmit 22 bits in baudrate for DMX512.
when using 250000 speed for DMX one bit takes 1/250000 s. so the whole stop condition should take 22/250000 s

to calculate baudrate to simulate stop condition we have following equation 22/250000 = 8/x from that x = 8/22 * 250000

After break condition the tx line should be put up for 2 bits, but in this implementation the reconfiguration of the uart takes much more time ( around 4ms, and minimum value is around 12 us) but from my tests the DMX clients do not care, and work as expected. this will just limit how fast we can send new update.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions