PinMuxing / UART2

524 views
Skip to first unread message

jstearns74

unread,
Apr 13, 2012, 7:57:10 PM4/13/12
to beagl...@googlegroups.com

Hello -

I have some real basic questions that hopefully someone can help me with.  I ultimately want to be able to use my BeagleBoard-XM (Rev C) to talk to a MCU using the UART2 port on the main expansion header.  I know to do this I will need to setup the PINMUX correctly.  I think I can get away setting the Mux through u-boot.

Please bare with me...  this is what I have spent today doing.

I have gone through the exercise of building the Angstrom Distribution using the setup-scripts (http://www.angstrom-distribution.org/building-angstrom) and executing:

$ MACHINE=beagleboard ./oebb.sh config beagleboard
$ MACHINE=beagleboard ./oebb.sh update
$ MACHINE=beagleboard ./oebb.sh bitbake virtual/kernel

From what I understand (which isn't much) is that this will give me the latest kernel.  After everything ran, I ended up with a directory where I believe the image is:
~/OE/setup-scripts/build/tmp-angstrom_2010_x-eglibc/deploy/images/beagleboard/

There are 2 files (modules-3.0.25-r118a-beagleboard.tgz & uImage-beagleboard.bin).  I am not exactly sure what to do with these files.  I was anticipating that I would end up with a MLO file, u-boot.bin, uImage, & a tarball that I would extract on the ext3 partition of the SD card.  Maybe I am not looking in the correct directories?  I see that the ./oebb.sh script uses bitbake.  Do these scripts create the u-boot.bin file?  If so, can I make my pinmux changes somewhere here?

OR -  do I need to download bitbake & the u-boot source code & modify the beagle.h file there? 

I am somewhat lost on trying to understand all of the documents/pages/group posts that I have found.  It looks like there are hard, older ways to do things, but new tools have since been created to automate some of the steps.  I'm just not sure what I need to do and what has already been done for me.

Thanks,

Jeremy

Maxim Podbereznyy

unread,
Apr 14, 2012, 3:32:56 AM4/14/12
to beagl...@googlegroups.com

bitbake u-boot

14.04.2012 3:57 пользователь "jstearns74" <jstea...@gmail.com> написал:
-- To join: http://beagleboard.org/discuss
To unsubscribe from this group, send email to:
beagleboard...@googlegroups.com
Frequently asked questions: http://beagleboard.org/faq

Don deJuan

unread,
Apr 14, 2012, 4:42:26 AM4/14/12
to beagl...@googlegroups.com
On 04/14/2012 12:32 AM, Maxim Podbereznyy wrote:
> bitbake u-boot
>
> 14.04.2012 3:57 О©╫О©╫О©╫О©╫О©╫О©╫О©╫О©╫О©╫О©╫О©╫О©╫ "jstearns74" <jstea...@gmail.com
> <mailto:jstea...@gmail.com>> О©╫О©╫О©╫О©╫О©╫О©╫О©╫:
> <mailto:beagleboard%2Bunsu...@googlegroups.com>

> Frequently asked questions: http://beagleboard.org/faq
>
> -- To join: http://beagleboard.org/discuss
> To unsubscribe from this group, send email to:
> beagleboard...@googlegroups.com
> Frequently asked questions: http://beagleboard.org/faq

all you built with the command you gave was the kernel so that is why
that is all you saw. As was mention for u-boot
bitbake u-boot
For an image an example would be
bitbake xfce-nm-image
or
bitbake systemd-gnome-image
poky and oe both have good resources

jstearns74

unread,
Apr 14, 2012, 10:53:01 AM4/14/12
to beagl...@googlegroups.com

Thank you guys for your help!  I may (will) have follow on questions later, but at least you got me pointed in the right direction.

- Jeremy

jstearns74

unread,
Apr 19, 2012, 11:51:59 PM4/19/12
to beagl...@googlegroups.com
Hey again,

Since last time, I was successfully able to get all the files I needed to get my beagleboard-xm Rev C to boot using the following commands:


$ MACHINE=beagleboard ./oebb.sh config beagleboard
$ MACHINE=beagleboard ./oebb.sh update
$ MACHINE=beagleboard ./oebb.sh bitbake virtual/kernel
 -> gave me uImage.bin
$ MACHINE=beagleboard ./oebb.sh bitbake u-boot
 -> gave me u-boot.img & MLO
$ MACHINE=beagleboard ./oebb.sh bitbake console-image
 -> produced the Angstrom tarball

So now I want to edit the beagle.h file to setup the pinmuxing (setup the uart2_RX line).  It looks like the UART2_TX line is already setup, as well as the CTS/RTS, though I don't plan on using flow control.  I went to edit this file:
(~/OE/setup-scripts/build/tmp-angstrom_2010_x-eglibc/work/beagleboard-angstrom-linux-gnueabi/u-boot-2011.12-r6/git/board/ti/beagle/beagle.h)

I went on the #beagle chat and asked if all I had to do was add the following line in the
#define MUX_BEAGLE_XM macro:
*
MUX_VAL(CP(MCBSP3_FSX),                (IEN  | PTD | DIS | M1)) /*UART2_RX*/\

I was told that the preferred method to do pinmuxing now was actually through the kernel (modify the following file):
./work/beagleboard-angstrom-linux-gnueabi/linux-3.0.28-r199a/git/arch/arm/mach-omap2/board-omap3beagle.c

Is that the case or does it matter?  From what I have read on elinux.org and other pages I get the impression that its actually much easier to do in u-boot.  

So If it doesn't matter, then back to my original question: do I just add the one line to the MUX_BEAGLE_XM macro?

And finally, how the heck can I prove this is working?  Based on some other uart2 questions I have read, they state that you can short pins 6 & 8 on the expansion header (uart2 TX/RX if you have them mux'd correctly) and issue the following:
$ echo a > /dev/ttyS1
then see if there are any changes in the file:
$ cat /proc/tty/driver/serial

Its easy to check the TX using a scope, but not so easy to verify the RX. 

Unfortunately I get an error in the echo command!?!  What do I need to do to ensure uart2 is setup besides the pinmuxing?

Thanks.

Jeremy

Igor Yeremin

unread,
Apr 20, 2012, 1:31:09 AM4/20/12
to beagl...@googlegroups.com
RX and TX pins on the expansion header are muxed as UART2 by default
right now, you can check that in /sys/kernel/debug/omap_mux:
# cat uart2_tx mcbsp3_fsx
name: uart2_tx.uart2_tx (0x48002178/0x148 = 0x0000), b aa25, t NA
mode: OMAP_PIN_OUTPUT | OMAP_MUX_MODE0
signals: uart2_tx | mcbsp3_clkx | gpt11_pwm_evt | NA | gpio_146 | NA |
NA | safe_mode
name: mcbsp3_fsx.uart2_rx (0x48002172/0x142 = 0x0101), b ae5, t NA
mode: OMAP_PIN_INPUT | OMAP_MUX_MODE1
signals: mcbsp3_fsx | uart2_rx | NA | NA | gpio_143 | hsusb3_tll_data7
| NA | safe_mode

This comes from these lines in beagle.h in u-boot:


MUX_VAL(CP(MCBSP3_FSX), (IEN | PTD | DIS | M1)) /*UART2_RX*/\

MUX_VAL(CP(UART2_TX), (IDIS | PTD | DIS | M0)) /*UART2_TX*/\
and then they are not re-muxed in kernel

The OMAP UARTs are /dev/ttyO*, not ttyS*
test using:
tail -f /dev/ttyS1 &
echo a > /dev/ttyS1

jstearns74

unread,
Apr 20, 2012, 12:53:57 PM4/20/12
to beagl...@googlegroups.com

Thank you Igor!  This is exactly the info I needed.  I really appreciate it.

Reply all
Reply to author
Forward
0 new messages