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

Thread: Teensy 3.1 is randomly freezing

  1. #1
    Senior Member
    Join Date
    Jan 2015
    Posts
    153

    [RPi issue] Teensy 3.1 is randomly freezing

    LATER EDIT:

    It was a Raspbery Pi (raspbian) issue. Teensy is working just perfect.


    ==

    Hello,

    I using Teensy 3.1 as the core of my solar battery charger/monitoring device. It has a serial connection with a Raspberry Pi, used as a remote interface (VNC).

    Few minutes ago, the connection with the Teensy has dropped and even after rebooting the RPi for a couple of times (remotely) the serial connections remained closed ("no /dev/ttyACM0" stuff).

    That was the second crush this year. It seems to occur randomly, after few months of perfect behaviour.

    The only remedy is to (remotely, again, as the physical access is complicated) rewrite the hex file (stored on RPi) then the Teensy it's visible again as a (USB) serial device.

    What could be the reason for this strange behaviour? The power supply is common for both Teensy and Rpi and it's very stable and well filtered.

    Actually, I don't know if Teensy is really freezing or is just a (USB) connection problem but I have no other means to communicate with Teensy during these "blackouts".

    Assuming there was a software problem with RPi drivers & such, how come I could actually rewrite the hex file, even if Teensy is not shown as a (USB) serial device?

    And, like I've just said, after reflashing the code, the serial connection is working without any further reboots of RPi.

    Any thoughts are highly appreciated.
    Last edited by someteen; 06-02-2016 at 04:53 PM.

  2. #2
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,530
    Did you try to just reset the Teensy via the RPi instead of reprogramming it? It should be easy to solder an additional wire between one of the i/o pins of the RPi and the reset pad of the Teensy for that purpose.

    Another idea would be to integrate a few lines of code into the Teensy's firmware, checking every minute or so if the Serial link is still up and if not (use an intervalTimer), rebooting the Teensy if needed.

  3. #3
    Senior Member
    Join Date
    Jan 2015
    Posts
    153
    Thanks for your quick reply!

    Yes, I'm already thinking of some kind of software (Teensy/Pi) and hardware (power recycling) watchdogs.

    But what could be the reason for this behaviour? Is there a way to "reset" a USB connection? (well, that's a RPi/linux specific question actually)

    Then again, how come the reprogramming actually works while I get "no /dev/ttyACM0" error message when I try a serial connection??

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,551
    Quote Originally Posted by someteen View Post
    But what could be the reason for this behaviour?

    Who knows!

    Perhaps a software bug on the Pi or on Teensy?

    Perhaps a hardware fault, perhaps power related, from which the Pi doesn't recover? (the USB host is in control of all USB communication)

    Perhaps something else? Do you really imagine anyone could know, from only the info in this thread? But my blind guess is a software bug on the Pi side....

    The Linux kernel gives messages about status changes, which are normally collected and written to disc by syslog. Maybe those log files can give some clues about what went wrong?


    Is there a way to "reset" a USB connection? (well, that's a RPi/linux specific question actually)
    Some (rare) hubs have the ability to power cycle their ports, but otherwise not really. USB has a reset sequence, but it doesn't cause the device to actually reboot. It's just part of the USB communication.

    Then again, how come the reprogramming actually works while I get "no /dev/ttyACM0" error message when I try a serial connection??
    Teensy programming done with HID protocol, not serial.

    The serial device only appears to your Pi when Teensy runs your program. Assuming you had Serial selected in Arduino's Tools > USB Type menu (Serial is the default), your program causes Teensy's USB port to act as serial.

  5. #5
    Senior Member
    Join Date
    Jun 2013
    Location
    So. Calif
    Posts
    2,828
    have an LED blinky "I'm alive" on the Teensy?

    What does ("no /dev/ttyACM0" stuff)" mean? Is that an error displayed on the RPi? I have an RPi connected to an XBee via fast UART and don't have faults with the serial.

    When you say "connection" between the Teensy and RPi, is there a certain protocol in use on the serial link: One that is connection based? Or is it just message / packet exchanges?

  6. #6
    I've had similar sounding issues from bad code on the teensy. Things like interrupt code that should be using volatile variables but isn't, basically memory issues. Sometimes in these cases pressing the reset button on teensy is required to reprogram it, sometimes not. You didn't say what the teensy is doing, but you could possibly write a test function that runs all possible data the teensy will encounter in the wild and see if the issue is reproduced.
    Last edited by ohnoitsaninja; 06-02-2016 at 12:27 AM.

  7. #7
    Senior Member
    Join Date
    Jan 2015
    Posts
    153
    Thank you very much for your suggestions!

    Btw, that Teensy is driving a solar battery charger (dual phase synchronous buck converter) and is monitoring the battery bank voltage and load current.

    But now that Paul have mentioned it, I guess there was a RPi related problem (I'll check all the log files asap).

    Maybe some process/device file has died unexpectedly so any further rebooting of RPi couldn't clear that pid "locked" status.

    After reflashing the Teensy, the flag has been cleared somehow hence I could have accessed the serial port again (without rebooting the RPi).

    Now I feel like an idiot, after giving Teensy such a bad name.

    Paul, please accept my apologies! After all, you know that I've traded all my "arduino" stuff for Teensy..

    Now I'm looking further for the new family member.. is it going to be "much faster" you said?!

Posting Permissions

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