wrt54g v1.1 CDF2 gpio -- Success

Discussion in 'Tomato Firmware' started by johncc, Sep 12, 2012.

  1. johncc

    johncc Serious Server Member

    (original post: http://www.linksysinfo.org/index.php?threads/wrt54g-v1-1-gpio-7.40959/)

    I got it working acceptably on my wrt54g v1.1 (CDF2) for my "wireless pump controller", so I am posting for posterity:

    1) I never got any "ND" builds to load and run successfully. But these do work for me:
    Tomato 1.28 "stock-- not ND"​
    (I am using the RAF build because I like the "Tools/System" tab)​

    2) gpio enable/disable had no effect, but I eventually discovered "led dmz on/off" (which did not exist on the Toastman build I was using on other routers). This will achieve the same thing for my digital output:
    # note active low.    wrt54g v2-4
    pump_on(){  gpio disable  7 ; }
    pump_off(){ gpio enable  7 ; }
    # gpio doesn't work in wrt54g v1.1 (CDF3), therefore:
    pump_on () { led dmz on; }
    pump_off() { led dmz off; }
    3) For gpio input I am using the same code as on my Toastman build on other (V2-V4) routers, namely:
    # returns 1 if "button" not pushed, 0 if pushed
      local port=$1
      local mask=$(( 1 << $port))
      local ans=$(($(printf "%d" "'`dd if=/dev/gpio/in count=1 2>/dev/null`") & $mask))
      return $((ans != 0))
      # pressure switch is on the "Cisco button", port 4
      if gpio_in 4 ; then echo "ON" ; else echo "OFF" ; fi
    4) Gpio input is a difficult solder point as described in:
    (A good tip is to measure resistance to nearby pads on a high scale before and after soldering to ensure no bridging)​

    5) Unlike the later builds (Toastman e.g.) these firmware versions apparently do not support WPA2 in WEB (Wireless Ethernet Bridge) mode, so I set my main router to WPA/WPA2 and it connected fine using WPA.

    Fun project. I thank all of you who have done, and are doing, the software and hardware hacking on this platform!


  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice