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.

serial port beaglebone gingerbread

Hi everyone,

I have a Beaglebone with Android Gingerbread from rowboat (kernel version 3.1) and I need to use the serial port. As I can read in some forums, since kernel version 2.6.37, serial port name change ttySx to ttyOx (with "O", not zero).

When I stay in shell, I can see a lot of serial ports:

crw-------   root           root     252,   0 2000-01-01 00:00 ttyGS0
crw-------   root           root     252,   1 2000-01-01 00:00 ttyGS1
crw-------   root           root     252,   2 2000-01-01 00:00 ttyGS2
crw-------   root           root     252,   3 2000-01-01 00:00 ttyGS3
crw-------   root           root     253,   0 2000-01-01 00:00 ttyO0
crw-rw---- bluetooth bluetooth 253,   1 2000-01-01 00:00 ttyO1
crw-------   root           root     253,   2 2000-01-01 00:00 ttyO2
crw-------   root           root     253,   3 2000-01-01 00:00 ttyO3
crw-------   root           root     253,   4 2000-01-01 00:00 ttyO4
crw-------   root           root     253,   5 2000-01-01 00:00 ttyO5
crw-------   root           root         4,  64 2000-01-01 00:00 ttyS0
crw-------   root           root         4,  65 2000-01-01 00:00 ttyS1
crw-------   root           root         4,  66 2000-01-01 00:00 ttyS2
crw-------   root           root         4,  67 2000-01-01 00:00 ttyS3

When I try to use one of its (ttyO0, ttyO1, ttyS1...) with echo command, it doesn't send anything (with and without permission) and I don't know what I can do to solve it...

I try to change the configuration kernel and u-boot, but I don't see nothing to change this situation. Anyone knows how I solve this situation for using serial port?

Any suggestion are appreciate. Regards,

  • Hi all,

    I solve my problem with serial port. I haven't mounted the debugfs filesystem. I do it manually by:

    $  mount -t debugfs none /sys/kernel/debug 

    After it, I put in the shell to use uart 1:

    $  echo 20 > /sys/kernel/debug/omap_mux/uart1_rxd
    $ echo 0 > /sys/kernel/debug/omap_mux/uart1_txd

    To try it, I use echo command and it works fine:

    $  echo "AAAAAAAA" > /dev/ttyO1

    For more information, you can follow these links:

    And now, I will add it in the boot system...

    Regards,

  • Hi everyone,

    I write what I have done to have available uart1 and uart2 to be use when I start Android. In init.rc file, I have added:

    mount debugfs debugfs /sys/kernel/debug

    and also I have commented the following lines because I don't need the bluetooth and I need ttyO1 as a simple serial port:

    #Owners, Modes for Bluetooth
    # console changed to ttyO* from ttyS* since 2.6.38 kernel.
    #   chmod 0660 /dev/ttyO1
    #   chown bluetooth bluetooth /dev/ttyO1
    #   chmod 0660 sys/class/rfkill/rfkill0/state
    #   chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state
    #   write /sys/class/rfkill/rfkill0/state 0

    After that, I have changed uart permissions in ueventd.rc file:

    /dev/ttyO1    0777 root     root
    /dev/ttyO2    0777 root     root

    In kernel files, I have added and changed some code. In mux33xx.c file, I have defined mode 1 in the SPI0_SCLK and SPI0_D0:

    ORIGINAL
        _AM33XX_MUXENTRY(SPI0_SCLK, 0,
                  "spi0_sclk", NULL, NULL, NULL,
                   NULL, NULL, NULL, "gpio0_2"),
       _AM33XX_MUXENTRY(SPI0_D0, 0,
                  "spi0_d0", NULL, NULL, NULL,
                   NULL, NULL, NULL, "gpio0_3"),

    MODIFICATION
       _AM33XX_MUXENTRY(SPI0_SCLK, 0,
                  "spi0_sclk", "uart2_rxd", NULL, NULL,
                  NULL, NULL, NULL, "gpio0_2"),
       _AM33XX_MUXENTRY(SPI0_D0, 0,
                  "spi0_d0", "uart2_txd", NULL, NULL,
                  NULL, NULL, NULL, "gpio0_3"),

    And in board-am335xevm.c I have added it:

    static struct pinmux_config uart1_pin_mux[] = {
         {"uart1_rxd.uart1_rxd", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT},
         {"uart1_txd.uart1_txd", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
         {NULL, 0},
    };

    static struct pinmux_config uart2_pin_mux[] = {
        {"spi0_sclk.uart2_rxd", OMAP_MUX_MODE1 | AM33XX_PIN_INPUT},
        {"spi0_d0.uart2_txd", OMAP_MUX_MODE1 | AM33XX_PIN_OUTPUT},
        {NULL, 0},
    };

    static void uart1_init(void)
    {
        setup_pin_mux(uart1_pin_mux);
        return;
    }

    static void uart2_init(void)
    {
        setup_pin_mux(uart2_pin_mux);
        return;
    }

    static void __init am335x_evm_init(void)
    {
        am33xx_mux_init(board_mux);
        omap_serial_init();
        uart1_init();
        uart2_init();
        am335x_rtc_init();
        clkout2_enable();
        am335x_evm_i2c_init();
        omap_sdrc_init(NULL, NULL);
        usb_musb_init(&musb_board_data);
        omap_board_config = am335x_evm_config;
        omap_board_config_size = ARRAY_SIZE(am335x_evm_config);
    #ifdef CONFIG_AM335XEVM_BT_RFKILL
        bt_pwr_init();
    #endif
    }

    Finally, I have created kernel image (uImage) and I have changed it instead of the original image. And... that's all :)