Home/Support/Support Forum/use both serial ports
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

use both serial ports

0 votes
I want to use both the serial ports on the development board. One port for outputting messages with printf() and the other one for writing out bytes with the normal open()/write() API functions.

Currently serial port 1 (/com/0) is used by printf(), how can I change this so it uses the other port?

(I need the first serial port for my application, the second serial port is optional for debugging, since it can only be used with modules that have a JTAG connector if I understand this correctly).
asked May 25, 2007 in Linux by compie Community Contributor (55 points)
recategorized Dec 4, 2013 by tuxembb

Please log in or register to answer this question.

4 Answers

0 votes
Edit the appconf.h file that is included with your project. Also, you'll need to make sure that in bsp.h you've set the second serial port define to use a UART (i.e. set BSP_SERIAL_PORT_2 to BSP_SERIAL_UART_DRIVER).
answered May 25, 2007 by charliek Veteran of the Digi Community (408 points)
0 votes
I already found the answer myself:

In appconf.h:

/*ad*
* APP_STDIO_PORT determines which serial port stdin, stdout, and stderr should be redirected to.
* It should be set to the device name of the port or NULL.
*
* @external
* @category general_purpose
* @since 1.0
*ad*/
#define APP_STDIO_PORT "/com/0"

And in bsp.h:

/*ad*
* This constant controls which serial driver is built in
* the BSP for serial port 1.
*
* @since 6.0
* @external
* @category BSP_Configuration
* @index BSP_SERIAL_PORT_1
* @see @link SerialPortConfigurations
*ad*/
#define BSP_SERIAL_PORT_1 BSP_SERIAL_UART_DRIVER

/*ad*
* This constant controls which serial driver is built in
* the BSP for serial port 2.
*
* @since 6.0
* @external
* @category BSP_Configuration
* @see @link SerialPortConfigurations
*ad*/
#define BSP_SERIAL_PORT_2 BSP_SERIAL_NO_DRIVER
answered May 25, 2007 by compie Community Contributor (55 points)
0 votes
Is it true that only Digi devices with a JTAG connector have support for the second serial port?
answered May 25, 2007 by compie Community Contributor (55 points)
0 votes
Yes for the Digi Connect ME, as the second serial interface is provided through the JTAG interface. The Connect EM, however, allows access to a second 2 wire (TX + RX) serial interface.
answered May 26, 2007 by charliek Veteran of the Digi Community (408 points)
...