Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 8 of 8

Thread: DMX512 Transmit and Receive?

  1. #1

    DMX512 Transmit and Receive?

    Hi all,

    I am new to the Teensy, so please excuse my ignorance.

    I am considering a application where I want to both transmit and receive DMX at the same time. Not the same data though. In a previous project on another micro, I did this using a single UART, and it worked great. This is my first Teensy project, and actually my first time using C to do this. I believe it should work...but I wanted to check.

    So, questions:

    1. Is is possible to transmit and receive different things simultaneously on the same UART on the Teensy?
    2. Does anyone know of either a single DMX RX/TX library that would allow this natively, or separate RX and TX libraries that wouldn't mind that the other half of the UART is working?

    Thank you!

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,357
    Quote Originally Posted by jkoffman View Post
    1. Is is possible to transmit and receive different things simultaneously on the same UART on the Teensy?
    Yes.

    2. Does anyone know of either a single DMX RX/TX library that would allow this natively, or separate RX and TX libraries that wouldn't mind that the other half of the UART is working?
    That's a bit trickier, especially if you transmit the start-of-frame break by lowering the baud rate.

    An easier plan would be to use Serial1 to receive and Serial2 to transmit.

  3. #3
    Quote Originally Posted by PaulStoffregen View Post

    That's a bit trickier, especially if you transmit the start-of-frame break by lowering the baud rate.

    An easier plan would be to use Serial1 to receive and Serial2 to transmit.
    Hi Paul,

    Thanks for the reply (and the cool products!).

    Ok, gotcha. On my other micro I managed the break by putting the transmitter into standby, which then let me manipulate the line directly.

    I think for this project I'll stick to using two separate ports. I was trying to economize on pins, but making things too complex for my first Teensy project is probably not a great idea.

    Any suggestions for DMX libraries that use the UART? I'm looking at Ward's (link: http://forum.pjrc.com/threads/19662-...ll=1#post24993 ). I'm not sure if there have been any updates though. Still searching...

    Thanks!

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,357
    As far as I know, Ward's code is still the best for receiving.

    Transmitting is pretty simple, but you might want to edit serial1.c to increase the buffer size to 514 or more.

  5. #5
    Quote Originally Posted by PaulStoffregen View Post
    As far as I know, Ward's code is still the best for receiving.

    Transmitting is pretty simple, but you might want to edit serial1.c to increase the buffer size to 514 or more.
    Awesome, thank you for the info.

    I'm trying to do this first project using libraries that already work since I am so unfamiliar with the hardware. I grew up an assembly programmer, so switching to C has been a bit of an adventure as well. Hence the search for libraries that already are known to receive and transmit DMX. It's a hardware protocol I understand, so I'm hoping looking through those libraries will help me to get a better understanding of how the processor works.

    I have a few other questions, but I'll start a new thread as they're a bit more general hardware in nature.

  6. #6
    Junior Member
    Join Date
    Dec 2019
    Posts
    1
    Hey jkoffman,

    Pretty new to teensy, but working my way around using some existing libraries to get myself clued up.

    I've got an idea for a project that I'd like to receive and transmit DMX at the same time, did you get any further with your project?
    If you have any advice, would be much appreciated.

  7. #7
    Senior Member
    Join Date
    Mar 2017
    Location
    Oakland, CA, USA
    Posts
    169
    I have an open source project, TeensyDMX, that should do what you need. For simultaneous transmit and receive, you currently need to use two serial ports.

  8. #8
    Quote Originally Posted by goodingalex View Post
    Hey jkoffman,

    Pretty new to teensy, but working my way around using some existing libraries to get myself clued up.

    I've got an idea for a project that I'd like to receive and transmit DMX at the same time, did you get any further with your project?
    If you have any advice, would be much appreciated.
    Welcome to the club! Apologies for the late reply. Shawn's library is great, and a new version is coming soon too!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •