19 May 2013

Update for the DMXSerial library

There is a significant update for the DMXSerial library on my web site that enables programming DMX devices on ARDUINO MEGA boards and ARDUINO Leonardo boards using the DMXSerial library.

The original library was written for Arduino 2009 and Arduino UNO boards that use the ATmega328 or ATmega168 chip. These chips only have a single Universal Synchronous and Asynchronous serial Receiver and Transmitter (USART) a.k.a. the Serial port in the Arduino environment. The DMXSerial library uses this port for sending or receiving DMX signals.

This conflicts a little bit with the usage of the programming mode the Arduino offers through then USB ports or serial interfaces but it is possible to build compatible DMX shields that don’t interfere with this usage if done right. The DMXShield is an example of this.

Arduino Leonardo

The Arduino Leonardo board uses a chip that has a USB 2.0 port available in addition to the USART. Therefore the “Serial” port is routed through the USB port that behaves like a serial port device and not the built-in USART. If you like to address the real Serial port you have to go with the Serial1.

But if you look at the hardware and the registers directly the USART0 still exists but the definitions for addressing the registers have changed (for example USART_RX_vect is now USART0_RX_vect). Therefore some adjustments had to be done.

With this board you can write debugging information to the Serial port in your sketch for debugging or data exchange purpose. So maybe a DMX diagnostic sketch can profit from that.

Arduino MEGA 2560

When using the chip on the Arduino MEGA 2560 board you have more than one USART available and maybe you wish to use port 1 instead of port 0. This can be done by enabling the definitions for port1 in the library just uncomment the line

#define DMX_USE_PORT1

ATmega8 boards

I added the definitions of boards based on the ATmega8 too for experimental purpose. If you find problems with these boards, leave me a note please.

Thanks to Bob Lynas to support me.


The updated version is available on my site at: http://www.mathertel.de/Arduino/DMXSerial.aspx.