This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How do i develop UART program on Beaglebone black board installed ti-sdk-am335x-evm-07.00.00.00-Linux?

I am a beginner of Linux. I want develop UART program on BBB. The BBB is installed ti-sdk-am335x-evm-07.00.00.00-Linux and
CCS6.0.1.
I want to know what's the process of developing a UART Program sytem.       And what steps are in the developing process?
For example how do i enable the UART 1 or UART 2,  on  what steps do we need edit device tree files and modify pin configuration ?
ALthough some guides are in forum,  these are very unclear or based debian.
What should I do? Are there some examples?

Thank you!

   

  • Moving this to the Linux forum.

  • Hi,

    If you open arch/arm/boot/dts/am33xx.dtsi file you will see that all uarts are configured, you just need to enable the UART you need to use.
    Enabling is done either in am335x-bone-common.dtsi:

        ocp {
            uart0: serial@44e09000 {
                pinctrl-names = "default";
                pinctrl-0 = <&uart0_pins>;

                status = "okay";
            };

            musb: usb@47400000 {
                status = "okay";

                control@44e10000 {
                    status = "okay";
                };
               .....................
      Or you can do it in your specific dts file, i.e. in am335x-boneblack.dts, add:
        &uart1 {
                pinctrl-names = "default";
                pinctrl-0 = <&uart1_pins>;

                status = "okay";
         }
    And the omap serial driver should register your uart port in /dev/
    Pin muxing is done in the am33xx.dtsi file.

    Best Regards,
    Yordan

  • Hi,

    First you have to initialze pin mux, this you have to do in a xxx. dts file (in your case in a <>/ti-sdk-am335x-evm-07.00.00.00/board-support/linux-3.12.10-ti2013.12.01/arch/arm/boot/dts/am335x-bone-common.dtsi). In this file you will see which way this is make. In this file I see that UART0 is used only Rx, Tx and GND. If you want can initialize and CTS/RTS/... for handshake mode. Next fron TRM Chapter 19 Universal Asynchronous Receiver/Transmitter (UART) you have to see which clock, irq, wakeup are needed and set them in a <>/arch/arm/mach-omap2/omap_hwmod_33xx_data.c. Also you have to understand well <>/board-support/linux-3.12.10-ti2013.12.01/arch/arm/mach-omap2/serial.c. You can put many prints to see initialization in details.

    BR
    ivan
  • Dear Yordan Kovachev :
    Thank you very much your last guides for me!  Forgive me .i 'm a beginner of linux.
    I notice am335x-boneblack.dts inclding am33xx.dtsi and am335x-bone-common.dtsi.
    In your opinion all uarts are configured in am33xx.dtsi . If i want to use uart1,  i just need adding uart1_pins and enabling uart1 as following:


    uart0_pins: pinmux_uart0_pins {
        pinctrl-single,pins = <
        0x170 (PIN_INPUT_PULLUP | MUX_MODE0)    /* uart0_rxd.uart0_rxd */
        0x174 (PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* uart0_txd.uart0_txd */
                >;
            };
    uart1_pins: pinmux_uart1_pins {
        pinctrl-single,pins = <
        0x170 (PIN_INPUT_PULLUP | MUX_MODE0)    /* uart0_rxd.uart0_rxd */     In here 0x170 must be modifying to a right nummber
          0x174(PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* uart0_txd.uart0_txd */ In here  0x174 must be modifying to a right nummber
                >;
            };

    .....................
    .....................


        ocp {
            uart0: serial@44e09000 {
                pinctrl-names = "default";
                pinctrl-0 = <&uart0_pins>;

                status = "okay";
            };

                       uart1: serial@48022000 {
                pinctrl-names = "default";
                pinctrl-0 = <&uart1_pins>;

                status = "okay";
            };
    ........................................

    ...................................


    Am i right?


    In addition, after i finish modifying the .dts files.
    I will compile .dts files to dtbo files by dtc tools.
    The problem is what i should do in the next steps?
    I mean how i should use .dtbo files?
    You know the capemanager isn't supported in the ti-sdk-am335x-evm-07.00.00.00 .
    It doesn't like  in the  Angstrom.


        # cat /sys/devices/bone_capemgr.*/slots  

        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  

    Do i install a cape manager in the ti-sdk-am335x-evm-07.00.00.00 in any way? And after it I load the .dtbo files.
    What should i do?

     Thank you!

                 3xxx

  • Hi,

    1. Pins for UART1, are:

      uart1_pins_default: pinmux_uart1_pins_default {

                                                          pinctrl-single,pins = <

                                                                           0x178 (PIN_INPUT | MUX_MODE0) /* uart1_ctsn.uart1_ctsn */

                                                                           0x17C (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* uart1_rtsn.uart1_rtsn */

                                                                           0x180 (PIN_INPUT_PULLUP | MUX_MODE0) /* uart1_rxd.uart1_rxd */

                                                                           0x184 (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* uart1_txd.uart1_txd */

                                                            >;

    };

    uart1_pins_sleep: pinmux_uart1_pins_sleep {
                                                      pinctrl-single,pins = <
                                                                       0x178 (PIN_INPUT_PULLDOWN | MUX_MODE7)
                                                                       0x17C (PIN_INPUT_PULLDOWN | MUX_MODE7)
                                                                       0x180 (PIN_INPUT_PULLDOWN | MUX_MODE7)
                                                                       0x184 (PIN_INPUT_PULLDOWN | MUX_MODE7)
                                                       >;
    };

    Configured this way:

      UART1_CTSN is muxed on ball D18 (if AM335x is ZCZ pacakage) or ball E17 (if ZCE pakage)

      UART1_RTSN is muxed on ball D17 (if AM335x is ZCZ pacakage) or ball D19 (if ZCE pakage)

      UART1_RXD is muxed on ball D16 (if AM335x is ZCZ pacakage) or ball D18 (if ZCE pakage)

      UART1_TXD is muxed on ball D16 (if AM335x is ZCZ pacakage) or ball C19 (if ZCE pakage)

    See Table 4-1. Ball Characteristics (ZCE and ZCZ Packages) in AM335x Data Manual & AM335x TRM.

    After that you enable UART1:
        &uart1 {
                 pinctrl-names = "default", "sleep";
                 pinctrl-0 = <&uart1_pins_default>;
                 pinctrl-1 = <&uart1_pins_sleep>;
                 status = "okay";
         };

    2. After that (I see you use AM335x SDK7.0) the building should be as follows:

     x0155517@mms:~/ti-sdk-am335x-evm-07.00.00.00/board-support/linux-3.12.10-ti2013.12.01$ export ARCH=arm

     x0155517@mms:~/ti-sdk-am335x-evm-07.00.00.00/board-support/linux-3.12.10-ti2013.12.01$ export CROSS_COMPILE=arm-linux-gnueabihf-

      x0155517@mms:~/ti-sdk-am335x-evm-07.00.00.00/board-support/linux-3.12.10-ti2013.12.01$ export PATH=$PATH:/home/x0155517/ti-sdk-am335x-evm-07.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin

      x0155517@mms:~/ti-sdk-am335x-evm-07.00.00.00/board-support/linux-3.12.10-ti2013.12.01$ make distclean

      x0155517@mms:~/ti-sdk-am335x-evm-07.00.00.00/board-support/linux-3.12.10-ti2013.12.01$ make tisdk_am335x-evm_defcofnig

       x0155517@mms:~/ti-sdk-am335x-evm-07.00.00.00/board-support/linux-3.12.10-ti2013.12.01$ make -j4

    This will generate the correct device tree file am335x-boneblack.dtb, that will be used from linux kernel. This will also build the zImage


    Then copy am335x-boneblack.dtb & zImage to your sdcard (rootfs partition):
      x0155517@mms:~$ cd /media/rootfs/boot

      x0155517@mms:/media/rootfs/boot$ cp ~/Sitara/ti-sdk-am335x-evm-07.00.00.00/board-support/linux-3.12.10-ti2013.12.01/arch/arm/boot/dts/am335x-boneblack.dtb ./

      x0155517@mms:/media/rootfs/boot$ cp ~/Sitara/ti-sdk-am335x-evm-07.00.00.00/board-support/linux-3.12.10-ti2013.12.01/arch/arm/boot/zImage ./

    After this, when you boot your beaglebone black you will have UART1 enabled & you could use it for communication or writing user space applications for it.

    Hope this helps.

    Best Regards,
    Yordan