Serial port gets disabled then null (Windows 10)

edited December 2015 in Arduino

Strange, never seen this before. I am on a WIndows 10/Arduino Uno/Mega system where things work fine, in particular with respect to using the plainDSP shield along with its C++ library. I generate data on Arduino, transfer it to processing on my PC - via COM6 -> perfect.

On a new project, using PID to develop a flight controller, I donwloaded the PID_Front_End_v03 and the control IP5 librairies. On the Arduino side things work fine. On the processing side after fixing a valueValue() function call which should really be getValueLabel(), I get this cryptic error COM5 for the UNO, COM6 for the Mega : Error, disabling serialEvent() for COM5 null The serial port does get opened but some time before Inside the draw loop, I get the close port message. I tried debugging the program however the Processing debugger seems to have a mind of its own. Stepping does not really work and break points seem to get ignored. The draw function has simple code :

void draw()
{
  int counter;
  counter = 0;
  background(200);
  drawGraph();
  drawButtonArea();
  counter++;
}

My idea was to step donw each line one at a time, see where the problem occurs, and then redo and step into the naughty function. That's assuing the debugger works as it should. But no. I manage to stop at background(200); but the if I try to step down one line at a time, does not do anything. If I put break points on each of the lines and do GO, stops at background(200); but not at the others. Furthermore, the close port message does not occur systematically on a first call to a function. I can stop several times at background(200); before it occurs.

There it is. Any ideas ???

Michèle

Answers

  • edited December 2015

    DISCLAIMER: Almost nil experience w/ IDE's debuggers here! 8-X

    PDE's debugger is a very new recent addition released for Processing 3.
    AFaIK, it's supposed to be as simple as possible w/ just minimal set of features.

    Processing's main execution happens in a Thread called "Animation".
    It's the 1 responsible to callback settings(), setup(), draw(), keyPressed(), mouseDragged(), etc.
    Plus rendering current state of canvas to the window at the end of each draw().

    Pretty much those are the code lines we can set breakpoints for PDE's debugger.
    However, serialEvent() is run by Serial's own Thread instead.
    And I don't think PDE's debugger can track other threads. :(

    "Error, disabling serialEvent() for COM5 null"

    It means some Exception happened while running serialEvent().
    And that the Serial's instance had decided to stop calling it back from that moment on! :-&

  • Thanks. Somme serialEvent() exception did occur but knowing this does not guet me any nearer to fixing the problem. Any idea as to what may cause the exception knowing that with another library the system works fine.

    On the debugger side things are a little clearer.

    Michèle

  • Your code is for your eyes only. We've got no idea what's in there! :-@

  • @micheled Do you mind pasting your sketche's serialEvent() function ? I have a hunch you may be parsing a string and a null string or object may sneak in if there's anything wrong with the serial communication.

Sign In or Register to comment.