deep

a Cross Development Platform for Java

User Tools

Site Tools


runtime_library:using_serial_out:start

This is an old revision of the document!


Using Serial Out (System.out)

On the hardware side

Freescale MPC555

The Freescale MPC555 offers two independent serial interfaces with RS232 Protocol, SCI1 and SCI2. When using our NTB MPC555 Headerboard, the SCI1 is connected through the USB Background Debugging Interface (USB-BDI) to the host where it will be visible as a virtual COM port. The SCI2 can be connected with a standard serial cable (DB9 connector).

Freescale MPC5200

The Freescale MPC5200 has six built in Programmable Serial Controllers (PSC), which can all work as UART's running the RS232 protocol. Check your hardware manual to see which of the PSC can be used on your board.

On the software side

In your application on the target you have to initialize the serial communication interface with the desired settings and assign the standard pipes (in, out, err) to this port. Example for the MPC555:

import java.io.PrintStream;
import ch.ntb.inf.deep.runtime.mpc555.driver.SCI1;
 
public class HelloWorld {
	static {
		// 1) Initialize SCI1 (9600 8N1)
		SCI sci1 = SCI.getInstance(SCI.pSCI1);
		sci1.start(9600, SCI.NO_PARITY, (short)8);
 
		// 2) Use SCI1 for stdout
		System.out = new PrintStream(sci1.out);
 
		// 3) Say hello to the world
		System.out.println("Hello world");
	}
}

The maximum allowed baudrate for the SCI1 is 38400 when using our USB Background Debugging Interface (USB-BDI). This is caused by the fact that the serial signals are handled by the rather slow microcontroller on this interface board.

When working with the the mpc5200:

import java.io.PrintStream;
import ch.ntb.inf.deep.runtime.mpc5200.driver.UART3;
 
public class HelloWorld {
	static {
		// Initialize UART (9600 8N1)
		UART3.start(9600, UART3.NO_PARITY, (short)8);
 
		// Use the UART3 for stdout
		System.out = new PrintStream(UART3.out);
 
		// Print a string to the stdout
		System.out.println("Hello world");
	}
}

On the host you have to determine which port number your operating system has assigned to the port. Open any terminal program, such as putty, Hyperterminal or realterm. Configure the port setting similar to the target setting and open the connection.

runtime_library/using_serial_out/start.1538145042.txt.gz · Last modified: 2018/09/28 16:30 by ursgraf