Sections
You are here: Home Forum Development Discussion RS-485 and DMX

RS-485 and DMX

Up to Development Discussion

RS-485 and DMX

Posted by Tristan Gates at April 10. 2007
I was looking at the data-sheet for the controller trying to see if I could answer some questions I had before I posted here. I noticed in the USART section, it is mentioned that the controller can use RS-485 signals (pg 327). Will this ever be implemented in the API? Could this be used to allow the board to transmit and/or receive DMX for lighting equipment?

RS-485 and DMX

Posted by Liam Staskawicz at April 11. 2007
We're not too likely to add RS-485 into the API anytime soon. If you make some headway on it, share it!

Re: RS-485 and DMX

Posted by Hugobox at August 04. 2008
DMX capabilities would be awesome. Implementing the Artnet protocol via the ethernet would be even greater. How would one go about implementing the RS-485 protocol into the Make?

Re: RS-485 and DMX

Posted by Liam Staskawicz at August 04. 2008
The UART on the Make Controller does have an RS-485 mode. Pg 326 in the SAM7X manual has some details about it. Given this, it would be an issue of creating an API around it to make it easier to use. I imagine a decent chunk of the existing serial infrastructure could be of some help.

Re: RS-485 and DMX

Posted by Hugobox at August 04. 2008

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?

Re: RS-485 and DMX

Posted by Liam Staskawicz at August 04. 2008
Master clock is 47923200, or ~48 MHz.

Re: RS-485 and DMX

Posted by Hugobox at August 20. 2008

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 ?

Re: RS-485 and DMX

Posted by Liam Staskawicz at August 20. 2008
What else are you running on the board while trying your digital out technique? You could try running nothing but that, and upping the priority of your task so that it never gets interrupted - could provide you with some more speed. Otherwise, one of the outstanding peripherals on the board that needs to be wrapped up into a library is the Timer/Counter, which has some delay timing functionality. If you have the energy/experience to have a look, I would recommend checking out the SAM7X datasheet in the Timer/Counter section, operating in waveform mode. This would probably make for the cleanest solution.

Re: RS-485 and DMX

Posted by Hugobox at August 21. 2008

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.

Re: RS-485 and DMX

Posted by Liam Staskawicz at August 21. 2008
Mind pasting your code somewhere just to have a peek at what you're up to? Also, for more rapid correspondence come join us in the IRC channel - #makingthings on freenode.net. I've been seeing people use http://www.mibbit.com as an in-browser IRC client if you don't want to bother with downloading one.

Re: RS-485 and DMX

Posted by Hugobox at August 21. 2008
Good news, I've finally got some good results with the UART, got the 4us bitlenght, waveshape is beautifully square. The only thing weird is that the stopbits cannot be set to 2, it stays at 1.

Re: RS-485 and DMX

Posted by Hugobox at September 08. 2008
As mentioned before, the stopbit setting seems stuck to 1 stopbit.
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

Re: RS-485 and DMX

Posted by Liam Staskawicz at September 11. 2008
Great - thanks for tracking this down. The best place to log this for inclusion in a future firmware release is at http://dev.makingthings.com.
Powered by Ploneboard
Document Actions