Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UART: support sending of break signal #1494

Open
andyboeh opened this issue Nov 1, 2021 · 5 comments
Open

UART: support sending of break signal #1494

andyboeh opened this issue Nov 1, 2021 · 5 comments

Comments

@andyboeh
Copy link

andyboeh commented Nov 1, 2021

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.

@martgras
Copy link

martgras commented Nov 3, 2021

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.

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/uart.html#_CPPv427uart_write_bytes_with_break11uart_port_tPKv6size_ti

@andyboeh
Copy link
Author

andyboeh commented Nov 4, 2021

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:

  • ESP32 Arduino: pinMatrixOutDetach, set the pin, wait, clear the pin, pinMatrixOutAttach
  • ESP32 IDF: uart_set_line_inverse, wait, uart_set_line_inverse
  • ESP8266: SET_PERI_REG_MASK, delay, CLEAR_PERI_REG_MASK

@Tuckie
Copy link

Tuckie commented Dec 4, 2021

Thank you for starting to dig into this. Adding this functionality seems a lot cleaner for the dmx-512 implementation.

@pruwait
Copy link

pruwait commented Sep 22, 2023

  • ESP32 Arduino: pinMatrixOutDetach, set the pin, wait, clear the pin, pinMatrixOutAttach

can you write an example of use in the esphpme component?

@andyboeh
Copy link
Author

andyboeh commented Sep 22, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants