Skip to content

Way to check if Serial.write() will block or way to have it fail instead of block. [imported] #672

Closed
@cmaglie

Description

@cmaglie

This is Issue 672 moved from a Google Code project.
Added by 2011-10-08T16:59:01.000Z by [email protected].
Please review that bug for more context and additional comments, but update this bug.

Original labels: Type-Defect, Priority-Medium, Component-Core

Original description

What steps will reproduce the problem?

  1. Use Arduino RC1.
  2. Download the code attached, and upload it to an Arduino board. (Uno or older, it doesn't matter)
  3. Trigger the interrupt by grounding pin 2, sometimes this takes a few tries.

What is the expected output? What do you see instead?

The interrupt should trigger, but the serial shouldn't print out until the ISR is done under the new scheme of non-blocking serial writes. This happens most of the time.

However, sometimes, when the ISR is triggered, the serial still starts printing a few characters, doesn't finish, and hangs the processor. Even when the pin 2 grounding is removed, and the ISR should finish, it stays stuck there, and I have to use the hardware reset button to get it to work again.

The ISR does not hang the processor when the serial print is removed, so I'm pretty sure the problem is in there somewhere. This all seems to happen more often when the interrupt is rapidly triggered back and forth, though I'm not absolutely sure of this.

What version of the Arduino software are you using? On what operating
system? Which Arduino board are you using?
I'm using Arduino RC1, downloaded on 10/8/11, on MAC OSX 10.6.8. This problem occurs on both the Arduino Uno and the Bare Bones Board clone running the non-optiboot Duemilanove firmware.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions