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

  1. 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)
    		SCI1.start(9600, SCI1.NO_PARITY, (short)8);
     
    		// 2) Use SCI1 for stdout and stderr
    		System.out = new PrintStream(SCI1.out);
    		System.err = new PrintStream(SCI1.out);
     
    		// 3) Say hello to the world
    		System.out.println("Hello, world");
    	}
    }

    And for 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");
    	}
    }
  2. On the host you have to determine which port number your operating system has assigned to the port
  3. 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.1528784028.txt.gz · Last modified: 2018/06/12 08:13 by ursgraf