1 2 3 Previous 142 Replies Latest reply on Oct 9, 2017 6:52 AM by plawren1

    [How-to] BB-View on latest Debian


      I thought some others might like to know how to get the BB-View working under the latest Debian beta images.


      Unfortunately, you are going to have to recompile the Kernel. The video works fine without a recompile (the red/blue swap is easy to fix), but the touchscreen control connections are not the same as the standard TI 4-wire interface. I tried to patch the ti_am335x_tsc.c file, so the changes would be limited to a dts recompile, but I haven't been able to get that working yet (I'm pretty sure it is a state machine / bit assignment issue). But anyway, here are the steps that you need to perform.....



      1) Download the necessary files

           a) Robert Nelson's handy tools for compiling the Beaglebone kernel

           b) BB-View source for Angstrom

      2) Build the default kernel

      3) Patch the Kernel and perform a fast recompile

      4) Copy the new kernel to the Beaglebone

      5) Edit the xorg.conf file to correct the Red/Blue color swap

      6) Revel in the 4 days you just saved


      Let's Get Started

      I am using Ubuntu 12.04 LTS 64 bit running in a VirtualBox VM to compile the kernel:

      Make a new folder called bb-view, this is where our build will happen.

      > mkdir bb-view

      > cd bb-view


      Install git, if you haven't already:

      > apt-get install git


      Clone Robert Nelson's linux-dev project locally. Be prepared for a large download (~100 Mb for the cross-compiler and ~700 Mb for the kernel source).

      > git clone https://github.com/RobertCNelson/linux-dev.git


      Change into the new linux-dev folder and select branch/tag that matches the Debian version.

      > cd linux-dev

      > git checkout 3.8.13-bone37 -b tmp


      Now we need to build the base image, so our cape drivers folder gets populated. The script will tell you if you need to do or install anything else.

      > ./build_kernel.sh


      Come back in an hour or so.....(You might want to download the Angstrom source from element14 now)


      Patching the Kernel

      Extract two files from the Angstrom source:

      > unzip angstrom-source.zip

      > tar -zxf bb-black-kernel-3.8.13-bb-view.tar.bz2

      > cp ./kernel/kernel/drivers/input/touchscreen/ti_am335x_tsc.c  ~/bb-view/linux-dev/KERNEL/drivers/input/touchscreen/

      > cp ./kernel/kernel/firmware/capes/BB-VIEW-LCD7-01-00A0.dts  ~/bb-view/linux-dev/KERNEL/firmware/capes/


      Now we need to let the compiler know that we want to add the firmware to the build:

      > nano   ~/bb-view/linux-dev/KERNEL/firmware/Makefile


      Add the following line somewhere near line 192 (CTRL-C will display current cursor position):

      BB-VIEW-LCD7-01-00A0.dtbo \


      Don't forget the trailing backslash....it is important. Now save and exit by doing CTRL-O, Enter, CTRL-X.

      Change back to the linux-dev root folder:

      > cd   ~/bb-view/linux-dev


      Now issue the kernel rebuild command, this won't take very long at all:

      > ./tools/rebuild.sh



      Copy Kernel to BBB

      The following instructions assume that you already have the Debian beta installed and booted up on the BBB.

      The easiest way is to copy the files over the network, via the 'scp' command:

      > scp   ~/bb-view/linux-dev/deploy/3.8.13-bone37.zImage   debian@

      Replace debian (both instances) with the username you are running on the BBB and with the IP address of the BBB.


      Now log into the BBB and copy the kernel image to the boot partition:

      > ssh debian@

      bbb>  sudo cp 3.8.13-bone37.zImage   /boot/uboot/zImage


      We need to do one more thing before the LCD will work. Since the cape doesn't have an EEPROM, we need to black-list the HDMI drivers and force-load the BB-VIEW drivers in the boot command file:

      bbb>  sudo  nano  /boot/uboot/uEnv.txt


      Find the "optargs" line and edit it to be:

      optargs=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN  capemgr.enable_partno=BB-VIEW-LCD7-01

      Notice that the preceding "#" has been removed. You don't want to disable BB-BONE-EMMC-2G, or you won't be able to boot from eMMC.

      Now save and exit by doing CTRL-O, Enter, CTRL-X.


      Reboot the BBB and the LCD should now work....except the blue and red are reversed.


      Fixing Red/Blue Color Swap

      This is due to errata in the TI AM335x processor when switching between 16 and 24 bit video modes. To fix this, we must first find the name of our screen:

      > ssh debian@

      bbb> cat  /var/log/Xorg.0.log  |  grep  screen

      Mine was "Builtin Default fbdev Screen 0"


      Now we edit our X configuration file:

      bbb> sudo nano  /usr/share/X11/xorg.conf.d/10-evdev.conf


      and add a "Screen" section at the end of the file:

      Section "Screen"

              Identifier "Builtin Default fbdev Screen 0"

              Monitor "Configured Monitor"

              Device "Configured Video Device"

              DefaultDepth 24


      Save and exit by doing CTRL-O, Enter, CTRL-X.

      Reboot and enjoy!

        • 1. Re: [How-to] BB-View on latest Debian

          Perfect timing, I was just about to start looking for what pieces I need to extract in order to get the 4.3" BB-View working on a vanilla 3.13 kernel. Looks like you've identified the interesting pieces for me


          When you say the touch screen is different from the standard TI 4 wire interface, how did you work that out ?  Did you find schematics for the BB-View anywhere ?

          • 2. Re: [How-to] BB-View on latest Debian

            From the Angstrom source download, a diff between BB-BONE-LCD4-01-00A1.dts & BB-VIEW-LCD4-01-00A0.dts is interesting, there's a couple of differences in the pins used for LEDs & keys along with differences in numbers of leds & keys.

            Other than that, there's one extra pin used for "LCD DISEN" in BB-BONE-LCD4-01-00A1.dts and for the BB-VIEW there's this


            ti,touch-type = <1>;

            in the LCD7 ones the BB-VIEW has that as 2


            Not exactly sure what that does just yet, but it's obviously some hint to the driver to configure something a certain way. Otherwise the driver and pins used appear to be identical.  Perhaps it's a place to start looking for the problem though.

            • 3. Re: [How-to] BB-View on latest Debian

              If you do a diff between the ti_am335x_tsc.c files, you will see the changes. It appears to use bits 9 and 10 (STEPCONFIG_XNP and YPN) for sequencing, instead of the usual bits 7 and 8.


              Modifications to Debian original ti_am335x_tsc.c:

              I added the two new bit definitions to the config_pins array assignment on line 38. I then changed line 98 from switch(wi_order) to switch(i), so that it would assume XP, XN, YP, and YN from array position in the dts file. The fun part is trying to figure out which combination of dts "ti,wire-config" values and changes to lines 180 and 187 will result in a working touchscreen.


              I think I focused too much on just the changed lines and not the relationship between the lines that didn't change, especially between lines 178 to 198. I will look into that today.



              • 4. Re: [How-to] BB-View on latest Debian

                Well, the recompile seems unavoidable due to the way the charge bits are used. I have made changes to the stock touchscreen drivers, to add a hook for the BB-View, but also to keep compatibility with other displays. I will see if I can get someone to include them in the next kernel patch.


                For some reason, the xinput_calibrator is not working properly with the values being returned by the tsc. Manually modify your /etc/pointercal.xinput file, on the bbb, to the following, to get it close:

                xinput set-int-prop "ti-tsc" "Evdev Axis Calibration" 32 3953 130 366 3832; xinput set-int-prop "ti-tsc" "Evdev Axes Swap" 8 1;


                If you want to test out the kernel modules on your own, here are the diffs:


                diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c

                index ed83043..69bc5d9 100644

                --- a/drivers/input/touchscreen/ti_am335x_tsc.c

                +++ b/drivers/input/touchscreen/ti_am335x_tsc.c

                @@ -50,6 +50,7 @@ struct titsc {

                  unsigned int x_plate_resistance;

                  bool pen_down;

                  int coordinate_readouts;

                + int charge_mode;

                  u32 config_inp[4];

                  u32 bit_xp, bit_xn, bit_yp, bit_yn;

                  u32 inp_xp, inp_xn, inp_yp, inp_yn;

                @@ -176,16 +177,23 @@ static void titsc_step_config(struct titsc *ts_dev)

                  /* Charge step configuration */

                  config = ts_dev->bit_xp | ts_dev->bit_yn |


                - STEPCHARGE_INM_AN1 | STEPCHARGE_INP(ts_dev->inp_yp);

                + STEPCHARGE_INM_AN1;


                + if (ts_dev->charge_mode == 1)

                + config |= STEPCHARGE_INP(ts_dev->inp_xn);

                + else

                + config |= STEPCHARGE_INP(ts_dev->inp_yp);


                  titsc_writel(ts_dev, REG_CHARGECONFIG, config);

                  titsc_writel(ts_dev, REG_CHARGEDELAY, CHARGEDLY_OPENDLY);


                  /* coordinate_readouts * 2 … coordinate_readouts * 2 + 2 is for Z */

                - config = STEPCONFIG_MODE_HWSYNC |

                - STEPCONFIG_AVG_16 | ts_dev->bit_yp |

                - ts_dev->bit_xn | STEPCONFIG_INM_ADCREFM |

                - STEPCONFIG_INP(ts_dev->inp_xp);

                + config = STEPCONFIG_MODE_HWSYNC | STEPCONFIG_AVG_16 |

                + STEPCONFIG_INM_ADCREFM | STEPCONFIG_INP(ts_dev->inp_xp);

                + if (ts_dev->charge_mode == 1)

                + config |= STEPCONFIG_YPN | STEPCONFIG_XNP;

                + else

                + config |= ts_dev->bit_yp | ts_dev->bit_xn;

                  titsc_writel(ts_dev, REG_STEPCONFIG(end_step), config);

                  titsc_writel(ts_dev, REG_STEPDELAY(end_step),


                @@ -372,6 +380,11 @@ static int titsc_parse_dt(struct ti_tscadc_dev *tscadc_dev,

                  if (err < 0)

                  return err;


                + err = of_property_read_u32(node, "ti,charge-mode",

                + &ts_dev->charge_mode);

                + if (err < 0)

                + ts_dev->charge_mode = 0;


                  return of_property_read_u32_array(node, "ti,wire-config",

                  ts_dev->config_inp, ARRAY_SIZE(ts_dev->config_inp));


                @@ -389,6 +402,7 @@ static int titsc_parse_pdata(struct ti_tscadc_dev *tscadc_dev,


                  ts_dev->coordinate_readouts =


                + ts_dev->charge_mode = pdata->tsc_init->charge_mode;

                  memcpy(ts_dev->config_inp, pdata->tsc_init->wire_config,


                  return 0;

                diff --git a/firmware/Makefile b/firmware/Makefile

                index e45d10b..f18b95a 100644

                --- a/firmware/Makefile

                +++ b/firmware/Makefile

                @@ -189,6 +189,7 @@ fw-shipped-$(CONFIG_CAPE_BEAGLEBONE) += \

                  BB-BONE-RST-00A0.dtbo \

                  BB-BONE-RST2-00A0.dtbo \

                  BB-BONE-CAM3-01-00A2.dtbo \

                + BB-VIEW-LCD7-01-00A0.dtbo \

                  BB-BONE-CAM-VVDN-00A0.dtbo \

                  TT3201-001-01.dtbo \

                  BB-BONE-SERL-03-00A1.dtbo \

                diff --git a/include/linux/input/ti_am335x_tsc.h b/include/linux/input/ti_am335x_tsc.h

                index c0bf08b..278125a 100644

                --- a/include/linux/input/ti_am335x_tsc.h

                +++ b/include/linux/input/ti_am335x_tsc.h

                @@ -30,6 +30,7 @@ struct tsc_data {

                  int x_plate_resistance;

                  int coordinate_readouts;

                  int wire_config[10];

                + int charge_mode;




                diff --git a/firmware/capes/BB-VIEW-LCD7-01-00A0.dts b/firmware/capes/BB-VIEW-LCD7-01-00A0.dts

                index f506a15..9370327 100755

                --- a/firmware/capes/BB-VIEW-LCD7-01-00A0.dts

                +++ b/firmware/capes/BB-VIEW-LCD7-01-00A0.dts

                @@ -158,7 +158,7 @@

                  ti,wires = <4>;

                  ti,x-plate-resistance = <200>;

                  ti,coordinate-readouts = <5>;

                - ti,touch-type = <2>;

                + ti,charge-mode = <1>;

                  ti,wire-config = <0x00 0x11 0x22 0x33>;


                • 5. Re: [How-to] BB-View on latest Debian

                  Haven't got as far as looking at the touch screen parts yet...


                  Question for you though.. if you set the brightness to something like 50 do you get an audible high pitched whine from the display ?  I have an LCD4, just wondering if your LCD7 does the same..

                  • 6. Re: [How-to] BB-View on latest Debian

                    Yes, I have heard it with the CircuitCo 7 inch screens, and a quick test with the BB-View 7 proves it does it too.

                    • 7. Re: [How-to] BB-View on latest Debian

                      I modified the BB-View dts file, line 141, to read:

                      pwms = <&ehrpwm1 0 32768 0>;

                      and the noise is gone.....

                      • 8. Re: [How-to] BB-View on latest Debian

                        After what seems like way too long fighting with devicetree... It's alive !


                        ts_calibrate is of course giving me a pile of crap, so your patches to the touchscreen driver are next on the list.


                        I should also say here that I'm not using the beaglebone kernels, I'm using mainline.. Gave up with the mess that's going into the beagle kernels a while ago.

                        The TI folks doing the mainline devicetree development for am3359 (and omap in general) and the beagleboard folks are heading off in two totally different directions, the differences are significant at this point.

                        • 9. Re: [How-to] BB-View on latest Debian

                          Very good. Just curious if you boot up in the proper color mode, or if you wait until X starts up like I do?

                          • 10. Re: [How-to] BB-View on latest Debian

                            I don't have X installed, the tux logo has correct colours and that's just a jpg displayed with http://repo.or.cz/w/fbv.git

                            I'd like to say I did something interesting to make it so, but I've not knowingly done so.


                            The dt definition fro the panel is this:

                            /* Embest 4.3 inch LCD cape: */

                            panel {

                                    compatible = "ti,tilcdc,panel";

                                    pinctrl-names = "default";

                                    pinctrl-0 = <&bb_view_lcd_cape_pins>;



                                    panel-info {

                                            ac-bias         = <255>;

                                            ac-bias-intrpt  = <0>; 

                                            dma-burst-sz    = <16>;

                                            bpp             = <32>;

                                            fdd             = <0x80>;

                                            tft-alt-mode    = <0>;  

                                            stn-565-mode    = <0>;  

                                            mono-8bit-mode  = <0>;  

                                            sync-edge       = <0>;  

                                            sync-ctrl       = <1>;  

                                            raster-order    = <0>;  

                                            fifo-th         = <0>;  



                                    display-timings {

                                            native-mode = <&timing0>;

                                            timing0: 480x272 {

                                                    hactive         = <480>;

                                                    vactive         = <272>;

                                                    hback-porch     = <44>;

                                                    hfront-porch    = <9>; 

                                                    hsync-len       = <5>; 

                                                    vback-porch     = <13>;

                                                    vfront-porch    = <4>; 

                                                    vsync-len       = <10>;

                                                    clock-frequency = <9000000>;

                                                    hsync-active    = <0>;

                                                    vsync-active    = <0>;





                            don't think I changed anything in that part from what was in the angstrom definition.

                            • 11. Re: [How-to] BB-View on latest Debian

                              Louis McCarthy wrote:



                              If you want to test out the kernel modules on your own, here are the diffs:

                              It strikes me that your patch is closely related to this one:



                              I've not dug into the details too deeply yet, but I'm wondering if it's possible to use the

                                              ti,wire-config = <0x00 0x11 0x22 0x33>;

                              line in the dts to achieve the same result?


                              The bindings doc defines this as

                                      ti,wire-config: Different boards could have a different order for
                                                      connecting wires on touchscreen. We need to provide an
                                                      8 bit number where in the 1st four bits represent the
                                                      analog lines and the next 4 bits represent positive/
                                                      negative terminal on that input line. Notations to
                                                      represent the input lines and terminals resoectively
                                                      is as follows:
                                                      AIN0 = 0, AIN1 = 1 and so on till AIN7 = 7.
                                                      XP  = 0, XN = 1, YP = 2, YN = 3.


                              So if I'm reading your patch correctly, you're introducing ti,charge_mode and using that to swap xn & yp while leaving the wire-config line as defaults ?   Shouldn't it be possible to change the wire-config instead ?  Or am I totally missing the point ?

                              • 12. Re: [How-to] BB-View on latest Debian

                                I thought so too, but I tried several permutations over two days, and still could not get it to work. But, at the time, I did not realize that there was a bug in xinput_calibrator, so that may have been some of the problems that I was seeing.

                                • 13. Re: [How-to] BB-View on latest Debian

                                  I think my initial guess was using 00, 25, 14, 33 for the wires config. With the 4 and 5 being STEPCONFIG_XNP and STEPCONFIG_YPN added to the config_pins array at the beginning of ti_am335x_tsc.c


                                  I may have to test it again, now that I know about xinput_calibrator having trouble with inverted axis

                                  • 14. Re: [How-to] BB-View on latest Debian

                                    hmm.. bugs are never a good thing, especially when you're trying to work out why something isn't working


                                    I don't understand the code well enough yet and my current results are only showing up/down touch moving the point left/right and no reaction to left/right touch from what I can tell.

                                    So I'm going to try your patch exactly as-is and see what happens.

                                    1 2 3 Previous