Serial Troubles

I hooked up my brand new Baby-O and USB AVR programmer and was able to get the simple test example to run. I played around with it and modified it to blink the light at different duty cycles. Everything worked flawless.

My real purpose is in serial comm though, so I went for the serial comm example (USB AVR TTL serial). The serial comm example app does some stuff not compatible with the Baby-O, so I switched it to use the red_led instead of green.

What I noticed is that the program gets to the serialsetbaudrate call and seems to hang there and turns the red light of the Baby-O on. Is the red light used as an error indicator of sorts at times?

I removed every red_led(1) call in the app and it still turns the red led on at this point. Finally, I commented out the call to serialsetbaudrate and it no longer turned the red led on. (Though, the app did not work.)

Thanks for any insights


The red LED is always directly under user control, so its status is determined by your program or what you have connected to the I/O line that it’s on. It happens to be on the serial transmit line (PD1), so you will see it light up whenever the UART module is enabled (the idle state of TX is high, which turns on the LED).

If you need help with your program, please post the simplest code that should work but doesn’t, and give us more details, such what test you are performing, what software you are using, what the other serial device is, and how everything is connected. You also need to tell us what you expect to happen when you run your code and what actually happens.

By the way, have you tried the serial1 example from the Pololu AVR library?

- Ben

Hello, thanks for the reply.

So once I call serial_set_baud_rate, the red_led(0) will no longer function? In my tests, once I call that function, the red_led is on, period.

I am running the serial example you mention now. The app runs, the red led comes on, and thats all I can tell.

I do not get my keypresses sent back to me in altered case. (I do not get anything back.)

I am connecting via the USB AVR programmer TTL. It landed on com5 of my machine. I have 9600,n,8,1 set on everything. I have flow control disabled everywhere. (In the USB AVR programmer settings, and in PuTTY)

I see the green light blink on the USB AVR programmer for each keypress.


Once the UART module is enabled (which happens when you set the baud rate), the red LED will generally be on since the idle state of the TX line (PD1) is high. Whenever the board transmits, the LED will briefly flicker (it will turn off while transmitting 0 bits), but might be hard to notice this, especially at high baud rates.

The Pololu AVR programmer installs as two COM ports, one for programming and the other for using the USB-to-serial adapter feature. Are you sure you’re connecting to the right port? What are your connections from the programmer to the Baby Orangutan?

- Ben

Under the device manager, I have three entries.

  1. Under Pololu USB Devices: Pololu USB AVR Programmer
  2. Under Ports: Pololu USB AVR Programmer Programming Port (COM4)
  3. Under Ports: Pololu USB AVR Programmer TTL Serial Port (COM5)

I am using Putty, set to COM5, 9600,8,N,1 with no flow control.

I only have the six pin programmer header hooked up between the Baby and the USB Programmer.
(DOH) is the serial not on this six pins?


What are your connections from the programmer to the Baby Orangutan?

OK, your comment ^ ^ ^ prompted me to the solution. That is, actually connect the two devices properly.
Everything works now. I thought I was getting a free lunch with that snappy ribbon cable.

I havent messed with microcontrollers since 1993 when I was doing 8052 development. In one day I got this thing up and running, programmed , and doing serial comm. You’ve made this a really wonderful process. I appreciate that and your help today.


That’s great to hear! Please let us know if you have any more questions (and thank you for the compliment!).

- Ben