create new tag
, view all tags

BB-xM Multiplexer

Before we charge off ahead and start sending commands and driving the eBug in circles, I think it's important to break down exactly whats happening. A lot of the set-up that we did was to configure our BB-xM so we could accurately control all the expansion pins of the BB-xM. This gives us access to all the devices which exist on the various pins. But take a look at the table below, there seems to be several different devices on the one pin! So what's going on here?

All the various devices are connected to a device called a "multiplexer". Basically, this allows multiple devices to be connected to the same output pins and, depending on which mode the multiplexer is in, only one device will be connected to the output pin at any given time. So while several devices may be connected to an output pin, only one have control over the pin at any given point.

Expansion Pins and their connections with the xMega Chip

Ok, we can see from the table above us that we have lots of devices at our disposal, so where exactly do we need to write a signal too so that it gets where we need it too? Take a look at the image below, specifically at the expansion header for the BB-xM, (highlighted by the green line above it). This is where our connections orgiinate, don't pay too much attention to the names of the signals becuase, as we covered earlier, we can change those using our multiplexer. The connection flows through a "level shifter", which is highlighted by the red line above it. This device adjusts the output voltage level of the BB-xM, (1.8V), so that it matchs the one necessary for the xMega chip, (3.3V), and vice versa. Eventually our signals arrive at the expansion pins for the xMega board, indicated by the blue line to the right of it.


Now obviously, there are other connections beyond the ones we're looking at here, but for now let's focus on these. Our end game here is to use these pins to communicate between the xMega and the BB-xM, and we can do this using devices called Universal Asynchronous Reciever/Transmittors, or UARTs. UARTs have two pins, a TX and an RX. (Transmittors and Recievers; for more reading on UART's I found this link helpful: http://www.layadcircuits.com/layad_articles/UART_Basics.htm). If we want to send from our BB-xM to our xMega, we must put our data on the on the UART_TX of the BB-xM so that it's sent to the xMega UART_RX. (The diagram above is actually mislabeled, the devices on the BB-xM expansion header indicate that the device is MUXed to mode 0. This means that pin 6 should actually be UART2_TX).

So it's on pin 6 that we should focus our attention on for sending signals to the xMEGA chip.

Controlling the Multiplexer

Ok, so now we've set up our BB-xM and all our stuff has been installed, which is great because now we have a GUI with all the drivers that we need, it will automatically log-in and will fix the reset pin on the eBug so that it does not "hang". . Furthermore, we understand what we're trying to do and why we're doing it. Now we can start controlling to the eBug itself with our BB-xM.

  1. Load up the command terminal and run the following commands to gain root access
    sudo su
  2. Change the directory to our BB-xM's multiplexer and check that all our devices are there by running the following commands
    =cd /sys/kernel/debug/omap_mux
  3. In order to control the multiplexer, we use the echo command. So if we want to change the mode to mode 2 for pin 6, we pick the device it uses by default, (you don't have to use this as all the devices which share pins are linked, but its better to do it this way just so you can keep track of things), and we use the echo command to write the number of the mode we want to switch it to.
    echo 2 > uart2_tx
Now obviously, we just changed pin 6 from the UART_TX that we wanted it to be, so change it back to mode 0 by running the same command again, except replacing the 2 with a 0
echo 2 > uart2_tx


Changing the pins can be quite tedious, especially with the changing directories and using root access constantly, so if you need to do a lot of multiplexing on a single pin I found it helpful to write some code to speed up the process. The following piece of code can function as skeleton code, (written in C), which can be easily modified to fit any of the pins on the BB-xM.

// Code by Alastair Young
// ADYOU1 19874650
// 10/1/2013

/*********************************Header List*************************************/
#include <stdio.h>      //Normal header stuff
//End of Header list

   int muxy;
   printf("Which mode are we MUXing pin 6 too? (0-7)\n");      
   printf("0:UART_TX\n1:McBSP3\n2:GPT11PWMEVT\n4:X\n5:GPIO_146\n6:x\n7:x\n");  //Update this for the devices on pin MUX
   puts("Please enter a number:");
   scanf("%d", &muxy);
//      system("echo 'echo'");
      printf("We're using MUX mode %d \n", muxy);
      system("echo %d > /sys/kernel/debug/omap_mux/uart2_tx");   //Update this to fit the device in MUX Mode 0
      printf("Sanity check to see if it worked\n");
      system("more /sys/kernel/debug/omap_mux/uart2_tx");      //Update to match default device
      return 0;
      system("echo 'Number outside range'");

-- AlYoung - 2013-01-11

Topic attachments
I Attachment Action Size Date Who Comment
PNGpng 14-bb-xm-multiplecer-table.png manage 115.0 K 2013-01-11 - 02:43 AlYoung BB-xM Expansion Pins
PNGpng 14-xx-xm-to-xmega-pins.png manage 144.1 K 2013-01-11 - 03:20 AlYoung BB-xM to Xmega connections
PDFpdf Expansion_Board_BB-xM__Kinect.pdf manage 575.1 K 2013-01-11 - 03:23 AlYoung Connection Schematic
Topic revision: r1 - 2013-01-11 - AlYoung
This site is powered by the TWiki collaboration platformCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback