Atmega 128 + Pololu Serial 8 -Servo Controller + Baud Rate


My setup is so;
Atmega 128 communicating to the pololu servo controller through UART on the Mini SSC II mode.

The transmission signal of the UART looks fine on the oscilloscope but the pololu servo controller complains about the baud rate being too high through a green flashing light + steady red light.

Despite changing the baud rate above the 9600, to say 10000, or dropping the baud rate to 2400 or below that to even 260, the same error occurs; baud rate is too high.

I also tried using the pololu mode for it is less dependent on a specific baud rate, but the same error occurred.

I have tried changing the delay at the end of the sequence, added a delay between bytes but neither has made a difference.

Every time a change is made, i cut the power to the pololu and turn it back on to reset the device.

Any help on this issue would be greatly appreciated; been working on trying to get the servo to move for the past several days with no success.

The code being implemented is as follows;

[code]#include <avr/io.h>

#include <util/delay.h> //including delay functions

#define F_CPU 16000000 //1843200 //clock freq.
#define BAUD 9600 //baud rate 96000
#define BRC (((F_CPU)/(16*BAUD))-1) //cal baud rate /asynchronous mode pg173

void USART_Transmit(int);

int main(void)
//UART Setup
/<< shift left. ,8 = shift left 3 bits/

UBRR0H = (BRC >> 8); //baud rate registers high BRC used here

UBRR0L = BRC; //baud rate register low

UCSR0B = (1 << TXEN0); //enabling transmitter in register B (left shift 1 place)

UCSR0C = /*0<< UCSZ02) | */ (1<<UCSZ00) | (1<<UCSZ01); //making 8 bit //or keeps it, and destroys it


	/*transmitting data to UART*/
//Mini SSC II*************************

//pololu mode *************************	Note; has been commented out for did not work thus trying the simpler code to no avail 

/* USART_Transmit(0x80);






void USART_Transmit( int data )

while ( !( UCSR0A & (1<<UDRE0)) ){ };
 /*waiting for transmit buffer to be empty*/
		/* Put data into buffer, sends the data */
UDR0 = data;



I briefly looked at your code and did not see anything obvious that might be causing the issue. Have you verified that your AVR is sending the correct serial bytes? If you have an Arduino or a USB-to-serial device, you might try using it to send commands to the servo controller to verify the servo controller works.

Also, noise on the serial lines might be affecting your servo controller. Could you post screen captures of your oscilloscope? Could you also post pictures of your setup?

By the way, our newer Maestro servo controllers are better than that older servo controller in almost every way, so if you do not have a specific reason for using the old one, you might consider upgrading.

- Jeremy

Hi Jeremy,

Thanks for your quick reply. I tried using the Pololu Serial Transmitter utility for Windows and the servo worked fine.

I will post screen shots on monday when I am back in the lab of the oscilloscope and setup.

No my setup does not involve an arduino, just the atmega128.

I am sending the signal straight from the TX line of the atmega to the servo controller to eliminate any noise and it shows no noise when doing this.

I only just purchased the serial 8 servo controller so would like to try to get it to work rather than just buy another servo controller where I might still run into the same problem.

Kind Regards, Pete

Here are the pics you requested

Kind Regards, Pete

And the last picture

It looks like you are connecting the TX pin from your microcontroller to the RS-232 serial input. The RS-232 serial input expects an inverted serial signal. Are you sending inverted serial commands? If not, you should connect the TX output from your microcontroller to the logic-level serial input pin on the servo controller. Also, from your pictures it does not look like the two devices share a common ground connection. You should connect the GND pins of the servo controller and your microcontroller for proper communication.

  • Jeremy

G’day Jeremy,

Thanks so much for all your help. Yes, the grounds were the problem causing the baud rate light to flash. You were also correct in noticing me trying to send the signal to the serial port instead of the Sin pin.

I have also discovered that I have to have a delay of 34000 ms or higher with my 16MHz crystal for a command to be recognized correctly. Note the delay is only about 1sec on the servo so no drama there.

Once again thanks for all your help. Would be happy to recommend pololu to anyone due to your excellent customer service. A+

Cheers, Pete