mathertel / DMXSerial

An Arduino library for sending and receiving DMX packets.
BSD 3-Clause "New" or "Revised" License
320 stars 76 forks source link

Anyone having clock stability experience? #62

Closed EinDev closed 2 years ago

EinDev commented 2 years ago

I tried using the DMXSerial with a cheap Nano node and it didn't work. Signals shift from one channel to another (the data itself is fine though, just at the wrong place sometimes) If i change the "Mark Between slots" on my controller to 40 (it doesn't say which unit, but 4 is the default) it works fine.

Now, #26 suggests it could be an issue with the clock. That's why i bought other arduino nano's which seemed better quality. Unfortunately it didn't work and had the same issue. I measured the clock accuracy using the "Blink" sample, it did switch at a constant rate of 49,950Hz and the code was 50Hz.

Do you have any experience what Clock accuracy should be "OK"? Or maybe the issue could be somewhere else? I just got an analog oscilloscope, so i can't verify the signal integrity after the SN75176, but the waveform looks good (rectangular ;) ) as far as i can tell.

mathertel commented 2 years ago

I have had some boards that missed packets on some DMX setups so yes it may be a topic.

Receiving the dmx packets using the hardware Serial interface is based on the system cpu clock. That needs to be stable and high enough. I use standard Arduino boards and custom boards with the library running on 16 MHz only. The nano with the original specification should net be different and uses the same processor.

Be sure to use a propper dmx line terminaton.

When your sketch has critical timing and shops interrupts that you will see that packets are missing and dmx channels will shift. The DMXProbe mode may help in some situations as it stops receiving while not waiting for the next full DMX cycle.