Hi Simon,
Thank you so much for the help on this! That solved my problem with the data length. So subtle these syntax errors! I'm a LabVIEW guy trying to hack at text based code.
I had to solve one last problem that was really boggling me to get the protocol finally working. I had to insert a minimum 76us delay at the end of the loop before looping back around and executing the break again. I determined the value 76us empirically; 75us will not work. Looking at the TX line on a scope, I noticed without the 76us delay, there is an extra start bit and one data bit after the expected stream of data. The 76us is a constant value necessary regardless of the size of the data (SLOTS, number of for loop iterations in my case). Here's my code:
// BREAK
LPC_UART3->LCR |= 0x40;
wait_us(time_BREAK);
// MARK AFTER BREAK
LPC_UART3->LCR &= ~(0x40);
wait_us(time_MAB);
//TRIGGER
trigger = 1;
wait_us(40);
trigger = 0;
dmx.putc(0x00); // DMX[0] must be 0x00 or 0xFF
for (int n=0; n < SLOTS; n++) { // repeat writing the DMX UART for the number of slots
while (!dmx.writeable()) {}
dmx.putc(0x55);
}
// WAIT BEFORE LOOPING BACK TO BREAK
wait_us(76);
I'd be interested to hear from you if you have any idea about the reason for this behavior. Without knowing the system design, my conjecture is that perhaps the microprocessor takes around 76us to execute the UART data transfer and that the data is being transmitted from some buffer independently of the microprocessor. This is very curious...
Thanks again! Now that I have this UART communication working, it should be downhill (hopefully).
-Philip
Does someone know how to send a break character over UART1? I have to reset a device that requires a break character to be sent to enter reset mode.
Asif