Go Down

Topic: Serial library with non standard bit rates? (Read 1 time) previous topic - next topic

skyjumper

Do you plan to use NewSoftSerial with an on chip UART or with digital pins? If you don't have a hardware UART, and you're working with sync data, you're going to be banging your head against the wall. Its easy enough to make it move data, but as soon as you try to do something with that data at the same time, its gets frustrating.

Codeman

#6
Aug 12, 2011, 02:09 pm Last Edit: Aug 12, 2011, 02:22 pm by Codeman Reason: 1
Hi skyjumper,

no UART :-)
I need to generate a signal for driving digital modell locomotives (not DCC but Motorola-Märklin). So my other end of the communication is a decoder chip inside the locomotive. I have a rough manual how to generate the frames with a serial line at 19200 bit/s but you have to do some strange timing things to get the right signal. I thaught that it is better to generate the signal without that strange things but for this you "might" have to send the frames with a non-standard bit rate (s. http://modell-zug.com/Support/HowToArticles/DigCtrlSys/DigitalTransmission.htm). I read some documentation where they don't use exactly 4800 bit/s... but I'm not sure.

Regards, Holger
Perl is the only language that looks the same before and after RSA encryption.

MarkT

Quote
It sounds like you are talking about synchronous communication - no start or stop bits. If that is the case, you can use the SPI function of the processor.


The Arduino hardware SPI is limited to a fixed set of frequencies derived from the processor clock divided by powers of two.  Successive bytes may not be bit-synchronous with each other - you'd have to test that.

To generate an accurate fixed frequency the use of timer1 (which has 16bit precision) is a possible way - using a timer interrupt would be the most accurate way to use that timer to push bits out.

However the UART is probably the simplest way (if you can configure 0 start bits and 0 stop bits?)
[ I won't respond to messages, use the forum please ]

Bill_Kerr

Hi Codeman

Just a thought, have you considered using the Motorola Trinary Encoder to handle the packet generation and timing.  It has its own oscillator timing.

http://www.datasheetcatalog.org/datasheet/motorola/SC41343DW.pdf

You would have to provide the 8 bit byte to the chip, but it may simplify your processor design/programming as the chip would handle packet generation and the resend for reliability.

Quick google, and the chip appears to be in the $15-$20 US range.

Regards  Bill
Don't you just hate ONE D 10 T problems?

skyjumper


Hi skyjumper,

no UART :-)
I need to generate a signal for driving digital modell locomotives (not DCC but Motorola-Märklin). So my other end of the communication is a decoder chip inside the locomotive. I have a rough manual how to generate the frames with a serial line at 19200 bit/s but you have to do some strange timing things to get the right signal. I thaught that it is better to generate the signal without that strange things but for this you "might" have to send the frames with a non-standard bit rate (s. http://modell-zug.com/Support/HowToArticles/DigCtrlSys/DigitalTransmission.htm). I read some documentation where they don't use exactly 4800 bit/s... but I'm not sure.

Regards, Holger


Which Arduino are you using? You should be able to do this with a bunch of them. For example, the 324/644/1284 chip should be able to do this nicely with its onboard USART. These USARTs can do quite a bit more then the arduino code allows as is, but its very easy to hack the code to set up the USART as you need it. If you look at the HardwareSerial.cpp begin() method, you'll see that there is not too much to it.

 

Go Up