Project

General

Profile

L138F UART2 in Linux

Added by Mike Costa over 12 years ago

Hi,

it looks like UART2 is enabled in the default linux kernel. When i do

dmesg | grep tty

3 uarts are shown to be setup.

Is there anything additional I need to do to use UART2? I tried writing a C++ app that writes some bytes to the port but I don't see anything on the Tx pin of my profi development board on J504. I know that UART2 is shared with I2C1, do I need to change the pin settings?

Thanks,
Mike


Replies (13)

RE: L138F UART2 in Linux - Added by Michael Williamson over 12 years ago

Hi Mike,

In the kernel in the arch/arm/mach-davinci area, you will find a bunch of calls for setting up the multiplex options for the various pins on the device. In this case, the board-mityomapl138.c and the baseboard-industrialio.c will have the pin multiplexer settings for this configuration. I'm not sure, off hand, how the pins for the UART2 and the I2C1 bus are configured. My guess is that you do need to change the settings or add them in to accomplish this.

-Mike

RE: L138F UART2 in Linux - Added by Mike Costa over 12 years ago

Hi Mike,

I see an option in board-mityomapl138.c to enable UART2 and will give that a shot.

It seems that there are setup files that are basic to the OMAP but there is an additional layer that CriticalLink brings into the picture. This all looks pretty complex, is there a resource or doc that explains these files & how they work in the CriticalLink framework?

thanks
Mike

RE: L138F UART2 in Linux - Added by Mike Costa over 12 years ago

Hi Mike,

I tried changing the enable field for UART2 in board-mityomapl138.c but I don't think there is any effect.

  .UARTConfig[2] = {
  .Enable = 1,
  .IsConsole = 0,
  .Baud = 115200

During boot the UART printout still says
UART2 = 0,0,0,115200

Which Seems like my enable bit is not getting compiled in. I changed the MACHINE_START string and that change did get compiled in, so I know the file was re-compiled into the new kernel.
MACHINE_START(MITYOMAPL138, "MityDSP-L138-MikesHack")

I noticed that the baseboard-indistrialio.c file is not compiled because I dont see a .o file, so I never bothered changing anything in there.
Any ideas?

Thanks,
Mike

RE: L138F UART2 in Linux - Added by Michael Williamson over 12 years ago

Hi Mike,

You don't want to change the name of the MACHINE_START macro name. Put it back, otherwise the unit will not use any of the initialization code (if you google that MACHINE_START macro, you'll see why).

The UART config stuff in the config area is not used (the kernel guys are actively removing the ATAG structures passed in from u-Boot in favor of device trees, which we'll eventually move to when the code stabilizes. If you have no idea what that stuff is, I'd suggest not worrying about it).

By default, all three of the on-chip UART devices are instantiated in the kernel. However, in addition to the device instantiation, you also have to ensure that the pins related to the outputs are configured to use the function you need (the infamous "pin-mux" settings). In our kernel master (at revision 2.6.33), you want to look for calls to "da8xx_pinmux_setup()" in the board-mityomapl138.c and in the baseboard-industrialio.c. I suspect that one of these calls is missing to setup the UART2 and that the pinmux register associated with the TxD output is not configured correctly. If you look at baseboard-hrsc.c, you'll see that the UART2 lines are called out in the baseboard_pins[] array in order to turn the UART on properly.

This function call accepts a list of pin enumerations (see arch/arm/mach-davinci/include/mach/mux.h) terminated by a -1 to configure the pix multiplexers for a given output. This call basically alters PIXMUX0 through PINMUX19 registers (see 11.5.10 of the Technical Resource Manual).

Hope this helps.

-Mike

RE: L138F UART2 in Linux - Added by Mike Costa over 12 years ago

Hi Mike,

I looked into baseboard-hrsc.c and DA850_UART2_TXD is listed in the array. wouldn't this mean the pin-mux for those pins are configured for the UART2?
Also if I don't see .o files are these .c files being compiled? Do I need to flip a flag in the configuration?

RE: L138F UART2 in Linux - Added by Mike Costa over 12 years ago

I found these lines in da850.c

according to this line the default value for those pins is 2, which means they are set to the I2C peripheral
MUX_CFG(DA850, UART2_RXD, 4, 16, 15, 2, false)
MUX_CFG(DA850, UART2_TXD, 4, 20, 15, 2, false)

Should I set the mux mode values to 4 here?
MUX_CFG(DA850, UART2_RXD, 4, 16, 15, 4, false)
MUX_CFG(DA850, UART2_TXD, 4, 20, 15, 4, false)

Is this the appropriate place to change the mux mode values?

Thanks,
Mike

RE: L138F UART2 in Linux - Added by Michael Williamson over 12 years ago

Hmmm...

Those aren't "default values", those are the values that the register will be programmed to if you add DA850_UART2_RXD to a call to da8xx_pinmux_setup() list.

I am looking at section 11.5.10 of the OMAP-L138 Technical Resource Manual and Table 11-26 (PINMUX4 register) shows UART2 functions are value 2, and I2C1 is value 4 (the opposite of what you are saying above).

Those MUX_CFG macros should never be changed -- assuming they are correct. They should map to the physical pinmux settings in the TRM.

What you need to do is ensure that the DA850_UART2_{RXD,TXD} enumerations are called out in list provided to da8xx_pinmux_setup(), and that DA850_I2C1_SCL and DA850_I2C1_SDA are not called out after this call.

-Mike

RE: L138F UART2 in Linux - Added by Mike Costa over 12 years ago

Darn, I confused myself in hopes that I found a solution!

so how do I know which baseboard-xxx.c file is being compiled in? some files call out the I2C some call out the UART. But none have an output .o file after I build the kernel. Maybe those pins are not even being set? there is no call (that I can see) to baseboard_pins[] in board-mityomapl138.c.

Thanks,
Mike

RE: L138F UART2 in Linux - Added by Dominic Giambo over 12 years ago

Mike,

If you build menuconfig (make menuconfig) and navigate -> System Type -> TI DaVinci Implementations -> Select Baseboard you will see a list of baseboards. These options set a variable in your kernel .config that causes the build to compile the appropriate file. (ie. CONFIG_BASEBOARD_INDUSTRIALIO=y). If you want to create a custom baseboard you will need to modify kconfig to set up this process. If your modifying an existing baseboard just select that one.

- Dominic

RE: L138F UART2 in Linux - Added by Mike Costa over 12 years ago

ah that solves the mystery of no output .o files. I finally got the UART2 working using the baseboard-industrialio.c file. i added these lines of code (in case anyone else needs them)


static short baseboard_UART2_pins[] __initdata = {
    DA850_UART2_TXD,  
    DA850_UART2_RXD,  
    -1,
};

static int __init baseboard_init(void)
{
    pr_info("*** MIKE modified baseboard-industrialio.c ****");
    pr_info("%s [%s]...\n", __func__, BASEBOARD_NAME);
    da8xx_pinmux_setup(baseboard_gpio_pins);
    da8xx_pinmux_setup(baseboard_UART2_pins);/* Mikes hack to try and get UART2 running*/
    baseboard_setup_lcd();
    baseboard_setup_mmc();
    baseboard_setup_spi();
    baseboard_setup_mcasp();
    return 0;
}

RE: L138F UART2 in Linux - Added by Mike Costa over 12 years ago

Dominic & Mike,
Thanks for all your help BTW.

Where can I configure the baud rates if the TAG structures are not used anymore?

RE: L138F UART2 in Linux - Added by Mike Costa over 12 years ago

Sorry scratch that last question.. I will do it in my C++ app settings.

RE: L138F UART2 in Linux - Added by Gregory Gluszek over 12 years ago

Just as an FYI (to possibly save you time in the future) linux-davinci/arch/arm/mach-davinci/da850.c has a number of pin groupings already defined.

So you could have enabled UART2 by just adding the following line to baseboard_init():

da8xx_pinmux_setup(da850_uart2_pins);

\Greg

    (1-13/13)
    Go to top
    Add picture from clipboard (Maximum size: 1 GB)