# Beaglebone cape support

**URL:** <https://forums.balena.io/t/beaglebone-cape-support/4620>\
**Category:** balenaOS\
**Tags:** beaglebone\
**Created:** [December 6, 2018, 12:41pm UTC](https://forums.balena.io/t/beaglebone-cape-support/4620 "2018-12-06T12:41:17Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![sei1](https://avatars.discourse-cdn.com/v4/letter/s/f4b2a3/32.png) [@sei1](https://forums.balena.io/u/sei1)\
**Post date:** [December 6, 2018, 12:41pm UTC](https://forums.balena.io/t/beaglebone-cape-support/4620/1 "2018-12-06T12:41:17Z")

</div>

I’m trying to get my Beaglebone (green) to enable ttyS4. I’m running 2.15.1+rev1-dev - the latest download from balenaCloud.

If I try to enable it manually by ‘echo BB-UART4-RS485 \> /sys/devices/platform/bone\_capemgr/slots’ I get a kernel oops in \_\_of\_overlay\_create:

> [265.832538] bone\_capemgr bone\_capemgr: part\_number ‘BB-UART2-RTSCTS’, version ‘N/A’  
> [265.842181] bone\_capemgr bone\_capemgr: slot #4: override  
> [265.857452] bone\_capemgr bone\_capemgr: Using override eeprom data at slot 4  
> [265.887764] bone\_capemgr bone\_capemgr: slot #4: ‘Override Board Name,00A0,Override Manuf,BB-UART2-RTSCTS’  
> [265.907736] Unable to handle kernel NULL pointer dereference at virtual address 0000000c  
> [265.919845] pgd = c7950000  
> [265.922680] [0000000c] \*pgd=00000000  
> [265.931816] Internal error: Oops: 5 [#1] PREEMPT SMP ARM  
> [265.937176] Modules linked in: ipt\_REJECT nf\_reject\_ipv4 ipt\_MASQUERADE nf\_nat\_masquerade\_ipv4 br\_netfilter nf\_conntrack\_netlink nfnetlink xfrm\_user xfrm\_algo evdev uio\_pdrv\_genirq uio nls\_ascii nls\_cp437 sch\_fq\_codel  
> [265.956643] CPU: 0 PID: 1690 Comm: sh Not tainted 4.14.53+ #2  
> [265.962418] Hardware name: Generic AM33XX (Flattened Device Tree)  
> [265.968540] task: dc799e00 task.stack: c79d0000  
> [265.973120] PC is at \_\_of\_overlay\_create+0x43c/0xb60  
> [265.978113] LR is at \_\_of\_overlay\_create+0x448/0xb60  
> [265.983101] pc : [] lr : [] psr: 20070013  
> [265.989397] sp : c79d1d58 ip : c79d5298 fp : c79d1dec  
> …  
> [266.216921] [] (\_\_of\_overlay\_create) from [] (of\_overlay\_create+0x20/0x24)  
> [266.225595] [] (of\_overlay\_create) from [] (capemgr\_load\_slot+0x480/0x5d0)  
> [266.234259] [] (capemgr\_load\_slot) from [] (slots\_store+0x150/0x328)  
> [266.242403] [] (slots\_store) from [] (dev\_attr\_store+0x28/0x34)  
> [266.250110] [] (dev\_attr\_store) from [] (sysfs\_kf\_write+0x50/0x54)  
> [266.258074] [] (sysfs\_kf\_write) from [] (kernfs\_fop\_write+0xf8/0x1d4)  
> [266.266302] [] (kernfs\_fop\_write) from [] (\_\_vfs\_write+0x28/0x48)  
> [266.274178] [] (\_\_vfs\_write) from [] (vfs\_write+0xb4/0x1c0)  
> [266.281528] [] (vfs\_write) from [] (SyS\_write+0x5c/0xbc)  
> [266.288625] [] (SyS\_write) from [] (\_\_sys\_trace\_return+0x0/0x10)  
> [266.296415] Code: e584902c e5843034 e584403c e584a028 (e590500c)  
> [266.478799] —[end trace b1ba7d0f614b6dcb]—

Should this work - is this the correct way of enabling it?

Thanks.

---

<div class="post-metadata">

**Author:** ![spanceac](https://avatars.discourse-cdn.com/v4/letter/s/cc9497/32.png) [@spanceac](https://forums.balena.io/u/spanceac)\
**Post date:** [February 21, 2019, 1:33pm UTC](https://forums.balena.io/t/beaglebone-cape-support/4620/2 "2019-02-21T13:33:16Z")

</div>

Hi @sei1,

We are preparing a release for Beaglebone devices where you are able to load device tree overlays from u-boot by adding in `uEnv.txt` the following content:

```
enable_uboot_overlays=1
uboot_overlay_addr0=/boot/overlays/BB-UART4-RS485-00A0.dtbo

```

You can download the `2.29.2+rev3` release from staging dashboard and try it. [https://dashboard.balena-staging.io/apps](https://dashboard.balena-staging.io/apps)

This release will soon reach production

---

<div class="post-metadata">

**Author:** ![sei1](https://avatars.discourse-cdn.com/v4/letter/s/f4b2a3/32.png) [@sei1](https://forums.balena.io/u/sei1)\
**Post date:** [March 5, 2019, 1:29pm UTC](https://forums.balena.io/t/beaglebone-cape-support/4620/5 "2019-03-05T13:29:42Z")

</div>

Hi @spanceac,  
I’ve just got my Beaglebone back and tried it - the 2.29.2+rev3 appears in the main dashboard now too.  
It looks like it’s working, I can see the UART4 appear in the kernel log when it’s booting. I’ll dig out my RS485 cape and test code 😄  
Thanks for your reply.

---

<div class="post-metadata">

**Author:** ![spanceac](https://avatars.discourse-cdn.com/v4/letter/s/cc9497/32.png) [@spanceac](https://forums.balena.io/u/spanceac)\
**Post date:** [March 5, 2019, 1:58pm UTC](https://forums.balena.io/t/beaglebone-cape-support/4620/6 "2019-03-05T13:58:24Z")

</div>

Hi @sei1,

Please let us know how it went.

Regards!

---

<div class="post-metadata">

**Author:** ![sei1](https://avatars.discourse-cdn.com/v4/letter/s/f4b2a3/32.png) [@sei1](https://forums.balena.io/u/sei1)\
**Post date:** [March 6, 2019, 11:14am UTC](https://forums.balena.io/t/beaglebone-cape-support/4620/7 "2019-03-06T11:14:18Z")

</div>

Hi @spanceac,

Unfortunately it is not working quite yet. Although I can see data on the scope out of UART4-TX, the RTS pin isn’t changing.

Looking in /sys/kernel/debug/pinctrl/44e10800.pinmux

> group: pinmux\_bb\_uart4\_rs485\_pins  
> pin 29 (PIN29)  
> pin 28 (PIN28)  
> pin 105 (PIN105)

I can see that the RX and TX are set to the UART4 peripheral (0x0e & 0x07) == 6

> pin 29 (PIN29) 44e10874 0000000e pinctrl-single  
> pin 28 (PIN28) 44e10870 0000002e pinctrl-single

But the RTS pin is still assigned to GPIO == 7

> pin 105 (PIN105) 44e109a4 00000007 pinctrl-single

> **Edit - I don't think this hidden observation was relevant**
>
> I’ve hidden this bit because I don’t think it is relevant - it looks like the BBG overlay is added after.
> 
> > Looking through the u-boot output, it looks like it detects that I’m using a BBGreen, but loads uboot\_base\_dtb\_univ = am335x-boneblack-uboot.dtb.
> > 
> > debug: [enable\_uboot\_overlays=1] …  
> > debug: [enable\_uboot\_cape\_universal=] …  
> > debug: [uboot\_base\_dtb\_univ=am335x-boneblack-uboot.dtb] …  
> > uboot\_overlays: [uboot\_base\_dtb=am335x-boneblack-uboot.dtb] …  
> > uboot\_overlays: Switching too: dtb=am335x-boneblack-uboot.dtb …  
> > loading /boot/am335x-boneblack-uboot.dtb …  
> > 58048 bytes read in 41 ms (1.3 MiB/s)  
> > uboot\_overlays: [fdt\_buffer=0x60000] …  
> > uboot\_overlays: loading /boot/overlays/M-BB-BBG-00A0.dtbo …  
> > 277 bytes read in 148 ms (1000 Bytes/s)  
> > uboot\_overlays: loading /boot/overlays/BB-UART4-RS485-00A0.dtbo …  
> > 1127 bytes read in 173 ms (5.9 KiB/s)  
> > uboot\_overlays: loading /boot/overlays/BB-BONE-eMMC1-01-00A0.dtbo …  
> > 1105 bytes read in 91 ms (11.7 KiB/s)  
> > uboot\_overlays: loading /boot/overlays/BB-ADC-00A0.dtbo …  
> > 695 bytes read in 85 ms (7.8 KiB/s)  
> > uboot\_overlays: add [enable\_uboot\_cape\_universal=1] to /boot/uEnv.txt to enable…

Any thoughts?

Thanks.

---

<div class="post-metadata">

**Author:** ![spanceac](https://avatars.discourse-cdn.com/v4/letter/s/cc9497/32.png) [@spanceac](https://forums.balena.io/u/spanceac)\
**Post date:** [March 7, 2019, 10:59am UTC](https://forums.balena.io/t/beaglebone-cape-support/4620/8 "2019-03-07T10:59:06Z")

</div>

Hi @sei1,

According to the dts, the RTS gpio is `rts-gpio = <&gpio3 19 1>;`  
[https://github.com/beagleboard/bb.org-overlays/blob/master/src/arm/BB-UART4-RS485-00A0.dts](https://github.com/beagleboard/bb.org-overlays/blob/master/src/arm/BB-UART4-RS485-00A0.dts)

That would mean RTS gpio is GPIO3\_19 or as Linux sees it: 3\*32+19 = gpio115

Regards!

---

<div class="post-metadata">

**Author:** ![sei1](https://avatars.discourse-cdn.com/v4/letter/s/f4b2a3/32.png) [@sei1](https://forums.balena.io/u/sei1)\
**Post date:** [March 7, 2019, 3:45pm UTC](https://forums.balena.io/t/beaglebone-cape-support/4620/9 "2019-03-07T15:45:05Z")

</div>

Thanks for that reference @spanceac. Sorry, it’s been a while since I looked in the dts and I guess I was just assuming it would be the UART4\_RTS pin.

So I suppose my now problem is that rts-gpio is only used in the omap-serial driver

> $ grep -Rl rts-gpio linux  
> linux/drivers/tty/serial/imx.c  
> linux/drivers/tty/serial/omap-serial.c  
> linux/drivers/tty/serial/sirfsoc\_uart.c

but the kernel config uses the 8250 driver

> $ gunzip -c config.gz | grep “SERIAL\_.\*OMAP”  
> CONFIG\_SERIAL\_8250\_OMAP=y  
> CONFIG\_SERIAL\_8250\_OMAP\_TTYO\_FIXUP=y  
> #CONFIG\_SERIAL\_OMAP is not set

I’ll take a look into rolling my own dtbo to enable the RTS pin instead of that no-longer supported gpio!

Thanks very much for your help 👍

---

<div class="post-metadata">

**Author:** ![sei1](https://avatars.discourse-cdn.com/v4/letter/s/f4b2a3/32.png) [@sei1](https://forums.balena.io/u/sei1)\
**Post date:** [March 7, 2019, 4:42pm UTC](https://forums.balena.io/t/beaglebone-cape-support/4620/10 "2019-03-07T16:42:40Z")

</div>

Good news is I tried the UART2\_RTSCTS overlay and I’m getting the expected output in my scope!  
Cheers 🙂

---

<div class="post-metadata">

**Author:** ![imrehg](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/imrehg/32/36_2.png) [@imrehg](https://forums.balena.io/u/imrehg)\
**Post date:** [March 7, 2019, 6:34pm UTC](https://forums.balena.io/t/beaglebone-cape-support/4620/11 "2019-03-07T18:34:02Z")

</div>

Glad to hear, cheers for the feedback, @sei1!
