SerialUSB on Teensy3.2 locking up on overflow?

Status
Not open for further replies.

jwatte

Well-known member
I have a sketch that does this:

Code:
void wait_for_power() {
    power.init(0);
    alarm.init(0);
    alarm.setLed(true);
    uint32_t last_db = millis();
    while (!power.voltageOk()) {
        power.readVoltage();
        uint32_t now = millis();
        if (now - last_db >= 1000) {
            SERIALUSB.print("Low Volt: ");
            SERIALUSB.println(power.getVoltage());
            last_db = now;
        }
    }
    alarm.setLed(false);
}

This function is called from setup(). The "power.init()" function sets up the ADC, and the "alarm.init()" function sets up a pin as output for flashing a LED.

I have the Teensy3.2 connected to a Linux machine (a Raspberry Pi 2 running latest Raspbian) where it shows up as ttyACM0.
I use the Arduino 1.8.3 IDE for Raspbian, and build by calling /arduino-1.8.3/arduino-builder directly, followed by teensy_post_compile and teensy_reboot. This generally works.

If I start this up with low voltage, the Teensy will enqueue a number of lines of the "Low Volt" message, and then fill up the buffer and not write more.
When I then open the port and start reading from the port, I receive the buffered data. However, no more data is received -- I get the buffered lines, and then nothing more, no matter how long I keep waiting.

So, the conclusion I draw is that it seems as if, once the write buffer has filled up, something goes wrong in the SerialUSB code, and it doesn't realize that there's more space to write to.
Has anyone else seen this? Any ideas about what can be done to fix it? Is this problem likely to be in the Teensy firmware, or in the Linux USB serial driver?
 
Status
Not open for further replies.
Back
Top