Testing and setting...
 
Notifications
Clear all

Testing and setting baud rate on RS232 chain

6 Posts
1 Users
0 Reactions
24.2 K Views
(@Chris Dancer)
Posts: 12
Active Member Guest
Topic starter
 

I'd like to set up both my motors to 38400 baud at the start of my program. Is there a sequence of commands and port settings that will set all the motors on an RS232 daisy-chain to the same baud rate irrespective of what their rates and states were to start with?
I've been trying to work out how SMI does it when it detects motors. It seems to send 2 WAKE commands and a BAUD# command for each rate, and then a BAUD# command at the desired rate, but what if the RS232 port is set to a different rate to the motors at the start of this procedure? Won't the motors just ignore everything?

When a motor is in ECHO mode, does it act like a wire link and echo the state of the Rx line on the Tx line regardless of speed, or does it only echo characters that are received at the correct rate?

 
Posted : 12/09/2011 7:17 am
(@csearcy)
Posts: 316
Reputable Member Guest
 

If the commands are coming from a host, the motor defaults to 9600 and will receive commands at that baud rate. The host can send the BAUD# globally to set all motors to 38400, and then the host can switch to 38400 and continue communications.

The OCHN command can also be used in the SmartMotor program to set the port to 38400 when the program boots up.

When ECHO is off, only the response will be returned.
When ECHO is on, the command and response will be returned.
Note: The motor will only respond to commands sent at the correct baud rate.

 
Posted : 13/09/2011 1:26 pm
(@Chris Dancer)
Posts: 12
Active Member Guest
Topic starter
 

That's what I thought should happen, but when I tried it it didn't work, the motors just kept communicating at 9600. Maybe there was an uncleared error flag.
It occurred to me this morning that the simplest way to do it is to have each motor set its own baud rate at startup.

What I meant in my question about ECHOing was will a motor echo commands that are sent to it at a baud rate other than the one it is set to (simple hardware link from Rx to Tx) or does the motor receive a character on the Rx pin, interpret it, then re-transmit it?

- Chris

 
Posted : 14/09/2011 12:17 am
(@Chris Dancer)
Posts: 12
Active Member Guest
Topic starter
 

Thanks. I think I'll use OCHN to set the baud rate at startup, that's the simplest and most reliable way.

What I meant about ECHOing was, for instance, if a motor has ECHO on, and its baud rate is 9600, and it receives a command at 38400 baud, obviously it won't respond to the command, but will it echo it on the Tx line at 38,400 baud?
Or to put it another way, does a motor ECHO characters by reading them and re-transmitting them using its UART, or does it just switch on a hardware buffer between Rx and Tx?

 
Posted : 15/09/2011 12:31 am
(@Chris Dancer)
Posts: 12
Active Member Guest
Topic starter
 

An issue I have just found is that the BAUD# command when sent from the host does not work. I have tried using it from the terminal in SMI and my own programs, the motor just seems to ignore it.
Example copied from the monitor display:

'Comms port is at 9600
RMODE O 'Report movement mode returns "off"
BAUD38400 'Change baud rate to 38400
RMODE O 'This should return no response, because baud rate should now be 38400!

As you can see the rate is stuck at 9600. It didn't change when I sent the BAUD# command. Why not?

 
Posted : 15/09/2011 1:56 am
(@csearcy)
Posts: 316
Reputable Member Guest
 

The motor will only ECHO commands sent at the correct Baud Rate.

 
Posted : 04/10/2011 7:28 am
Share: