1
\$\begingroup\$

I am currently working on a project where I need to receive DMX512 data from a standard DMX lighting controller using an STM32G030K8T6TR microcontroller. I am using the Arduino IDE with the STM32 board support package.

Hardware Configuration

  • Microcontroller: STM32G030K8T6TR
  • UART Pins: PA10 (RX) for receiving DMX data
  • Direction Control: PA8 used to control the DE/RE pin of the RS485 transceiver (set LOW for receiving)
  • RS485 Transceiver: THVD1400DR
  • DMX Source: Standard DMX512 lighting controller

What I Have Tried

I have tested several DMX libraries, including:

  • DMXSerial,
  • DMXSerial2,
  • DMXSimple.

Unfortunately, most of these libraries are designed for AVR architecture and include AVR-specific headers such as <avr/interrupt.h>, which are not compatible with STM32.

Additionally, the libraries I found either support only transmission or fail to function properly for receiving on STM32 targets. I am simply looking for a method or library that will allow me to receive DMX512 channel data on the STM32G030K8T6TR using the Arduino IDE environment. Any guidance, working examples, or recommendations for compatible libraries would be highly appreciated.

Marcus Müller
109k5 gold badges148 silver badges286 bronze badges
asked May 26 at 10:14
\$\endgroup\$
2
  • 2
    \$\begingroup\$ Why do you need to use some mystical 3rd party libraries to receive DMX? If you use STM32, are you using C or assembly or some other language, and are you using STM32 HAL for UART, no libraries, or Zephyr or what? This isn't really an electrical engineerinh issue, but more like under what software framework you want to work with to use UART to receive DMX. Edit: Just saw, you want to use Arduino framework. Maybe Arduino.SE is more suitable place to ask then. Personally, I would use something else. \$\endgroup\$ Commented May 26 at 11:22
  • \$\begingroup\$ Starting point: github.com/mathertel/DmxSerial2/issues/31 \$\endgroup\$ Commented May 26 at 13:08

1 Answer 1

1
\$\begingroup\$

DMX512 is really not a hard-to-implement protocol, especially if you only need to receive. Just configure your UART for around 250 kbd, and the right framing. You might need to wait in software for the "break" condition, and then enable the UART. Plenty of time for that.

There's really several existing STM32 implementations, most of which should work directly on STM32G0. I'm not going to assess them for you, but here's three from my first page of search results (your search results will look different):

winny
18.1k6 gold badges53 silver badges74 bronze badges
answered May 26 at 10:23
\$\endgroup\$
7
  • \$\begingroup\$ Yes, but are they compatible with the Arduino framework? The OP didn't clearly say if he is open to bear metal or if he wants to use the Arduino framework, no matter what... But my personal feeling is that it is required to be Arduino compatible. \$\endgroup\$ Commented May 26 at 12:55
  • \$\begingroup\$ the Arduino framework doesn't take much ownership of anything unless you tell it to, so, yes, this should not be a problem (and if it becomes a problem, comment out the offending code in Arduino; there's really no much sensible other way than to use an UART to receive UART, so if Arduino can't work with the UART peripheral...) (also, arduino is not the right software platform for this, but that's a more overarching issue) \$\endgroup\$ Commented May 26 at 13:34
  • 1
    \$\begingroup\$ @Blup1980 Does Arduino framework allow triggering on the Break UART frame? If not, the libraries are MCU-specific and need to be written for specific Arduino platform by essentially replacing the UART library with a better one, and at that point, why bother with Arduino any more, if the stuff you want to do are so complex Arduino can't handle it out-of-the-box. After getting STM32 HAL up and running with UART, writing an interrupt based reception handler that triggers on Break frames is a no-brainer. \$\endgroup\$ Commented May 26 at 15:35
  • \$\begingroup\$ @Justme I agree 100%. I personally almost always work with the HAL with help of CubeMX. But the OP seems to be interested in Arduinos, and if we provide answers that are incompatible with that framework, it might miss the point of the OP. \$\endgroup\$ Commented May 27 at 11:41
  • \$\begingroup\$ @Blup1980 also agreed, but if Arduino can't let a user use the UART, then Arduino simply won't help the user – any other Arduino solution would then just go ahead and disable Arduino's control of the UART just as much \$\endgroup\$ Commented May 27 at 11:54

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.