SVP 324 USB_COMM Serial1 Br@y problem

I can’t seem to get the Serial1 test program to communicate with my PC using the Br@y terminal program. I’ve loaded the sample program from Pololu and updated the code to reference the USB_COMM in the serial commands.
When I bring up the Br@y terminal program and send a command to the SVP, the program echos back the same character sent (i.e. it does not return the upper case character, nor does it execute any command such as the ‘c’ or ‘d’ command to play a note). After a few command attempts the Br@y terminal program hangs.

Here are the details of my configuration:
Windows XP - SP3, Pololu Drivers installed dated 12/22/2009
Device Manager list SVP USB Comm Port as (COM6)
Br@y v1.9b (settings (Com6), 9600, 8,N,1, no hand shaking)
When I press connect button it states connected at the bottom but no other lights are green such as CTS or DSR.

SVP 324:
here is the code loaded on it.

#include <pololu/orangutan.h>  
 * serial1: for the Orangutan controllers and 3pi robot.
 * This example listens for bytes on PD0/RXD.  Whenever it receives a byte, it
 * performs a custom action.  Whenever the user presses the middle button, it
 * transmits a greeting on PD1/TXD.
 * The Baby Orangutan does not have a green LED, LCD, or pushbuttons so
 * that part of the code will not work.
 * To make this example compile for the Orangutan SVP, you
 * must add a first argument of UART0 to all the serial_*
 * function calls.

// receive_buffer: A ring buffer that we will use to receive bytes on PD0/RXD.
// The OrangutanSerial library will put received bytes in to
// the buffer starting at the beginning (receiveBuffer[0]).
// After the buffer has been filled, the library will automatically
// start over at the beginning.
char receive_buffer[32];

// receive_buffer_position: This variable will keep track of which bytes in the receive buffer
// we have already processed.  It is the offset (0-31) of the next byte
// in the buffer to process.
unsigned char receive_buffer_position = 0;

// send_buffer: A buffer for sending bytes on PD1/TXD.
char send_buffer[32];

// wait_for_sending_to_finish:  Waits for the bytes in the send buffer to
// finish transmitting on PD1/TXD.  We must call this before modifying
// send_buffer or trying to send more bytes, because otherwise we could
// corrupt an existing transmission.
void wait_for_sending_to_finish()

// process_received_byte: Responds to a byte that has been received on
// PD0/RXD.  If you are writing your own serial program, you can
// replace all the code in this function with your own custom behaviors.
void process_received_byte(char byte)

	print("Byte In [");

		// If the character 'G' is received, turn on the green LED.
		case 'G':

		// If the character 'g' is received, turn off the green LED.
		case 'g':

		// If the character 'c' is received, play the note c.
		case 'c':

		// If the character 'd' is received, play the note d.
		case 'd':

		// If any other character is received, change its capitalization and
		// send it back.
			send_buffer[0] = byte ^ 0x20;
			serial_send(USB_COMM,send_buffer, 1);

void check_for_new_bytes_received()
	while(serial_get_received_bytes(USB_COMM) != receive_buffer_position)
		// Process the new byte that has just been received.

		// Increment receive_buffer_position, but wrap around when it gets to
		// the end of the buffer. 
		if (receive_buffer_position == sizeof(receive_buffer)-1)
			receive_buffer_position = 0;

int main()

	print("Serial Test");

	// Set the baud rate to 9600 bits per second.  Each byte takes ten bit
	// times, so you can get at most 960 bytes per second at this speed.

	// Start receiving bytes in the ring buffer.
	serial_receive_ring(USB_COMM,receive_buffer, sizeof(receive_buffer));

		// Deal with any new bytes received.

		// If the user presses the middle button, send "Hi there!"
		// and wait until the user releases the button.
		if (button_is_pressed(MIDDLE_BUTTON))
			memcpy_P(send_buffer, PSTR("Hi there!\r\n"), 11);
			serial_send(USB_COMM,send_buffer, 11);

			// Wait for the user to release the button.  While the processor is
			// waiting, the OrangutanSerial library will take care of receiving
			// bytes using the serial reception interrupt.  But if enough bytes
			// arrive during this period to fill up the receive_buffer, then the
			// older bytes will be lost and we won't know exactly how many bytes
			// have been received.

Any ideas on how to get this working ?

Thanks for any help.


Your code looks very similar to the example code on our website on this page:

When you copy one of our example programs, please let us know where you found it and what modifications you made to it. In this case, the example program uses a hardware UART but you changed it to use the virtual COM port connection provided by the auxiliary processor.

Please read this section for an overview of the serial library:

Specifically, this part:

This means you should add a call to serial_check() in your main loop and also in wait_for_sending_to_finish().

If you are still having trouble after doing that, then please look at the SVP Demo Program (I believe it is named svp-demo-program), which is included as an example in the Pololu USB Library and has a menu option where it communicates on the USB_COMM.


Thank you very much for the code reference.
I loaded the SVP Demo Program and it worked fine.
I then changed my code example by adding the serial_check() and that got everything working well.

I appreciate the help!