Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: Programming Teensy3.x attached to MIPS OpenWRT wireless router

  1. #1

    Programming Teensy3.x attached to MIPS OpenWRT wireless router

    My project is to wirelessly communicate with a Neato Botvac85(link has relevant pictures only, not relevant code AFAIK) and Teensy 3.2 via GL-AR300M-Ext wireless travel router, all mounted on the robot vacuum.
    The robot vacuum has a 3.3v serial console, so does the router. Eventually(once I figure out how to stop them from occasionally spewing garbage), they will be connected together. But for now they are both connected to the Teensy 3.2 who's display provides local output(pseudo terminal) for troubleshooting. Soon, the Teensy will support several additional sensors and be used for a variety of experiments. The Teensy can be plugged into the USB host port on the travel router.

    My question involves how to repeatedly reprogram the Teensy in situ from a remote computer on the network. I do not know how to do that and am seeking advice. I suspect your answers will also help pictographer and others in a similar bind.

    It doesn't seem to make much sense to install Arduino and Teensyduino on the host Linux computer(GL-AR300M-Ext router) to which the Teensy is attached by USB. It is only accessed via SSH wirelessly.

    My first thought was to put CLI Teensy loader on the GL-AR300M-Ext router. But how do I do that? I am very newb with the openWRT build system and makefiles in general. I have used menuConfig to build firmware, but never built a new package from scratch. The target is not x86, or ARM, but MIPS. QCA9531 very similar to the 9331 in a YUN. If someone could post a useable OPKG makefile, or better an actual OPKG for the CLI Teensy loader I would greatly appreciate it.

    Would it do any good to copy the /opt/arduino-1.8.x/hardware/tools folder from x86 Ubuntu unto the GL-AR300M-Ext? How would I use them?

    Another option is to capitalize on the similarity to the Yun. I've installed the yunbridge package on the GL-AR300M-Ext, and found Paul's version of the Bridge library for Arduino/Teensy. But even after reading documentation, I can't seem to understand what else I need to do to put new sketches on the remote Teensy while I use the Arduino IDE on a computer across the network. I do not have a real Yun. A walkthrough would be helpful.

    Yet another option may be something like USBIP which I've never used.

    I do not know which, if any, of these will work. Please comment with any info you have, or missing info you need from me. At this point, I do not know how to move forward.

    Other configuration info
    The GL-AR300M-Ext router is configured as a WISP repeater. So it behaves as a STA client toward my main internet gateway, and simultaneously as an AP toward client computers connecting to its WWAN. It runs recent stock firmware 2.27 with additional packages:
    libudev for persistent naming of usb devices like teensy
    yunbridge hopefully for programming arduino and teensy
    nano for text editing
    usbutils USB devices listing utilities: lsusb,

    user@remotebox:~$ ssh root@10.x.x.x
    root@10.x.x.x's password: 
    BusyBox v1.25.1 () built-in shell (ash)
        /        /\      _    ___ ___  ___
       /  LE    /  \    | |  | __|   \| __|
      /    DE  /    \   | |__| _|| |) | _|
     /________/  LE  \  |____|___|___/|___|            
     \        \   DE /
      \    LE  \    /  -----------------------------------------------------------
       \  DE    \  /    Reboot (17.01.4, r3560-79f57e422d)
        \________\/    -----------------------------------------------------------
    root@GL-AR300M:~# lsusb
    Bus 001 Device 004: ID 16c0:0483 Van Ooijen Technische Informatica Teensyduino Serial
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    After installing libudev package, /etc/udev/ was still not present. So I manually created /etc/udev/rules.d/49-teensy.rules
    How do I test if it is working?

  2. #2

    Attempted compile teensy_loader_cli on router

    When trying to make teensy_loader_cli I get this error.
    root@GL-AR300M:/teensy_loader_cli# make
    cc -O2 -Wall  -s -DUSE_LIBUSB -o teensy_loader_cli teensy_loader_cli.c -lusb 
    make: cc: Command not found
    make: *** [Makefile:15: teensy_loader_cli] Error 127
    Error 127 is file not found. That makes sense because the file it is looking for is cc for some reason, not gcc. Lower case, like gcc with the first letter gone, not the variable CC.
    Edit line 15 and I get this result.
    root@GL-AR300M:/teensy_loader_cli# make
    gcc -O2 -Wall  -s -DUSE_LIBUSB -o teensy_loader_cli teensy_loader_cli.c -lusb 
    teensy_loader_cli.c:223:17: fatal error: usb.h: No such file or directory
    compilation terminated.
    make: *** [Makefile:15: teensy_loader_cli] Error 1
    It can't find usb.h which should be included with libusb-compat as far as I can tell. libusb-compat is installed, but I cannot find usb.h on my system. Anyone know where it should go?

  3. #3
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Germany NRW
    I'm not a linux expert, and don't know which variant you have installed, but as ar as i know, the usb.h is in the develeopment-package. perhaps search for libusb-dev or similar..

    p.s. let us know where you found it

  4. #4

    Still unresolved libusb-1.0

    Quote Originally Posted by Frank B View Post
    the usb.h is in the develeopment-package. perhaps search for libusb-dev or similar.
    p.s. let us know where you found it
    I am still searching. Haven't found it yet. It seems that the development package is named differently for each distro and I have yet to discover what the name is, or if it even exists for current openWRT, which is actually LEDE 17.01.4 since the 2 projects forked and remerged, keeping the openWRT name and the LEDE codebase.

    The packages on my system are libusb-1.0_1.0.21-1_mips_24kc.ipk libusb-compat_0.1.4-2_mips_24kc.ipk

    What I did learn is that apparently Teensy uses an old version of libusb, libusb-0.1 which is incompatible with the current libusb-1.0. They should not both be installed on the same host and my system requires libusb-1.0.
    libusb-0.1 implements usb.h and is found by gcc with option -lusb
    libusb-1.0 implements libusb.h and is found by gcc with option -lusb-1.0 or `pkg-config --libs --cflags libusb-1.0`

    libusb-1.0 has a backward compatibility layer called libusb-compat-0.1 unfortunately I do not yet understand how to use it, or even how to use the logging etc. tools the developers want when requesting help.

    Any Linux gurus out there, please correct any errors I may have stated and help show us the way forward. Whether that be how to invoke libusb-compat with teensy_loader_cli or how to create a teensy_loader_cli-1.0 that is compatible with libusb-1.0

    Dustin Maki

    Note to Linux developers- if you want people to provide detailed information, it is just as easy and much more productive to provide specific command lines to type
    uname -a
    rather than saying "edit the .foo config file and grok the fram". Don't assume a random user understands how to do what seems simple to you. Even saying "type abc -xyz" is useless to someone that has never used the terminal. Say "open a terminal, type abc -xyz". At least it gives the user a term to Google and greatly mollifies the frustrated masses.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts