Serial Printing

To print text via the serial interface on the RM46, first choose the UART port you’d like to use. There are two of these interfaces on the RM46 microcontroller.

  1. SCI → The regular SCI interface
  2. SCI2 → This is actually the LIN module configured in SCI mode

RM46 LaunchPad

On the LaunchPad, SCI2 can be accessed through the onboard USB connector.

To access SCI, you’ll need a USB-TTL converter. The converter can be connected to the UART TX and UART RX pins on the RM46 Launchpad’s J2 connector. The connections will be something like:

RXD (On converter) → UART TX (On LaunchPad)

TXD (On converter) → UART RX (On LaunchPad)

It’s recommended that you use the SCI2 port (i.e. the onboard USB connector) if you’re using the LaunchPad. That way, you can just plug the USB cable into your PC without worrying about the USB-TTL converter.

Code

Now that you know which interface you’ll be using, write some code to print via the serial port. Here’s an example:

#include "obc_sci_io.h"

int main(void) {
	initSciMutex(); // Must be called before you try to do any serial I/O operations

	// Infinite loop
	for (;;) {
		printTextSci(sciREG, "Hello World!\\r\\n", 14); // Print via SCI
		printTextSci(scilinREG, "Hello World!\\r\\n", 14); // Print via SCI2
	}
	return 0;
}

Once the program is built (probably using a Makefile), flash the firmware onto your board.

If you're using SCI2, then make sure you're connected to the LaunchPad through its USB connector. Or if you’re using the SCI interface, then connect to it via the USB-TTL converter.

Serial Terminal Setup

Once you’ve physically connected your board to a PC. It’s time to set up a serial terminal to view the data coming in from the RM46. First things first, figure out the COM port name for the interface you’ll be using.