Activating UART2 on Wandboard Quad / Dual (iMX6 / Kernel 3.0.35 up)

The Wandboard (linux board) Quad, Dual and Singe have several UART interfaces (3.3V, not 5V tolerant) available. The official images from http://www.wandboard.org/ have UART1 activated by default because it allows you to manipulate the bootloader and to have a simple terminal access. On the wandboard baseboard UART is converted to RS232 and can be accessed via a null modem cable as shown here. Unfortunately you will get a constant output of kernel messages on this stream which might interfere with your application. However if you want to use a UART interface in your application you should either disable the kernel output on UART1 or activate and use another UART interface (like UART2). I would highly recommend you to choose the latter way since you will definitely need the kernel / boot output messages in order to make your system boot.

So here’s the deal: If you need to activate UART2 you’ll need to apply changes to the kernel & device tree and recompile it. If you want to know if activation is necessary on your system simply check if you can find a device called mxcfb2 in your /dev folder. NXP (former Freescale) decided to name the UARTs of the i.MX6 this way. The kernel output mxcfb1 (UART1), mxcfb2 = UART2, mxcfb3 (UART3, Bluetooth module connected there).

cd /dev && ls -l

If you can find mxcfb2 there your UART2 is already activated. If not you need to activate it according to this post.

Again this is only for kernel versions 3.0.53 and higher. The 3.0.53 kernel is the first to have a device tree. If you’re using a lower version of the kernel (e.g. “out of the box images” Wandboard Ubuntu 12.04) there is no device tree. If you‘re trying to work on this kernel you’ll need to apply changes to different C code source files. Anyway – if you’re using 3.0.53 and up your absolutely right here.

First step is to get the kernel sources. We will work on kernel version 3.10.53. So let’s check out the correct branch from the official Wandboard GIT repo:

git clone https://github.com/wandboard-org/linux.git -b wandboard_imx_3.10.53_1.1.0_ga

Then we can edit the device tree. I would recommend you to add a new set of pins to the file. This “pins pack” will define a set of pins which are used for UART2 communication. It is useful to define the pins RTS and CTS for hardware flow control as well. You do not need to use them but they are routed to EDM connector of the Wandboard aswell. Edit the imx6qdl.dtsi file with your favorite text editor.

 nano arch/arm/boot/dts/imx6qdl.dtsi

Add the following lines indicated with a “+” (patch style)

MX6QDL _ PAD _ EIM _ D29 __ UART2 _ DTE _ RTS _ B 0x1b0b1
 >;
};
+ pinctrl _ uart2 _ 3: uart2grp-3 {
+    fsl,pins = <
+         MX6QDL _ PAD _ SD4 _ DAT4 __ UART2 _ RX _ DATA 0x1b0b1
+         MX6QDL _ PAD _ SD4 _ DAT5 __ UART2 _ RTS _ B 0x1b0b1
+         MX6QDL _ PAD _ SD4 _ DAT6 __ UART2 _ CTS _ B 0x1b0b1
+         MX6QDL _ PAD _ SD4 _ DAT7 __ UART2 _ TX _ DATA 0x1b0b1
+    >;
+ };
};
uart3 {

This section simply defines pins of the i.MX6 processor to have UART2 alternate function. (Pins of large, complex or BGA style ICs are often called “pads”.)

Next we want to make use of the new pin set. Edit the file

nano arch/arm/boot/dts/imx6qdl-wandboard.dtsi

Again – add the lines indicated with a “+”. Other lines are only presented to enable navigation within the source code.

 status = "okay";
};
+ &uart2 {
+          pinctrl-names = "default";
+          pinctrl-0 = <&pinctrl _ uart2 _ 3>;
+          status = "okay";
+ };
+
&usbh1 {
 status = "okay";
};

After these simple steps your are ready to compile the kernel and device tree. Having finished compilation you should be able to find mxcfb2 in the /dev folder of your system.

Using terminal programmes like minicom you can simply test your UART interface.

sudo apt-get install minicom

sudo minicom -s

LVDS color problems / dimmed gray screen (Wandboard, iMX6, Ubuntu 12.04)

Enabling LVDS on my Wandboard Quad on Ubuntu 12.04 (see my blog entry here), I encountered two problems with my LVDS display.

Problem 1: Basically the settings seemed right, but there were some wrong colors everywhere (see image below).

LVDS color errorThus I decided to go for Test Card. It is freely available from Wikipedia in the linke above. Below you can see a photo of my LCD screen (upper image) and the original image as it should be (lower image).

img_2963pm5544_with_non-pal_signals

Test Card Image courtesy of Wikipedia.

Obviously the red channel is missing so I decided to check the LVDS connector and found a loose contact on my LVDS cable.

Lesson learned: Always double check your connections (e.g. using a continuity tester / multimeter). When using continuity tester make sure not to connect ground of multimeter and LCD since the testing voltage of the tester could potentially destroy the LVDS input pin and the measurement result would be wrong!

Problem 2: The screen seemed very dark and white did not represent the maximum brightness of the screen. Since I definitely knew that the backlight was at full power (no PWM activated) the problem had to be caused by the display. At this moment I had the LVDS color mode set to RGB18 (see here) which was wrong for my LCD. After setting to RGB24 the problem was solved.

Lesson learned: The LCD might work even when the LVDS color mode is set wrong. When setting RGB18 (3×6 bit) obviously the two MSB of a 24bit (3×8 bit) LVDS transmission are omitted, the display sets them to  zero. Correct settings to RGB24 resolves the issue.