Go Down

Topic: different serial baud rates for rx and tx (Read 3557 times) previous topic - next topic



is there a way to have the arduino send data at one baud rate and receive with a different one?

i am using the pins 0 and 1 on an arduino pro mini.
the rx pin receives dmx data at baud 250K
i also want to send out data on the tx pin but at a lower baud rate.

i mainly want to do this, because i can't figure out how to make my max osx computer read serial at 250K baud, since it is not a standard baud rate and not defined in termios.h



The hardware serial port operates at one rate for tx and rx.

You could use SoftwareSerial to send data at a different rate using another pin…



If you take an Arduino Micro you get the same processor as used in the Leonardo which means that you have a Serial object to talk to the PC by USB and you have a Serial1 object which represents the hardware serial on pins 0 and 1. On the Serial object you can set any baud rate because it's not relevant, the communication is as fast as the USB part of the processor can handle it.


From the '328P datasheet re: USART:
"The dashed boxes in the block diagram separate the three main parts of the USART (listed from the top): Clock
Generator, Transmitter and Receiver. Control Registers are shared by all units. The Clock Generation logic consists
of synchronization logic for external clock input used by synchronous slave operation, and the baud rate
The baud rate generator goes to both the transmit and receive shift register.
You would need to use
Code: [Select]

// receive some data
Serial.end(); // or whatever the syntax is
Serial.begin (230400); // or whatever
// send some data

to able to change speeds, and connect only Rx to DMX and only Tx to the mac.

Simpler might be to use a '1284P chip with 2 serial ports.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.


Apr 11, 2013, 04:47 pm Last Edit: Apr 11, 2013, 04:49 pm by Graynomad Reason: 1
If there are large times between data packets and also the packets aren't very large you can simply read X chars at 250k then change the baud rate and write them at that other rate. Then swap back to 250k and repeat.

But it depends on the relative speeds and the frequency at which you receive data at 250k and the nature of this data, IE if you know when there is a break in the flow.

Rob Gray aka the GRAYnomad www.robgray.com


thanks to all.

i will try switching the baud rates between sending and receiving.

ideally i would figure out how to get my mac to receive at 250k baud.

i read about aliasing baud rates which is done by altering System/Library/Extensions/FTDIUSBSerialDriver.kext

ftdi has also talks about this in it's manual:
http://www.ftdichip.com/Support/Documen ... Driver.pdf


Go Up