nixy82
Posts: 42
Joined: Sat Sep 12, 2015 9:19 am

TTYAMA0 RX/TX/RTS/CTS Overlay for Compute Module

Sat Oct 01, 2016 5:57 pm

Hi

Hope I can get some help here

I'm trying to compile the below devicetree overlay to enable and position the full RX/TX/RTS/CTS pins on the (ttyAMA0) UART0 on GPIO30-33

So far I've put UART1 on 14/15 OK

I've temporarily removed the serial console from the boot cmdline.txt

My kernel running on Jessie is :

Code: Select all

root@raspberrypi:~/device-tree# uname -a
Linux raspberrypi 4.1.21+ #872 Wed Apr 6 17:27:13 BST 2016 armv6l GNU/Linux


Device tree compiler is :

Code: Select all

root@raspberrypi:~/device-tree# dtc --version
Version: DTC 1.4.0
Here's the code :

Code: Select all

/dts-v1/;
/plugin/;

/{
        compatible = "brcm,bcm2708";

        fragment@0 {
                target = <&uart0>;
                __overlay__ {
                        pinctrl-names = "default";
                        pinctrl-0 = <&uart0_pins>;
                        status = "okay";
                };
        };

        fragment@1 {
                target = <&gpio>;
                __overlay__ {
                        uart0_pins: uart0_pins {
                                brcm,pins = <30 31 32 33>; /* UART0: CTS0 RTS0 TX0 RX0 */
                                brcm,function = <7>; /* ALT3 */
                                brcm,pull = <0 0 0 2>;
                        };
                };
        };

        fragment@2 {
                target-path = "/aliases";
                __overlay__ {
                        serial0 = "/soc/uart@7e201000";
                };
        };

};
I've found the number for ALT3 from :

https://www.kernel.org/doc/Documentatio ... 5-gpio.txt


This is how I'm compiling it (no errors produced when run):

Code: Select all

dtc -@ -I dts -O dtb -o uart0-full.dtbo uart0-full-overlay.dts
cp uart0-full.dtbo /boot/overlays/uart0-full.dtbo
But I get this error when I check vcdbg log msg :

002104.433: Loaded overlay 'mmc'
002127.772: Failed to load overlay 'uart0-full'
002135.698: Loaded overlay 'uart1'
002135.716: dtparam: txd1_pin=14
002136.186: dtparam: rxd1_pin=15
002136.746: dtparam: i2c1=on
002163.148: Loaded overlay 'i2c-rtc'
002163.165: dtparam: ds1307=true


ttyAMA0 appears in /dev, but raspi-gpio doesn't report it working either (no great surprise there!)

Here's the config, dmesg etc

http://pastebin.com/KYWdHfDU

So I'm a bit stuck on what's not working here, are there any gurus that can help?

Andrew.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2541
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: TTYAMA0 RX/TX/RTS/CTS Overlay for Compute Module

Sat Oct 01, 2016 7:09 pm

Getting just that error ("Failed to load overlay 'uart0-full'") suggests that the firmware can't find the overlay file. I think the reason is that your kernel and firmware pre-dates the switch to Dynamic Device Tree support and the new .dtbo extension. You need to either update to a 4.4 firmware or change the name of the compiled overlay to "uart0-full-overlay.dtb".

nixy82
Posts: 42
Joined: Sat Sep 12, 2015 9:19 am

Re: TTYAMA0 RX/TX/RTS/CTS Overlay for Compute Module

Sat Oct 01, 2016 7:23 pm

Doh!

Yep, that's fixed it :D

Code: Select all

002075.740: Loaded overlay 'uart0-full'

Code: Select all

  GPIO 30: level=0 fsel=7 alt=3 func=CTS0
  GPIO 31: level=1 fsel=7 alt=3 func=RTS0
  GPIO 32: level=1 fsel=7 alt=3 func=TXD0
  GPIO 33: level=1 fsel=7 alt=3 func=RXD0

Return to “Device Tree”