How To Use the Serial Card as a Console on the MPC5125 Tower Board

By default, the serial console MPC5125 Tower board is provided by the USB mini-B port on the processor module. However, it is possible to use the Tower Serial (TWR-SER) module instead. This guide lists the steps to do this.

It is recommended that you have a running system using the USB serial port before using this guide.

Prerequisites

  • Desktop Factory build for MPC5125 Tower Board

Overview

There are three places that the new serial port must be specified:

  • U-Boot Console — specified at U-Boot build time
  • Kernel Console — specified at kernel boot time, via the kernel command line
  • Userspace Console — specified at boot time, via the ttyDefault file

Setting the U-Boot console

Setting the U-Boot to use the other serial requires a reconfiguration and rebuild/reflash it.

  1. Go to the root of your Desktop Factory directory.
  2. Run make menuconfig.
  3. Change the option Target Software->Bootloader->u-boot->u-boot Configuration target to ads5125_nand_serial_card.
  4. Exit the menuconfig interface, and save the new configuration.
  5. Reconfigure u-boot using make u-boot-reconfigure.
  6. Run make.
  7. Once the build completes, update U-Boot. See the following document for detailed instructions: HOWTO Install U-Boot on the MPC5125 Tower Board.
  8. After the update, the U-Boot console will now be on the serial card module.

Setting the Kernel console

Setting the kernel console is much easier, and does not require a rebuild. You simply pass a different console argument on the kernel command line.

  1. Open a serial console to U-Boot on your board, as per the Getting Started Guide.
  2. Modify the bootargs environment variable to use ttyPSC1. If you are booting using TFTP and NFS, it will look like the following:
    setenv bootargs console=ttyPSC1,115200 ip=dhcp root=/dev/nfs rw

Setting the Userspace console

In a Factory build, the console is spawned on the serial port pointed to by the symlink /dev/ttyDefault. You will need to modify this symlink in order to get a console.

There are a number of ways to accomplish this task, depending on your goals.

Simple method

If you are running over NFS, you can simply change the /dev/ttyDefault symlink to point to the other serial device. NOTE: You will need to do this each time you install a new RFS.

  1. On your host system, navigate to the /dev directory of your NFS root:
    cd /path/to/rfs/dev
  2. Overwrite the symlink, making it point to /dev/ttyPSC1. You must be superuser to do this.
    sudo ln -sfT ttyPSC1 ttyDefault

Permanent method

If you are using a flash image, or would like to have the change persist between RFS builds, you must modify a configuration file in Factory itself. The device table contains a list of device nodes that are created when the RFS is built. You can create a custom file, make the change, and point the Factory workorder to use this new file.

  1. Navigate to the top level of your Factory directory.
  2. Create a new directory for your custom board. In this example, we simply call it "custom":
    mkdir target/configs/device_table/custom/
  3. Copy the existing device table for the mpc5125_twr board to the new directory:
    cp target/configs/device_table/mpc5125_twr/device_table target/configs/device_table/custom/
  4. Open the new device file for editing:
    vi target/configs/device_table/custom/device_table
  5. Modify the line for ttyDefault so that it points to ttyPSC1 rather than ttyPSC0:
    /dev/ttyDefault s       ttyPSC1 -       -       -       -       -       -       -
  6. Save and close the file.
  7. Run make menuconfig.
  8. Change the option Target Configuration->Build RFS->Device Table Location to file://$(BASE_DIR)/target/configs/device_table/custom/device_table.
  9. Exit the menuconfig interface, and save the new configuration.
  10. Run make rfs-distclean to clean out your RFS directory.
  11. Run make to rebuild the RFS.