Best baud rate?

Hi,

is there an optimum baud rate, just i’m using a micro-controller + Mini Maestro 18, running pretty much a constant stream of updates, and timing the loop speed and adjusting the baud rate seems to get some strange results, ie.

19200 - 0.139sec
14400 - 0.101sec
9600 - 0.0877sec
7200 - 0.0958sec

i know the refresh is to slow (for a target of 0.02), i’m hoping to put the work i’m doing in to a script in the servo controller at the right point.

this loop is running 6 calls to a multi-target of 3 servos sub, would i see much of a speed boost running 1 call to a 18 servo sub ? (if my maths is right, the 6X3 is 54 bytes, and the 1x18 is 39 bytes, would that translate to 72% of the original times? 0.0877 to 0.0631, or will it not like the long stream in one go?(like the faster baud rates))

any ideas on any of this?

thanks

adam

You should pick the fastest possible baud rate supported by both devices that doesn’t result in poor signal quality at the receiver. If your wires aren’t too long then 115200 bps should work fine. The Mini Maestro can support faster baud rates (up to 200 kbps) but you’ll need to use fixed baud rate mode.

The Maestro should be able to handle whatever commands you send to it as long as your baud rate is not too high.

Your experiment results sound wrong. Higher baud rates should result in faster data transmission. Make sure you are properly initializing your microcontroller’s baud rate registers.

–David

hi david,

thanks,… the fastest the com3 can go on my controller is 19200 (com1 can go as high as 115200 but is being used for something else, it is also running through some other hardware), i believe it is setting up the com connection right, i guess it only leaves the cable/connection…

but which ever way i time the loop and what ever i change i get the same results.

i’ll have to look into it a bit more…

cheers

adam

Hi,

quick update, (just incase anybody has any ideas), ran the same test but with TX&RX cables of about 5cm rather than about 20cm with no difference to the results at all. my controller is a BX-24 running a ATMEGA8535 ic.

adam

'------------------------------------
Dim InputBuffer(1 To 10) As Byte
Dim OutputBuffer(1 To 10) As Byte
Dim OutData As Byte 
'------------------------------------
Call openqueue(InputBuffer, 12)' Open InputQueue/Buffer.
Call openqueue(OutputBuffer, 15)' Open OutputQueue/Buffer.
Call DefineCom3(19, 20, bx0000_1000)' Define port 3 to use pin 19 as input, 20 as output. Also use non-inverted logic, no parity, 8 data bits. Implicit 1 stop bit.
Call OpenCom(3, 9600, InputBuffer, OutputBuffer)' Define baud rate and buffers for port 3.
'------------------------------------
OutData = CByte(170)
Call PutQueue(OutputBuffer, OutData, 1)
'------------------------------------