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

Thread: Firmata on Tennsy 3.2

  1. #1

    Firmata on Teensy 3.2

    Hi there,

    I'm interested in recommendations on running Firmata on a Teensy 3.2. I found some downloads here https://www.pjrc.com/teensy/td_libs_Firmata.html. They don't make any reference to 3.x teensys though so i'm wondering if they're intended for 3.x series. I tried running the "Standard Firmata" example that comes with the Arduino IDE. I was able to compile and upload to the board no problem but it didn't seem to respond to Firmata commands. Has anyone used this with Teensy 3.2 and if so what modifications did they have to make to it? I assume at the minimum you'd need to specify the serial port that the Firmata commands are expected to be received on. Thanks in advance for any guidance on this.
    Last edited by brucepomeroy; 03-13-2017 at 09:16 AM.

  2. #2
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,235
    Works for me on T3.2. in IDE i selected Examples > Firmata > StandardFirmata
    on ubuntu i ran firmata_test and selected port /dev/ttyACM0. I could read analog ports, turn pin 13 LED on and off ....

    I also ran a processing blink sketch on ubuntu.
    Last edited by manitou; 03-13-2017 at 02:13 PM.

  3. #3
    Great, thanks Manitou. How did you have your board connected to your host computer? Just with the regular USB cable or did you attache a USB->TTL cable to one of the serial ports on the board?

    Thanks so much.

  4. #4
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,235
    just the regular USB cable (same one used for upload and monitor)

  5. #5
    Thanks again Manitou. I tried the setup you described and it worked well. I had actually been testing with a USB -> TTL cable connected to Serial1 and I still can't get that to work. I tried replacing the following line in Standard Firmata:
    Firmata.begin(57600);
    With:
    Serial1.begin(57600);
    Firmata.begin(Serial1);


    But maybe that's not sufficient. Anyway, glad to have got it working with `Serial` now I have something to compare to and only a matter of time before I have it working with `Serial1`. In the meantime, if anyone has gotten Standard Firmata working using Serial1 on Teensy I'd love to hear what changes you had to make to the Standard Firmata example to get it to work.

    Thanks!

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,769
    You'll probably need to edit Firmata's Boards.h to disallow use of pins 0 and 1. If anything in Firmata tries to access them as GPIO, the pins are no longer controlled by Serial1.

  7. #7
    That got it working, thanks Paul!

    If anyone else runs into this, on OS X the file was here on my machine:
    /Applications/Arduino.app/Contents/Java/libraries/Firmata/Boards.h

    In that file look for:
    ...
    // Teensy 3.0, 3.1 and 3.2
    ...
    #define IS_PIN_DIGITAL(p) ((p) >= 0 && (p) <= 33)
    ...

    And change it to:
    ...
    // Teensy 3.0, 3.1 and 3.2
    ...
    #define IS_PIN_DIGITAL(p) ((p) >= 2 && (p) <= 33) // Originally: ((p) >= 0 && (p) <= 33)
    ...


    Thanks again!

  8. #8
    Junior Member
    Join Date
    Nov 2019
    Posts
    1
    I had a similar problem on Teensy 3.2 so that firmata worked via usb but failed over wireless. I'm using 2 xbee S1 radio transceivers, one as a usb dongle on my mac plugged into a sparkfun xbee explorer and the other xbee plugged to a teensy/xbee adapter board from sparkfun. As a client I'm using pduino on Pure Data Vanilla. v. 0.50
    Rather than editing the boards.h file i added these two lines to the standard firmata arduino code:

    // Ignore TX1 and RX1 pins
    Firmata.setPinMode(0, PIN_MODE_IGNORE);
    Firmata.setPinMode(1, PIN_MODE_IGNORE);

    If you are using standard firmata you would add them after line 266 then change Serial to Serial1 as follows. Also I have commented out the line 782: Firmata.begin(57600); which seems to be redundant in this setup.
    Teensy/Firmata now work over wireless.


    Code should now read from 766 onwards:

    // Ignore TX1 and RX1 pins
    Firmata.setPinMode(0, PIN_MODE_IGNORE);
    Firmata.setPinMode(1, PIN_MODE_IGNORE);


    // to use a port other than Serial, such as Serial1 on an Arduino Leonardo or Mega,
    // Call begin(baud) on the alternate serial port and pass it to Firmata to begin like this:

    Serial1.begin(57600);
    Firmata.begin(Serial1);

    // However do not do this if you are using SERIAL_MESSAGE

    // Firmata.begin(57600);
    while (!Serial1) {
    ; // wait for serial port to connect. Needed for ATmega32u4-based boards and Arduino 101
    }

    systemResetCallback(); // reset to default config
    }

Posting Permissions

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