create new tag
, view all tags

Step 11 - Fixing the Reset on the xMega

Now this step is necessary to solve a problem which is an unfortunate byproduct of the setup that we have. If one looks at the schematic below, (Expansion Board (BB-xM & Kinect).pdf), looking specifically at Pin 21 of the Expansion Header of the BB-xM, (the signal will be called MMC2_CLK0), you can see that after going through the level translator, the signal eventually ends up at the reset pin of the xMega chip, (Pin 16, called RST_XMEGA). Now this causes us some issues because that reset pin is designed to be attatched to a switch, and therefore triggers when a low signal is read on the pin, and our default Pin setting on the BB-xM is a low signal. This means that when we boot our BB-xM, it is constantly sending the reset signal to the xMega chip, causeing it to freeze and rendering all its operations inactive. In order to fix this, we need to a script in the boot process of linux so that after the kernel is loaded, (this is where MMC2_CLK0 is set to low), the pin is then set to high.

  1. Give yourself root access, run the following command
    sudo su
    Unless you have changed it somewhere, the password on the BB-xM should still be temppwd
  2. Run the following command
    gedit /etc/rc.local
    This file should run at the end of each multiuser runlevel
  3. You'll notice that the file will look something like this
    #!/bin/sh -e 
    # rc.local 
    # This script is executed at the end of each multiuser runlevel. 
    # Make sure that the script will "exit 0" on success or any other 
    # value on error. 
    # In order to enable or disable this script just change the execution 
    # bits. 
    # By default this script does nothing.
    exit 0 

    Edit the code by adding the following lines before exit 0
    echo "GOOOOD MORNING USER!!!" >> /dev/kmsg
    echo 0x04 > /sys/kernel/debug/omap_mux/uart2_rts # Muxes to Gpio pin
    echo 145 > /sys/class/gpio/export # Exports Xmega reset pin
    echo "in" > /sys/class/gpio/gpio145/direction  
    # This chunk of code was written by Ben Foo, it bring GPIO130 (pin 21) on the 
    # expansion board to a high state to stop the xMega chip from resetting
    echo 0x04 > /sys/kernel/debug/omap_mux/sdmmc2_clk # Muxes to Gpio pin
    echo 130 > /sys/class/gpio/export # Exports Xmega reset pin
    echo "out" > /sys/class/gpio/gpio130/direction
    echo 1 > /sys/class/gpio/gpio130/value # Brings pin high
    # end code
    echo "Confirmation that pin shift has run" >> /dev/kmsg
    #This part of code is for connecting to the internet
    #Only works in WSRNLab port H23
    sudo ifconfig eth0 down
    sudo ifconfig eth0 hw ether aa:14:61:7e:01:c2
    sudo ifconfig eth0
    sudo dhclient -v
    #End of code
    /home/ubuntu/Desktop/control_eyebug/control_eyebug  #This runs startup demonstration code 
    exit 0
  4. Now restart the BB-xM and this should set Pin 21 to high when the system boots.
-- AlYoung - 2013-01-09
Topic attachments
I Attachment Action Size Date Who Comment
PDFpdf Expansion_Board_BB-xM__Kinect.pdf manage 575.1 K 2013-01-09 - 01:13 AlYoung Design Schematic for BB-xM
Topic revision: r3 - 2013-02-14 - 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