UARTs enabled but don't work on Debian!

4,102 views
Skip to first unread message

m.jafa...@gmail.com

unread,
Nov 14, 2014, 1:17:41 PM11/14/14
to beagl...@googlegroups.com
I've been playing around with my BBB for about a month now and got everything up and running. Today I spent the whole day to get UART loopback to work on Debian. It simply doesn't work! Tried with Qt (cross-compiled and all samples are working), QSerialPortInfo::availablePorts().count() returns zero. At first I thought it can be a QtSerialPort issue. So I did a loop back on UART1 and UART2 (P9.21 connected to P9.26 and P9.22 connected to P9.24). Then opened "minicom -b 9600 -D /dev/ttyO1" and "minicom -b 9600 -D /dev/ttyO2" in two separate terminals. I expected to see whatever I type in each one of the terminals on the other one. But that wasn't the case. Nothing happens! Any idea what's wrong?

Here's some info about my setup:

Fresh install of "BBB-eMMC-flasher-debian-7.7-console-armhf-2014-10-29-2gb.img.xz". Didn't modify anything. 

"uname -a": 
Linux arm 3.14.22-ti-r31 #1 SMP PREEMPT Fri Oct 24 20:50:46 UTC 2014 armv7l GNU/Linux

"dmesg | grep ttyO":
[    0.000000] Kernel command line: console=ttyO0,115200n8 root=UUID=a52b5fd5-953d-458c-94d0-0cf2ff1c7115 ro rootfstype=ext4 rootwait fixrtc quiet init=/lib/systemd/systemd
[    2.799292] 44e09000.serial: ttyO0 at MMIO 0x44e09000 (irq = 88, base_baud = 3000000) is a OMAP UART0
[    2.800424] console [ttyO0] enabled
[    2.802247] 48022000.serial: ttyO1 at MMIO 0x48022000 (irq = 89, base_baud = 3000000) is a OMAP UART1
[    2.803710] 48024000.serial: ttyO2 at MMIO 0x48024000 (irq = 90, base_baud = 3000000) is a OMAP UART2
[    2.805198] 481a8000.serial: ttyO4 at MMIO 0x481a8000 (irq = 61, base_baud = 3000000) is a OMAP UART4
[    2.806622] 481aa000.serial: ttyO5 at MMIO 0x481aa000 (irq = 62, base_baud = 3000000) is a OMAP UART5

"ls -al /dev/ttyO*":
crw-rw---- 1 root tty     249, 0 Oct 29 19:06 /dev/ttyO0
crw-rw---T 1 root dialout 249, 1 Nov 14 17:41 /dev/ttyO1
crw-rw---T 1 root dialout 249, 2 Nov 14 17:41 /dev/ttyO2
crw-rw---T 1 root dialout 249, 4 Jan  1  2000 /dev/ttyO4
crw-rw---T 1 root dialout 249, 5 Jan  1  2000 /dev/ttyO5


I appreciate anything that might help! :)

Robert Nelson

unread,
Nov 14, 2014, 4:12:22 PM11/14/14
to Beagle Board

http://elinux.org/Beagleboard:Capes_3.8_to_3.14#Custom_dtb

The pins aren't mixed to the peripheral.

Example enable this

https://github.com/RobertCNelson/dtb-rebuilder/blob/3.14-ti/src/arm/am335x-boneblack.dts#L78

And run...

make ; sudo make install ; sudo reboot

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mostafa Jafarzadeh

unread,
Nov 14, 2014, 11:40:56 PM11/14/14
to beagl...@googlegroups.com
Hi Robert,

Many thanks. You saved my day! :-)
I did a loopback on UART2 and UART4 and they're both fine. However UART1 TX doesn't work! RX is fine. I had a look at the dtb sources and pins are correct. Do you have any idea what's wrong?

Just for the reference, it wasn't really smooth and hassle-free to compile DTBs. After installing all dependencies, I had to compile and install device-tree-compiler manually according to this tutorial:

Mostafa Jafarzadeh

unread,
Nov 21, 2014, 4:36:34 AM11/21/14
to beagl...@googlegroups.com
Ok after spending quite a few days playing around with UARTs seems that I can't get UART0 to work. I needed to disable the console output. But even after doing so I can get it to work. Can anyone tell me step by step how to make this port available like the rest of the UARTs on the board? I need to use all UARTs in my design.

Thanks in advance.

John Mladenik

unread,
Nov 22, 2014, 10:41:07 PM11/22/14
to beagl...@googlegroups.com
Robert,

I am having the same problem with UART2 (the only UART I need to work)  but mine worked in the past.  It even worked through re-power until the BBB sat overnight unpowered.  I went through all of the steps I found in links to make it work, but none of the steps were anything like yours.    I am a newbie to software and linux so I don't really understand what you are saying to do.  .  Can you tell me what exactly your program and compile are doing?  Will it work for UART2.  

When you said "The pins aren't mixed to the peripheral." did you mean MUXED instead of mixed?

so you have a dtb file that you compile into a dts file?   Since /src/arm does no exist on my BBB do I need to create that folder to copy the file into it?    I assume it is changing the mux configuration of the UART pins to be connected in the ARM to the UART iinstead of the GPIO?   

Sorry of my questions seem dumb, but that is what I feel like, I spent at least 10-12 hours to get the UART to work the first time and when it stopped working the next day it set me back weeks in my project. :(  

William Hermans

unread,
Nov 22, 2014, 10:52:22 PM11/22/14
to beagl...@googlegroups.com
John, detailed description is required. "Dont work" is pretty vague and leaves a lot of room for guessing.
Message has been deleted

William Hermans

unread,
Nov 25, 2014, 3:13:03 AM11/25/14
to beagl...@googlegroups.com
What user is the script running as ?

On Mon, Nov 24, 2014 at 9:02 PM, John Mladenik <john...@sbcglobal.net> wrote:
Ok Sorry, I am trying to send characters out the UART2 on a BBB Rev C using HTML Javascript SEE program below:  This worked before and stopped working, not sure why.   Be patient with my I am a newbie a month or so into learning HTML. Javascript, linux, beaglebone, but only working on it part time outside of my regular job.  

I have a logic analyzer connected to P9 Pins 20 & 21 which are the UART2 TX and RX line.   When I send the data using below program the TX pin does not toggle so no data comes out of the TX pin. 

When this worked it sent the data using program below and if I input a 5 a value of 0x05 was shifted out of the UART2 on the TX pin.    My goal is to get the UART2 to work after power up without having to type in a bunch of commands before running the HTML/Javscript.


When I type       
cat /sys/devices/bone_capemgr.*/slots  
I get the following:
 0: 54:PF---
 1: 55:PF---
 2: 56:PF---
 3: 57:PF---
 4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
 5: ff:P-O-L Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
 7: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-UART2

I did add the following line to my uEnv.txt file    
capemgr.enable_partno=BB-UART2

But this didn't seem to make a difference either way.    Any suggestions would be appreciated.     

Example code below here *******************************
// UART2 TX Test filename = uartwr.html

<html>
<body>

Uart Byte:<br>
<input type="number" name="value" id='value'/>
<button onclick="uartWr()">SEND</button>

</body>
<head>
<script src="/bonescript.js"></script>
<script>

function uartWr() {
    var b = require('bonescript');
    // set baud rate and buffer size

    var port = '/dev/ttyO2'; // set UART port
    var data = document.getElementById('value').value;
    
    var options = { baudrate: 9600, buffer: 100} ;
    b.serialOpen(port, options, onSerial);// 
    
    function onSerial(x) {
        var b = require('bonescript');
        if (x.err) {
            console.log('***ERROR*** ' + JSON.stringify(x));
        }
        if (x.event == 'open') {
           console.log('***OPENED***');
        }
        if (x.event == 'data') {
            console.log(String(x.data));
        }
    }
    b.serialWrite(port, [data] );
}

        
    </script>

</head>
</html>
Example code Above here *******************************

John Mladenik

unread,
Nov 25, 2014, 1:42:11 PM11/25/14
to beagl...@googlegroups.com
Thanks for the response but I got it to work right after I posted this and I tried to delete it to not bother you with the explanation.   The thing worked the whole time I had my logic analyzer on the wrong pins.  When I tried it on my 2nd BBB, that had never been powered until then, it worked right out of the box without any configuration or setup.   I then went back to the original BBB and realized I had the test point on the wrong pins, and once probing the correct pins, I realized that it works and probably had worked from the beginning.  

Thanks again for your help and responses.
John

So Uart2 works right out of the box without setting any configuration, or pin mux or anything, at least if does for my 2 BBB Rev C's that I have.  

Steve G

unread,
Nov 28, 2014, 9:04:48 AM11/28/14
to beagl...@googlegroups.com
I'm trying to do this on my BBB with Debian but I'm getting a compile error:

debian@bbblack:~/dtb-rebuilder$ make
  DTC     src/arm/am335x-base0033.dtb
/bin/sh: 1: dtc: not found
make[1]: *** [src/arm/am335x-base0033.dtb] Error 127
make: *** [all_arm] Error 2
debian@bbblack:~/dtb-rebuilder$ 

I followed the custom dtb directions in the link.

Mostafa Jafarzadeh

unread,
Nov 28, 2014, 10:34:22 AM11/28/14
to beagl...@googlegroups.com
Hi Steve

You need to install device tree compiler. I suggest you compile it from source yourself, as there is a patch you need to apply. Here's my instructions from a manual I wrote a while ago:

BBB> cd dtc
BBB> git reset --hard f8cb5dd94903a5cfa1609695328b8f1d5557367f
BBB> wget https://patchwork.kernel.org/patch/1934471/raw/ -O dynamic-symbols.patch
BBB> git apply dynamic-symbols.patch
BBB> make
BBB> sudo cp dtc /usr/local/bin

Mostafa Jafarzadeh

unread,
Nov 28, 2014, 10:37:04 AM11/28/14
to beagl...@googlegroups.com
Guys I still can't get UART0 to work. Other ports are fine. Anyone has any idea how to make UART0 available on BBB? I really appreciate any help!

John Mladenik

unread,
Nov 28, 2014, 1:02:12 PM11/28/14
to beagl...@googlegroups.com
Does the USB work on your BBB?  I thought UART0 was used for the USB.  Both of my Rev C BBB's powered up with USB working.  

Steve G

unread,
Nov 28, 2014, 5:22:44 PM11/28/14
to beagl...@googlegroups.com
Thanks that got me a lot further along.

The problem I have now is the serial ports I believe I enabled didn't appear in the /dev directory.

What I did was uncomment the lines like the following in am335x-boneblack.dts, recompiled and installed:

#include "am335x-bone-ttyO1.dtsi"

I have /dev/ttyO0, ttyS1, ttyS2 and ttyS3  but I was expecting more ttyO* devices.

Robert Nelson

unread,
Nov 28, 2014, 5:27:11 PM11/28/14
to Beagle Board
On Fri, Nov 28, 2014 at 4:22 PM, Steve G <steve...@gmail.com> wrote:
> Thanks that got me a lot further along.
>
> The problem I have now is the serial ports I believe I enabled didn't appear
> in the /dev directory.
>
> What I did was uncomment the lines like the following in
> am335x-boneblack.dts, recompiled and installed:
>
> #include "am335x-bone-ttyO1.dtsi"
>
> I have /dev/ttyO0, ttyS1, ttyS2 and ttyS3 but I was expecting more ttyO*
> devices.

^ that should have gotten you /dev/ttyO1...

btw, if all you need to do is enable ttyO1 you can also do in /boot/uEnv.txt:

dtb=am335x-boneblack-ttyO1.dtb

Which is boneblack + ttyO1 enabled..

(I've done this for all device + one cape setups')

Regards,

--
Robert Nelson
http://www.rcn-ee.com/

Mostafa Jafarzadeh

unread,
Nov 28, 2014, 9:46:39 PM11/28/14
to beagl...@googlegroups.com
I don't think that's true! What I see on the manual is that UART0 pins are not muxed with USB. I do need the USB ports although they're not in use right now (but I try them occasionally and they're working fine). I also couldn't find any dtb or dts files with ttyO0 in it's name to modify. So I guess pins are muxed in another dtb file.

Mostafa Jafarzadeh

unread,
Nov 28, 2014, 9:50:30 PM11/28/14
to beagl...@googlegroups.com
Which kernel are you using? I'm on 3.14.23-ti-r32 and all serial ports are available under /dev/ right after a fresh flash. But I still needed to rebuild DTBs to get them working.

Steve G

unread,
Nov 29, 2014, 7:25:54 AM11/29/14
to beagl...@googlegroups.com
I noticed that on my BBB running the RCN demo image from August (debian-7.6-console-armhf-2014-08-13) on a microSD card the uEnv.txt file is actually in /boot/uboot, not in /boot.  Also there was a warning in uEnv.txt "##Note: On the BeagleBone Black, there is also an uEnv.txt in the eMMC, so if these changes do not seem to be makeing a difference..."  Since I'm booting directly from microSD maybe it's looking here though I don't think eMMC is even mounted.

Steve G

unread,
Nov 29, 2014, 3:53:27 PM11/29/14
to beagl...@googlegroups.com
I googled around and added the following line to uEnv.txt and rebooted:

optargs=capemgr.enable_partno=BB-UART1,BB-UART2,BB-UART4,BB-UART5

Now I have /dev/ttyO1-5 but I don't know if they work yet.
Reply all
Reply to author
Forward
0 new messages