Skip to content

Strange timing behavior on Mega2560 #86

@McCallisterMicro

Description

@McCallisterMicro

I recently have run into a problem on a build that I've never seen before. I'm running on a an Arduino Mega2560, enabling #DMX_USE_PORT1 . I've been using version 1.5.3, but also tried 1.5.0.

I am setting up a DMX controller to handle about 6 fiber optic illuminators, as well as a few spot lights. Some of the illuminators are RGBW. I was getting strange results from them. It was as if the receiver couldn't quite follow the DMX data. I ended up doing a simple program with a series of write commands with delay() between them. A few different behaviors really stood out to me:

  1. The red channel, DMX address 1, would kind of cross-fade to near where it was supposed to be, but not quite reach it. If the level was supposed to be 0, it might end up at something like 6.

  2. The green and blue channels, DMX address 2 and 3, when being set to 255, would simply not register if the red channel was not also being used.

  3. if I was sending multiple channels, things behaved better.

  4. my Spot light fixtures could follow all of this without issue, behaving exactly as expected.

I then ran the DMX data into my DMXCat, a dmx testing tool that can display diagnostics on the signal. Strangely, the DMXCat could not detect a valid signal. Experimenting, a removed my 120 ohm termination resistor from my shield... and suddenly the data started registering. The analysis show the following information:

  • Break time: 97 microseconds
  • Mark after Break: 30 microseconds
  • interslot time: 0 microseconds
  • Mark before break time: -1953 microseconds (<<<This is very strange. I've NEVER seen that before. I believe it more typically is around 20-60 milliseconds, no idea how it even is negative here)
  • Number of Slots: 512
  • Update Rate: 48.2 Hz
  • Received Start Code 0x00 - DMX Present

I ended up eventually trying out the DMXSimple library, and it suddenly started working... granted, with a 10hz frame rate, because it doesn't use the hardware serial engine.

I've tried library versions 1.5.3 and 1.5.0.

As for circuitry, I'm using a copy of a circuit I've used with this library for almost 10 years. It follows a very similar design to the one depicted in the example shield. I have tested with both Max485 and TI THVD1400 chipsets. I've tried adding termination resistors, signal amplifiers, anything I can think of. The results very much seem to point to a timing error of some kind, but I'm baffled as to how.

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