palhinhaa
Posts: 4
Joined: Fri Feb 19, 2016 6:40 pm

Cant remap UART0 RXD0 to GPIO37

Fri Feb 19, 2016 6:56 pm

Hello everyone, this is my first post, hope you can help me.

Im using a Raspberry Pi Compute Module with Raspian.

Im trying to remap UART0 to work on GPIO36(TXD0) and GPIO37(RXD0) but no success on remapping RXD0 on GPIO37.

This is the device tree source that i compiled and copy to /boot/overlays:

Code: Select all

/dts-v1/;
/plugin/;


/{
        compatible = "brcm,bcm2708";


        [email protected] {
                target = <&uart0>;
                __overlay__ {
                        pinctrl-names = "default";
                        pinctrl-0 = <&uart0_pins>;
                        status = "okay";
                };
        };


        [email protected] {
                target = <&gpio>;
                __overlay__ {
                        uart0_pins: uart0_pins {
                                brcm,pins = < 36 37>;
                                brcm,function = <6 6>; /* alt2 alt2 */
                                brcm,pull = <0 2>; /* 2:up, 1:down, 0:none */
                        };
                };
        };


        [email protected] {
                target-path = "/chosen";
                __overlay__ {
                        bootargs = "8250.nr_uarts=2";
                };
        };

        __overrides__ {
                txd0_pin = <&uart0_pins>,"brcm,pins:0";
                rxd0_pin = <&uart0_pins>,"brcm,pins:4";
        };
};

TXD0 is working but RXD0 doesnt.

I was able to remap to another pins, GPIO32 (TXD0) and GPIO33 (RXD0) and it woks well, only fails when i remap RXD0 to GPIO37.

I disabled console in file /boot/cmdline.txt.
I added the line dtoverlay=uart0 to /boot/config.txt.

Is anything wrong in this device tree file?

Thank you

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5352
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Cant remap UART0 RXD0 to GPIO37

Fri Feb 19, 2016 9:53 pm

The firmware blob maps TXD and RXD to GPIOs 14 & 15 (with pullup on RXD), so make sure you unmap those pins before trying to route them elsewhere.
If I remember the comment correctly, inputs get or'ed together so that pull up would result in a permanent high and no data visible.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

palhinhaa
Posts: 4
Joined: Fri Feb 19, 2016 6:40 pm

Re: Cant remap UART0 RXD0 to GPIO37

Mon Feb 22, 2016 10:31 am

6by9 wrote:The firmware blob maps TXD and RXD to GPIOs 14 & 15 (with pullup on RXD), so make sure you unmap those pins before trying to route them elsewhere.
If I remember the comment correctly, inputs get or'ed together so that pull up would result in a permanent high and no data visible.
How can i unmap GPIOs 14 & 15 from UART0 (set them as GPIO inputs)?

Thank you

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5352
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Cant remap UART0 RXD0 to GPIO37

Mon Feb 22, 2016 10:43 am

palhinhaa wrote:
6by9 wrote:The firmware blob maps TXD and RXD to GPIOs 14 & 15 (with pullup on RXD), so make sure you unmap those pins before trying to route them elsewhere.
If I remember the comment correctly, inputs get or'ed together so that pull up would result in a permanent high and no data visible.
How can i unmap GPIOs 14 & 15 from UART0 (set them as GPIO inputs)?
Yes, set them as inputs (or outputs, or anything other than ALT0).

"sudo raspi-gpio get" will print out the mapping of all GPIOs. Make sure you don't have two pins set to the same UART function (mainly input lines, multiple TXD lines would probably work but don't quote me on that). "apt-get install raspi-gpio" if you haven't already got it installed.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

palhinhaa
Posts: 4
Joined: Fri Feb 19, 2016 6:40 pm

Re: Cant remap UART0 RXD0 to GPIO37

Mon Feb 22, 2016 4:55 pm

Can you point me how i can unmap TXD0 and RXD0 from pins 14 and 15?
They keep associated when typing "raspi-gpio get", where they are beeing mapped?

Thank you

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5352
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Cant remap UART0 RXD0 to GPIO37

Mon Feb 22, 2016 5:07 pm

Either manually with something like

Code: Select all

sudo raspi-gpio set 14 ip
sudo raspi-gpio set 15 ip
or follow https://www.raspberrypi.org/documentati ... uration.md to create a new dt-blob.bin file to put in /boot (this can run into issues when newer firmwares update the pin config. The current default pin config is in https://github.com/raspberrypi/firmware ... t-blob.dts)

(Source for raspi-gpio is at https://github.com/RPi-Distro/raspi-gpio, or try "raspi-gpio help" for the help text)
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

palhinhaa
Posts: 4
Joined: Fri Feb 19, 2016 6:40 pm

Re: Cant remap UART0 RXD0 to GPIO37

Mon Feb 22, 2016 5:59 pm

Thank you,

unmapping those pins solved my problem.

Sohil.Mehta
Posts: 25
Joined: Thu Feb 01, 2018 6:45 am

Re: Cant remap UART0 RXD0 to GPIO37

Wed Apr 18, 2018 9:41 am

Hi,

I had the same issue. I am using the same dtoverlay as used above. I also added:

Code: Select all

dtoverlay=uart0,txd0=36,rxd0=37
in /boot/config.txt

I ran raspi-gpio get and found out that the uart0 was going to pins 14,15 and 36,37. So I ran the following lines in the command line:

Code: Select all

sudo raspi-gpio set 14 ip       ....(1)
sudo raspi-gpio set 15 ip       ....(2)
But once I reboot the changes are lost and I get conflict of uart0 between 14, 15 and 36,37. This means I have to permanently set 14 and 15 to ip. So I moved (1) and (2) in /etc/rc.local. Is there a way to do this without moving (1) and (2) in rc.local?

Return to “Device Tree”

Who is online

Users browsing this forum: No registered users and 4 guests