High Output Rare to Serial Causes Loss of SerMon on reopen of Monitor and Loss of Upload Capability

BNO055 on a Uno R4 Wifi Board

Using Adafruit BNO055 library - bunny.ino sketch.

test started at 18:29

Serial Monitor closed at 18:35
Leave closed for a minute or so on reopen of ser mon looks like it flushed data that was left:

18:35:38.890 -> Orientation: 345.50 -1.81 3.19
18:35:38.890 -> Calibration: 0 3 0 0
18:35:38.890 -> Orientation: 345.50 -1.81 3.19
18:35:38.890 -> Calibration: 0 3 0 0
18:35:38.890 -> Orientation: 345.50 -1.81 3.19
18:35:38.890 -> Calibration: 0 3 0 0
18:35:38.890 -> Orientation: 345.50 -1.81 3.19
18:35:38.890 -> Calibration: 0 3 0�

But nothing else is printed either in the Ide ser mon or with using TyCommander.

Hit Reset Button Nothing happens sketch does not print output. Have to unplug from PC and replug back in to reset and it may work.

Sometimes just get this - note replug back in twice

18:40:49.541 -> Orientation Sensor Test
18:40:49.541 -> 
18:40:49.541 -> ------------------------------------
18:40:49.541 -> Sensor:       BNO055
18:40:49.541 -> Driver Ver:   1
18:40:49.541 -> Unique ID:    55
18:40:49.541 -> Max Value:    0.00 xxx
18:40:49.541 -> Min Value:    0.00 xxx
18:40:49.541 -> Resolution:   0.01 xxx
18:40:49.541 -> ------------------------------------
18:40:49.541 -> 
18:40:49.541 -> Orientation: 359.94 -�Orientation Sensor Test
18:41:06.708 -> 
18:41:06.708 -> ------------------------------------
18:41:06.708 -> Sensor:       BNO055

This is very repeatable. Also then can not upload a new sketch to the board.

Observation: Will happen even if using a different sketch like wire scanner but you can open and close the ser mon a few more times before it occurs.

==============================================================
BNO055 on a Uno R4 Minima Board
Same Library - same sketch
Not seeing the same issue with Serial output nor upload issues.

This may be related to the following posts as well:
Problem uploading to board (arduino.cc)

UARTs code - Trying to enhance the performance and understand - UNO R4 / UNO R4 WiFi - Arduino Forum

Could try the @KurtE UARTS code fix but that has not been accepted for incorporation.

UPDATE: Tried this with a MPU-9250 and same things happens but recovery with cycling of power seems to work better to recover seeing the data. Also, note same thing happens with trying upload another sketch after closing the serial monitor but also found keeping the serial monitor open helps to avoid the issue with com not found.

1 Like

will have to try this out... SInce I still have the Wire test board on my desk...

But tomorrow.

Now checked the BNO055 (adafruit lib) and BNO080 (sparkfun lib) on Wire and Wire2 on the wifi board. Both work but still exhibit the issue with serial data.

Note: Can not check wire1 - connector broke - have new board on order before anyone asks if I checked Wire1.

Would be good to get confirmation

But that trick with leaving the serial monitor while uploading a new sketch seems to be working more than not.

@ptillisch - would this be better suited as a github issue or as a forum issue

Trying to debug this a bit more looks like the sketch is still running but after it loosed connection to the serial monitor after you open and close it.

I modified the BNO080 test sketch using Wire so that the LED will blink while the loop is running to see if the board hangs or its a serial issue.

#include <Wire.h>

#include "SparkFun_BNO080_Arduino_Library.h" // Click here to get the library: http://librarymanager/All#SparkFun_BNO080
BNO080 myIMU;

void setup()
{
  Serial.begin(115200);
  Serial.println();
  Serial.println("BNO080 Read Example");
pinMode(LED_BUILTIN, OUTPUT);
  Wire.begin();

  myIMU.begin();

  Wire.setClock(400000); //Increase I2C data rate to 400kHz
  myIMU.softReset();
  delay(250);
  myIMU.enableRotationVector(50); //Send data update every 50ms

  Serial.println(F("Rotation vector enabled"));
  Serial.println(F("Output in form roll, pitch, yaw"));
}

void loop()
{
  digitalWrite(LED_BUILTIN, HIGH);
  //Look for reports from the IMU
  if (myIMU.dataAvailable() == true)
  {
    float roll = (myIMU.getRoll()) * 180.0 / PI; // Convert roll to degrees
    float pitch = (myIMU.getPitch()) * 180.0 / PI; // Convert pitch to degrees
    float yaw = (myIMU.getYaw()) * 180.0 / PI; // Convert yaw / heading to degrees

    Serial.print(roll, 1);
    Serial.print(F(","));
    Serial.print(pitch, 1);
    Serial.print(F(","));
    Serial.print(yaw, 1);

    Serial.println();
  }
    digitalWrite(LED_BUILTIN, LOW);

}

Now when I close and reopen the serial monitor which continues to show no data is printed I can see that the sketch is still running but not is going to the serial monitor.

And if I try to upload a sketch I get the dreaded error message:

No device found on COM7
Failed uploading: uploading error: exit status 1

until I can re-establish the serial connection I can not upload. Once I get the data streaming again in the IDE I can upload with no issue. Board still shows as a com port throughout this whole process.

@ptillisch - wonder if this is an indicator of why issues on uploading.

Have not seen this issue since installing firmware 0.2.1-rc1.