Open andyboeh opened 2 years ago
Probably the idf function uart_write_bytes_with_break
is what you need. But I don't know if it can be used in esphome.
Thanks for the answer and adding this possibility. Unfortunately, according to the docs, it doesn't work without sending data. For DMX, the break has to be sent first.
I think that I'll still be able to come up with a portable solution, though:
pinMatrixOutDetach
, set the pin, wait, clear the pin, pinMatrixOutAttach
uart_set_line_inverse
, wait, uart_set_line_inverse
SET_PERI_REG_MASK
, delay, CLEAR_PERI_REG_MASK
Thank you for starting to dig into this. Adding this functionality seems a lot cleaner for the dmx-512 implementation.
- ESP32 Arduino:
pinMatrixOutDetach
, set the pin, wait, clear the pin,pinMatrixOutAttach
can you write an example of use in the esphpme component?
Check https://github.com/andyboeh/esphome-dmx512, there are separate files for ESP32, ESP8266 and ESP32IDF. Or directly: https://github.com/andyboeh/esphome-dmx512/blob/49541b1e6bb9e897339fd8640298e9b1cc622923/components/dmx512/dmx512esp32.cpp#L11
Describe the problem you have/What new integration you would like
I am working on a DMX-512 implementation based around the MAX485 IC. The UART can be used for sending data, but a break signal of a specific length needs to be sent before starting the transmission. Unfortunately, this is not supported by the UART component.
Please describe your use case for this integration and alternatives you've tried:
I suggest a new
sendBreak(usecs)
method that allows sending of the break signal.Additional context
There are a few workaround options that I could find for different controllers that involve either changing the baud rate on-the-fly and sending a 0 byte or detaching the Tx pin and driving it manually for the break generation. However, that is hardware-specific and can't be done in the DMX component.