RS-485 and DMX
Up to Development Discussion
DMX data must be sent asynchronously at 250kbit/s, with no parity and 2 stop bits.
Correct me if I read this wrong but the maximum baud of the USART equals the Master Clock divided by 16 (while the SPI max baud rate is Master Clock divided by 2) What is the Master Clock frequency?
I tried using Serial Write with the Usart, but the minimum bit lenght I could get is 100 us, which is too long (DMX needs 4 us). Using a digitalout pin I succeeded in getting the 4us lenght with the fasttimer, but the waveshape is nowhere near as clean as the usart one. And when trying to implement the DMX protocol, all the pieces of code increased the bit lenght up to 10us. Since DMX can be implemented on a 16mHz arduino, the 48Mhz Make should be able to do it also. Anybody has an idea ?
I tried removing everything but the low-level digital out (AT91C_BASE_PIOA->PIO_SODR = mask; ) function and upping the priority, still around 10us.
With the serial write, even setting te baud rate to 200000, doesn't make it faster than 100us per bit.
one temporary way to get the 2 stopbits working is to replace line 617 of serial.c:
( ( Serial.stopBits == 1 ) ? AT91C_US_NBSTOP_1_BIT : AT91C_US_NBSTOP_1_BIT ) |to:
( ( Serial.stopBits == 2 ) ? AT91C_US_NBSTOP_2_BIT : AT91C_US_NBSTOP_1_BIT ) |
but I'm hoping for a real fix for next firmware

