Pages: [1]   Go Down
Author Topic: different serial baud rates for rx and tx  (Read 912 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi.

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

thx.
Logged

0
Offline Offline
God Member
*****
Karma: 39
Posts: 988
Get Bitlash: http://bitlash.net
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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…

-br
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 108
Posts: 5144
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 533
Posts: 26943
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
generator."
The baud rate generator goes to both the transmit and receive shift register.
You would need to use
Code:

Serial.begin(250000);
// receive some data
Serial.end(); // or whatever the syntax is
Serial.begin (230400); // or whatever
// send some data
Serial.end();
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.
http://www.crossroadsfencing.com/BobuinoRev17
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

nr Bundaberg, Australia
Online Online
Tesla Member
***
Karma: 126
Posts: 8496
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: April 11, 2013, 09:49:39 am by Graynomad » Logged

Rob Gray aka the GRAYnomad www.robgray.com

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
http://www.dbpharrison.com/general/thermitrackdriver/

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

s.
Logged

Pages: [1]   Go Up
Jump to: