Jump to content
bluehash

Expose remaining beaglebone UARTs

Recommended Posts

Devicetrees... this one might be easier than most other things:

http://hipstercircuits.com/enable-serialuarttty-on-beaglebone-black/

 

The lack of that "/sys/kernel/debug/omap_mux" is actually what this Device Tree debacle is all about.

 

As I've been explaining it to my coworkers who bought BBB's from me--Linux went from (<3.8) pinmux support that was difficult for the kernel maintainers & easy for the end-users, to (>=3.8) easy for the kernel maintainers & very difficult for the end-users :P

 

You'll have to identify the pinmux hex address for all the UARTs first.  That link has the UART4 (called "uart5" in the kernel but "ttyO4") pins listed.

Share this post


Link to post
Share on other sites

There are very likely drivers written for it already

 

FOr me compiling Debian from source, I noticed all sorts of dts file that do not get put into the build. And compiling these dts file into dtbo files is pretty simple, you just need a properly patched device tree is all. There are instructions for how this is done for Debian / ubuntu on RCN's eewiki site. Pretty much a script that just downloads dtc for you adds a path then compiles it and installs it. As forwhere to put the dtbo files . . .yeah i forget exactly, but I think i found this information in the beaglebone, and kernel 3.8 google doc panto / ka6sox wrote.

Share this post


Link to post
Share on other sites
/lib/firmware

Yeah thanks for that. WIth all this reading, and tinkering / geekery ive been up to lately. I am starting to feel a bit senile . . . More than once, ive been asked questions i know at some point I knew the whole answer too, but when asked can only remember part of the answer. sometimes it's maddening lol/

Share this post


Link to post
Share on other sites

@@bluehash I was thinking bluehash, you know what might help some in this regard. DO you use Windows ? If so you can use putty, and WinSCP to browser files on the beaglebone. I think this is actually how I found the dts source files. Honestly it is something I need to use more too, and just start exploring. Mainly though, I use WinSCP to move executables that I've cross compiled on Windows.

Share this post


Link to post
Share on other sites

@@bluehash Err, I changed my post but want to make sure this is clear, I meant to type WinSCP WinCSP doesn't exist as far as I am aware lol, sorry.

 

EDIT: 

 

Anyhow I personally explore directories better using a UI, that is why I suggested WinSCP. Its pretty close to explorer, which just makes it easier to navigate around and find things. Then once found I go back to ssh and start mucking around. YMMV

Share this post


Link to post
Share on other sites

I know UART0 is routed through the USB port. How do I activate, say UART1. 

 

On the old beaglebone white, you could go through /sys/kernel/debug/omap_mux/. How do I mux the UART pins on the BB Black?

Also minor nitpick, UART0 isn't routed through the USB port it's routed out to the 6-pin FTDI header but then you need an FTDI USB-serial cable anyway to access that.

 

I'm going to work on getting UART4 working shortly so I can see if my GPS boosterpack works with this LP cape :)

Share this post


Link to post
Share on other sites

Got it working!

 

Device tree file--just like the hipstercircuits.com link (reformatted it a bit & added a comment to fragment @1)-

/*
 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */
/dts-v1/;
/plugin/;

/ {
        compatible = "ti,beaglebone", "ti,beaglebone-black";

        /* identification */
        part-number = "gps-boosterpak";

        fragment@0 {
                target = <&am33xx_pinmux>;
                __overlay__ {
                        pinctrl_uart5: pinctrl_uart5_pins {
                        pinctrl-single,pins = <
                                0x070 0x26  /* P9_11 = GPIO0_30 = GPMC_WAIT0, MODE6=UART_RXD (note 0x20 input schmitt trigger enabled) */
                                0x074 0x06  /* P9_13 = GPIO0_31 = GPMC_WPN, MODE6=UART_TXD */
                                >;
                        };
                };
        };

        fragment@1 {
                target = <&uart5>;
                __overlay__ {
                        status = "okay";  /* Kernel UART5 object allowed to run now that pins
                                           * are set up to carry out its features
                                           */
                };
        };
        fragment@2 {
                target = <&ocp>;
                __overlay__ {
                        test_helper: helper {
                                compatible = "bone-pinmux-helper";
                                pinctrl-names = "default";
                                pinctrl-0 = <&pinctrl_uart5>;
                                status = "okay";
                        };
                };
        };
};

Compile it:

root@beaglebone:~# dtc -O dtb -o gps-boosterpak-0-00A0.dtbo -b 0 -@ gps-boosterpak-0.dts
root@beaglebone:~# ls -l gps-boosterpak-0-00A0.dtbo
-rw-r--r-- 1 root root 1037 Jan  1 02:14 gps-boosterpak-0-00A0.dtbo
root@beaglebone:~# cp gps-boosterpak-0-00A0.dtbo /lib/firmware/

Enable the "cape":

root@beaglebone:~# echo gps-boosterpak-0 > $SLOTS

 

fyi:

root@beaglebone:~# echo $SLOTS
/sys/devices/bone_capemgr.9/slots

 

 

Dmesg output after this:

[ 7952.186347] bone-capemgr bone_capemgr.9: part_number 'gps-boosterpak-0', version 'N/A'
[ 7952.186531] bone-capemgr bone_capemgr.9: slot #6: generic override
[ 7952.186584] bone-capemgr bone_capemgr.9: bone: Using override eeprom data at slot 6
[ 7952.186637] bone-capemgr bone_capemgr.9: slot #6: 'Override Board Name,00A0,Override Manuf,gps-boosterpak-0'
[ 7952.186917] bone-capemgr bone_capemgr.9: slot #6: Requesting part number/version based 'gps-boosterpak-0-00A0.dtbo
[ 7952.186973] bone-capemgr bone_capemgr.9: slot #6: Requesting firmware 'gps-boosterpak-0-00A0.dtbo' for board-name 'Override Board Name', version '00A0'
[ 7952.187639] bone-capemgr bone_capemgr.9: slot #6: dtbo 'gps-boosterpak-0-00A0.dtbo' loaded; converting to live tree
[ 7952.193188] bone-capemgr bone_capemgr.9: slot #6: #3 overlays
[ 7952.206018] omap_uart 481a8000.serial: did not get pins for uart4 error: -19
[ 7952.209724] 481a8000.serial: ttyO4 at MMIO 0x481a8000 (irq = 61) is a OMAP UART4
[ 7952.215331] bone-capemgr bone_capemgr.9: slot #6: Applied #3 overlays.

Set UART to 9600 and tail 10 lines of text from it:

root@beaglebone:~# ls -l /dev/ttyO4
crw-rw---- 1 root dialout 249, 4 Jan  1 02:12 /dev/ttyO4
root@beaglebone:~# stty -F /dev/ttyO4 9600
root@beaglebone:~# tail -10 /dev/ttyO4

$GPGSA,A,1,,,,,,,,,,,,,,,*1E

$GPRMC,012619.800,V,,,,,0.00,0.00,060180,,,N*47

$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32

$GPGGA,012619.800,,,,,0,0,,,M,,M,,*4D


root@beaglebone:~#

I get a beep in that stream so I suspect there's some garbage characters coming through, not sure if that's normal with the GPS stream or if it's just an artifact of the UART.  Minicom is showing the stream correctly.

 

edit: pics or it didn't happen

post-4-14264691111541_thumb.jpg

Share this post


Link to post
Share on other sites

Lol, after you enable those UARTs don't go and try to remove them...

 

echo -6 > $SLOTS

[ 8731.161989] Unable to handle kernel NULL pointer dereference at virtual address 0000001b
[ 8731.170547] pgd = dcbb8000
[ 8731.173413] [0000001b] *pgd=9cf2b831, *pte=00000000, *ppte=00000000
[ 8731.180080] Internal error: Oops: 17 [#1] SMP THUMB2
[ 8731.185319] Modules linked in: fuse ip_tables g_multi x_tables libcomposite rfcomm ircomm_tty ircomm irda ipv6 hidp bluetooth rfkill autofs4
[ 8731.198831] CPU: 0    Not tainted  (3.8.13 #1)
[ 8731.203547] PC is at omap_device_enable+0xc/0x48
[ 8731.208431] LR is at _od_runtime_resume+0xb/0x14
[ 8731.213317] pc : [<c001f1e8>]    lr : [<c001f22f>]    psr: a00000b3
[ 8731.213317] sp : dcfc7dd8  ip : 22222222  fp : df301810
[ 8731.225419] r10: c03a5cf8  r9 : c003d0cd  r8 : dcfc7e08
[ 8731.230936] r7 : 00000004  r6 : 00000002  r5 : c001f225  r4 : 00000000
[ 8731.237825] r3 : 00000006  r2 : 67966795  r1 : df740c80  r0 : df740c00
[ 8731.244716] Flags: NzCv  IRQs off  FIQs on  Mode SVC_32  ISA Thumb  Segment user
[ 8731.252519] Control: 50c5387d  Table: 9cbb8019  DAC: 00000015
[ 8731.258587] Process sh (pid: 605, stack limit = 0xdcfc6240)
[ 8731.264469] Stack: (0xdcfc7dd8 to 0xdcfc8000)
[ 8731.269078] 7dc0:                                                       df740c10 c001f22f
[ 8731.277719] 7de0: df740c10 c01f5a8b c060eb98 df740c10 df0af610 c01f6391 22222222 00000000
[ 8731.286361] 7e00: 00000000 dead4ead ffffffff ffffffff df740d1c df740c10 00000004 df740c80
[ 8731.295003] 7e20: 40000013 00200200 df740e88 c03a5cf8 df301810 c01f6615 dcd6b040 df740c10
[ 8731.303645] 7e40: c064ece8 c0651038 00000000 c01f07f5 dcd6b040 df740c44 df740c10 c01f0867
[ 8731.312286] 7e60: 00000000 df740c10 df04643c c01f055f df740c10 df0af600 df0af610 c01ef2f5
[ 8731.320929] 7e80: df740c00 df0af600 00000000 c01f1799 df740c00 c01f1905 dc91bd00 c02c7833
[ 8731.329570] 7ea0: dcbeaae8 dc91bd00 df740e50 df740e88 00100100 c02c78b1 dcd6b040 00000000
[ 8731.338212] 7ec0: ffffff60 df740e58 df740e50 df740ef0 dce6e000 c02c7dc7 dc82bc10 00000000
[ 8731.346854] 7ee0: df10c010 dcfc7f80 df10c010 c01fe443 00000006 df301820 d79c53d8 c01ff399
[ 8731.355496] 7f00: c0670b00 c036cc3b 22222222 22222222 22222222 c01ff345 d79c53c0 d79c53d8
[ 8731.364138] 7f20: dcfc7f80 00000003 df10c018 c03a5cf8 00000000 c01ee7a3 df307f88 c00cd74d
[ 8731.372778] 7f40: dc8e35c0 000d6408 00000003 dcfc7f80 000d6408 00000003 00000000 c00942d7
[ 8731.381418] 7f60: dc8e35c0 000d6408 00000000 00000000 dc8e35c0 00000000 000d6408 c00944e3
[ 8731.390057] 7f80: 00000000 00000000 00000003 00000003 000d6408 b6f4ea80 00000004 c000c7e4
[ 8731.398696] 7fa0: dcfc6000 c000c641 00000003 000d6408 00000001 000d6408 00000003 00000000
[ 8731.407335] 7fc0: 00000003 000d6408 b6f4ea80 00000004 00000003 00000003 000d6408 00000000
[ 8731.415974] 7fe0: 00000000 bef4d9c4 b6e8ab2c b6edd30c 600f0010 00000001 0000555c 00000000
[ 8731.424634] [<c001f1e8>] (omap_device_enable+0xc/0x48) from [<c001f22f>] (_od_runtime_resume+0xb/0x14)
[ 8731.434483] [<c001f22f>] (_od_runtime_resume+0xb/0x14) from [<c01f5a8b>] (__rpm_callback+0x23/0x40)
[ 8731.444051] [<c01f5a8b>] (__rpm_callback+0x23/0x40) from [<c01f6391>] (rpm_resume+0x24f/0x31a)
[ 8731.453158] [<c01f6391>] (rpm_resume+0x24f/0x31a) from [<c01f6615>] (__pm_runtime_resume+0x45/0x52)
[ 8731.462727] [<c01f6615>] (__pm_runtime_resume+0x45/0x52) from [<c01f07f5>] (__device_release_driver+0x11/0x6e)
[ 8731.473296] [<c01f07f5>] (__device_release_driver+0x11/0x6e) from [<c01f0867>] (device_release_driver+0x15/0x1e)
[ 8731.484046] [<c01f0867>] (device_release_driver+0x15/0x1e) from [<c01f055f>] (bus_remove_device+0x77/0x88)
[ 8731.494247] [<c01f055f>] (bus_remove_device+0x77/0x88) from [<c01ef2f5>] (device_del+0xa5/0xec)
[ 8731.503445] [<c01ef2f5>] (device_del+0xa5/0xec) from [<c01f1799>] (platform_device_del+0xd/0x30)
[ 8731.512736] [<c01f1799>] (platform_device_del+0xd/0x30) from [<c01f1905>] (platform_device_unregister+0x9/0x12)
[ 8731.523402] [<c01f1905>] (platform_device_unregister+0x9/0x12) from [<c02c7833>] (of_overlay_device_entry_change.isra.1+0x8f/0xd8)
[ 8731.535798] [<c02c7833>] (of_overlay_device_entry_change.isra.1+0x8f/0xd8) from [<c02c78b1>] (of_overlay_revert_one+0x35/0x148)
[ 8731.547917] [<c02c78b1>] (of_overlay_revert_one+0x35/0x148) from [<c02c7dc7>] (of_overlay_revert+0x2b/0x46)
[ 8731.558224] [<c02c7dc7>] (of_overlay_revert+0x2b/0x46) from [<c01fe443>] (bone_capemgr_remove_slot_no_lock+0x27/0x94)
[ 8731.569439] [<c01fe443>] (bone_capemgr_remove_slot_no_lock+0x27/0x94) from [<c01ff399>] (slots_store+0x55/0x25c)
[ 8731.580205] [<c01ff399>] (slots_store+0x55/0x25c) from [<c01ee7a3>] (dev_attr_store+0xb/0x12)
[ 8731.589222] [<c01ee7a3>] (dev_attr_store+0xb/0x12) from [<c00cd74d>] (sysfs_write_file+0x9d/0xd8)
[ 8731.598619] [<c00cd74d>] (sysfs_write_file+0x9d/0xd8) from [<c00942d7>] (vfs_write+0x63/0x104)
[ 8731.607729] [<c00942d7>] (vfs_write+0x63/0x104) from [<c00944e3>] (sys_write+0x27/0x44)
[ 8731.616206] [<c00944e3>] (sys_write+0x27/0x44) from [<c000c641>] (ret_fast_syscall+0x1/0x46)
[ 8731.625121] Code: f8d0 41c8 e000 4604 (7ee3) 2b01
[ 8731.630193] ---[ end trace fb3e05bd1721fa08 ]---

It didn't like that!  I lost my SSH session funny enough and had to re-login (surprised it didn't crash completely).

I wonder if there's another way you're supposed to do it, like add another devicetree that sets uart5's status to "not okay" or something ;)

Share this post


Link to post
Share on other sites

@@spirilis You need to reboot. I've had that happen to me too. if faults on you like that, kicks you off root into normal user, then most of the time locks up the terminal.

 

Either way you need to reboot your board now, notice that you've also lost some ssh/bash user history. . .

Share this post


Link to post
Share on other sites

PS, looking under /lib/firmware I noticed there are quite a lot of devicetree firmwares already:

root@beaglebone:/lib/firmware# ls
3com			   BB-BONE-eMMC1-01-00A0.dtbo  bone_pwm_P8_46-00A0.dtbo		 cape-bone-geiger-00A0.dtbo	  edgeport     sun
BB-BONE-AUDI-01-00A0.dtbo  BB-BONELT-BT-00A0.dtbo      bone_pwm_P9_14-00A0.dtbo		 cape-bone-hexy-00A0.dtbo	  emi26        tehuti
BB-BONE-CAM3-01-00A2.dtbo  BB-WS2811-SPI0-00A0.dtbo    bone_pwm_P9_16-00A0.dtbo		 cape-bone-iio-00A0.dtbo	  emi62        ti_3410.fw
BB-BONE-GPEVT-00A0.dtbo    acenic		       bone_pwm_P9_21-00A0.dtbo		 cape-bone-lcd3-00A0.dtbo	  ess	       ti_5052.fw
BB-BONE-LCD4-01-00A0.dtbo  adaptec		       bone_pwm_P9_22-00A0.dtbo		 cape-bone-lcd3-00A2.dtbo	  kaweth       tigon
BB-BONE-LCD4-01-00A1.dtbo  advansys		       bone_pwm_P9_28-00A0.dtbo		 cape-bone-mrf24j40-00A0.dtbo	  keyspan      ttusb-budget
BB-BONE-LCD7-01-00A2.dtbo  am33xx_pwm-00A0.dtbo        bone_pwm_P9_29-00A0.dtbo		 cape-bone-nixie-00A0.dtbo	  keyspan_pda  vicam
BB-BONE-LCD7-01-00A3.dtbo  atmsar11.fw		       bone_pwm_P9_31-00A0.dtbo		 cape-bone-pinmux-test-00A0.dtbo  matrox       whiteheat.fw
BB-BONE-LCD7-01-00A4.dtbo  av7110		       bone_pwm_P9_42-00A0.dtbo		 cape-bone-tester-00A0.dtbo	  mts_cdma.fw  whiteheat_loader.fw
BB-BONE-PRU-01-00A0.dtbo   bnx2			       cape-bone-2g-emmc1.dtbo		 cape-bone-weather-00A0.dtbo	  mts_edge.fw  yam
BB-BONE-PRU-02-00A0.dtbo   bnx2x		       cape-bone-adafruit-lcd-00A0.dtbo  cape-boneblack-hdmi-00A0.dtbo	  mts_gsm.fw   yamaha
BB-BONE-PWMT-00A0.dtbo	   bone_pwm_P8_13-00A0.dtbo    cape-bone-adafruit-rtc-00A0.dtbo  cis				  myricom
BB-BONE-RS232-00A0.dtbo    bone_pwm_P8_19-00A0.dtbo    cape-bone-dvi-00A0.dtbo		 cpia2				  ositech
BB-BONE-RST-00A0.dtbo	   bone_pwm_P8_34-00A0.dtbo    cape-bone-dvi-00A1.dtbo		 cxgb3				  qlogic
BB-BONE-RST2-00A0.dtbo	   bone_pwm_P8_36-00A0.dtbo    cape-bone-dvi-00A2.dtbo		 dsp56k				  r128
BB-BONE-SERL-01-00A1.dtbo  bone_pwm_P8_45-00A0.dtbo    cape-bone-exptest-00A0.dtbo	 e100				  radeon

Could try the bone_pwm_* "capes" and see if they work out of the box...

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...