[yocto] Trouble Enabling UART on Raspberry Pi when booting with U-Boot

Karl Eaves karl at auto-is.com
Thu Jan 24 11:49:15 PST 2019


Hello,

I am a fairly new to developing with yocto. I have been able to
successfully build a raspberry pi image with all the dtoverlays required
to enable UART and RTC on the raspberry pi. However, when I added the
meta-updater and meta-updater-raspberry pi layers, they required me to
boot using U-Boot, which does not work when using  dtoverlays =
"pi3-disable-bt", etc in the config.txt.

Following other hints online, I was able to create a patch that added my
own custom dtb

 1.
    From 8582311b1921f5a6de4322531c141a93f902637d Mon Sep 17 00:00:00 2001
 2.
    From: Mike Allen <mallen3699 at gmail.com>
 3.
    Date: Fri, 4 Jan 2019 13:02:51 -0600
 4.
    Subject: [PATCH] custom dts
 5.
     
 6.
    ---
 7.
     .../boot/dts/bcm2710-rpi-3-b-plus-wispr.dts   | 27 +++++++++++++++++++
 8.
     1 file changed, 27 insertions(+)
 9.
     create mode 100644 arch/arm/boot/dts/bcm2710-rpi-3-b-plus-wispr.dts
10.
     
11.
    diff --git a/arch/arm/boot/dts/bcm2710-rpi-3-b-plus-wispr.dts
    b/arch/arm/boot/dts/bcm2710-rpi-3-b-plus-wispr.dts
12.
    new file mode 100644
13.
    index 000000000000..1e26363b3eed
14.
    --- /dev/null
15.
    +++ b/arch/arm/boot/dts/bcm2710-rpi-3-b-plus-wispr.dts
16.
    @@ -0,0 +1,43 @@
17.
    +/* Custom dts file for raspberry pi 3 b plus for WISPr Systems */
18.
    +
19.
    +#include "bcm2710-rpi-3-b-plus.dts"
20.
    +
21.
    +&i2c1 {
22.
    +    #address-cells = <1>;
23.
    +    #size-cells = <0>;
24.
    +    status = "okay";
25.
    +
26.
    +    pcf8523: pcf8523 at 68 {
27.
    +        compatible = "nxp,pcf8523";
28.
    +        reg = <0x68>;
29.
    +        status = "okay";
30.
    +    };
31.
    +};
32.
    +
33.
    +&uart0{
34.
    +   pinctrl-names = "default";
35.
    +   pinctrl-0 = <&uart0_pins>;    
36.
    +   status = "okay";
37.
    +};
38.
    +
39.
    +&uart0_pins{
40.
    +   brcm,pins;
41.
    +   brcm,function;
42.
    +   brcm,pull;
43.
    +};
44.
    +
45.
    +&uart1{
46.
    +   status = "disabled";
47.
    +};
48.
    +
49.
    +/ {
50.
    +    __overrides__ {
51.
    +        pcf8523 = <0>,"+7";
52.
    +        addr = <&pcf8523>, "reg:0";
53.
    +    };
54.
    +
55.
    +    aliases {
56.
    +        serial0 = "/soc/serial at 7e201000";
57.
    +        serial1 = "/soc/serial at 7e215040";
58.
    +    };
59.
    +};
60.
    \ No newline at end of file
61.
    --
62.
    2.17.1

I'm pretty sure the patch is working for i2c, because i2cdetect -y 1
produces the correct result with the patch and fails when I take it out.

The pi3-disable-bt patches are not working however. Using gpio
allreadall I was able to see that the GPIO pins are somehow being set to
ALT1 and ALT5, with the values respectively being HIGH and LOW as shown
below

 1.
    |--------|-----------|----------|
 2.
    | Pin | Mode | Value |
 3.
    |--------|-----------|----------|
 4.
    |---0---|-ALT1---|--HIGH-|
 5.
    |---1---|-ALT5---|--LOW-|
 6.
    |---2---|-ALT1---|--HIGH-|
 7.
    |---3---|-ALT5---|--Low-|
 8.
    |---4---|-ALT1---|--HIGH-|

This pattern continues throughout except for pin 19 which is set to IN
and pin 43 which is set to ALT2. On my working image  all of these pins
are set to IN, except pin 15 and 16 which are set to ALT0 (this is the
correct behavior).

I was able to change the modes of pin 15 and 16, (pins on the raspberry
pi which allow for UART serial communication) using gpio -g mode 15 ALT0
and gpio -g mode 16 ALT0. However, on my image that works correctly, pin
15 and 16 are both set to HIGH. On the image with u-boot, pin 16 is set
to LOW. I have tried to set it to high but it always changes back to
default, which I cannot figure out how to change...

Thanks for any help or ideas,

Karl



More information about the yocto mailing list