Orangutan X2 USB and UART communications

Hi,

From what I understand, the Orangutan X2 has 1 USB comm channel and 2 UART channels. Is it designed such that all three channels be used simultaneously? I tried interfacing the X2 with a PC via USB and an Arduino via one of the UARTs. The PC-USB 2-way communications works fine without the Arduino-UART. However, once I added the Arduino-UART (TX + RX), the PC-USB 2-way communication starts missing data packets. Eventually, the only way that I could make the Orangutan, Arduino, and PC work together was to make the Arduino-UART a pure TX channel while retaining the 2-way PC-USB communication, i.e. the Orangutan can only send data to the Arduino, but cannot get data back from the Arduino.

For this function, I have 3 questions:

void OrangutanX2::setSerial(unsigned char parity, unsigned char stopBits, unsigned char speedMode, unsigned int baud_UBRR, unsigned char save)

  1. How can I know which UART is being set by this function?
  2. What is the use of the parameter “unsigned char save”, and what should be the default value?
  3. How does this function relate to the following Pololu function?

static void OrangutanSerial::setBaudRate([unsigned char port,] unsigned long baud)

Thanks!

Hello.

The typical Arduino only has one UART and that is tied to its USB-to-Serial converter. Are you using the SoftwareSerial library to talk to the Orangutan X2?

Yes, you should be able to use the Orangutan X2’s three communication ports simultaneously.

The source code of the Pololu AVR C/C++ Library is in github. The OrangutanX2::setSerial function sends some bytes over SPI, so that means it controls the UART on the auxiliary processor, which is connected to the CP2102 USB-to-serial converter.

Your second question is answered in the comment above the source code of that function:

// Sets the UART parameters.  Arguments to this function should be the
// UART #defines in OrangutahX2.h.  speedMode is either UART_NORMAL_SPEED or
// UART_DOUBLE_SPEED.  This command will disable permanent progmode
// if it's enabled.  If the argument "save" is nonzero, the serial parameters
// are also saved to EEPROM and will persist after a power cycle.
// Default settings are: normal UART functionality, no parity, one stop bit,
// normal speed (i.e. not double-speed mode), 115.2kbps baud rate.  The
// UART character size is always 8-bits.
void OrangutanX2::setSerial(unsigned char parity, unsigned char stopBits,
	unsigned char speedMode, unsigned int baud_UBRR, unsigned char save)

The OrangutanSerial::setBaudRate function can be used to set the baud rate of either the main AVR’s UARTs or the auxiliary processor’s UART, depending on what argument you provide for “port”. OrangutanSerial::setBaudRate calls OrangutanX2::setSerial if you ask it to change the auxiliary processor’s UART.

–David