Hi,
Ward's code has problems with any DMX controller that doesn't have a long MARK time between the last DMX value and the BREAK. Chauvet brand controllers work fine, but my uDMX USB adapter does not. The symptom is that the values in the DMX buffer will be randomly shifted by 1-4 addresses, causing wild flickering and whatnot.
The problem is because of an interaction between the Teensy software buffer, the hardware FIFO, and Ward's new code. Briefly, a frame error interrupt will be generated whenever a BREAK occurs. In the frame error ISR, any leftover previously-received data is processed by calling dmx_bufferService. However, this only retrieves data that has already been stored into software buffers by the Teensy uart0_status_isr. There may still be other data in the hardware RX FIFO, since
the default configuration for the Teensy allows up to 4 bytes to get queued before the uart0_status_isr is fired. Right now, that data ends up in the wrong place, the new frame.
With some controllers, this is not a problem because uart0_status_isr is also fired during a long idle, which may allow the receive FIFO to have been emptied immediately before the BREAK. But this idle period ("mark time between packets" in DMX spec) has no minimum length, so it's perfectly valid for controllers to leave it out.
Sticking with Ward's approach of trying to work with what we've got, one approach is to set UART0_RWFIFO=1 so that the Teensy uart0_status_isr handler is triggered immediately after each byte. Then some small changes are needed to our uart0_error_isr, since the frame error may already get cleared by the status ISR; other than that it's basically the same.
Of course, the best solution would be to integrate uart0_error_isr into the Teensy code so that breaks are properly detected and handled in sync with the status ISR.
I've updated and cleaned up the DmxReceiver code, repackaged it into an Arduino library with example code, and uploaded it to Github:
https://github.com/jimparis/DmxReceiver. I also took the liberty of slapping the usual Teensy (MIT) license on the files. Ward, if you don't agree with that, just let me know and I'll fix it.