Not sure what I'm doing wrong Searial with Baby O

Hi all,
I am attempting to set up USART on my Baby O 328 Using the following code. I’m not sure what is wrong with the software but when I go into Brays terminal I get no response at all. I am ttryin this out as an examle code because this will be my first time using USART.

My terminal settings are 9600 baud 8n1 as(I THINK) are my settings in the code…
any help would be appreciated

#include <avr/io.h>
#include <stdint.h>
#include <util/delay.h>
#define F_CPU 20000000UL
#define BAUD9600 ((F_CPU / 9600 / 16) - 1)

void serial_init(unsigned int baud);
void serial_write(unsigned char data);
unsigned char serial_read(void);

int main(void)
  unsigned char rx_data;
    rx_data = serial_read();
  return 0;

void serial_init(unsigned int baud)
  UBRR0H = (unsigned char) (baud >> 8);
  UBRR0L = (unsigned char)  baud;

  UCSR0B = (1 << RXEN0) | (1 << TXEN0);

  UCSR0B = (3 << UCSZ00);

void serial_write(unsigned char data)
  while(!(UCSR0A & (1 << UDRE0)));

  UDR0 = data;

unsigned char serial_read(void)
  while(!(UCSR0A & (1 << RXC0)));

  return UDR0;

I also tried running the serial1 project from the library which i altered to use set_m1_speed(200) on ‘G’ and set_m1_speed(0) on ‘g’ to no avail… perhaps I have damaged P1:0?

Hello, Jacobus.

I’m sorry you are having trouble. What kind of serial port or USB-to-Serial adapter are you using, and how did you hook it up to the Baby Orangutan?


Hi thanks for the reply.
I am using the Pololu USB programmer/serial adapter that comes in the Combo Deal. (A GREAT deal by the way!)
I have soldered pins to the programmers serial out and I have gnd to babyO’s gnd power to babyO’s vout 5v tx to rx and rx to tx.

as an update I have hooked it up to arduino IDE and ran their SerialEvent sketch which worked perfectly. in serial monitor and in Bray’s terminal with the same hookup.

this leads me to believe that there is no hardware issue and that there is something wrong with my code. but what?
Any help or tutorials that you can point me to that are known to work would really get me on track and make me just as happy as the day is long! currently I’m following the AtMel datasheet.

Hello, Jacobus.

What happens if you just send a different letter to the Baby Orangutan running the serial1 example program, like “q”. It should respond by sending back “Q”. Does that work?

The Baby Orangutan has no pin labeled VOUT, so could you please clarify how you are powering it?


Hello there thanks again for your help!
I get no response when sending any letter at all. and I apologize for my prior ambiguity the
Programmer | Baby O
Vin |VCC 5v //wire soldered thru the hole instead of pad
A Not used |
B Not used |
Please let me know what you think. I really appreciate the help once again!
ps. I apologize in advance for my crappy looking table LOL :blush:

Hello, Jacobus.

Thank you for the details.

Maybe you are accidentally compiling for the wrong device or something else is wrong with your toolchain. Could you try loading libpololu-avr/examples/atmega328p/hex_files/serial1.hex onto your board and see if that works? If it doesn’t, please try libpololu-avr/examples/atmega328p/hex_files/led1.hex, which is just supposed to blink the red LED.