Arduino Serial Monitor Stops Showing Data After Random Amount of Time

Hi all,

I am using an Arduino MKR Zero to read data from a bunch of sensors including an I2S audio sensor and that is mainly the reason we selected MKR Zero to have that capability.

Sensors are flow (I2C), audio(I2S), pressure (Analog), and IMU(I2C).

While monitoring the data with Arduino IDE Serial Monitor, it stops updating the data after a random amount of time.

I tried a lot of things and none of them helped

  • different USB cables
  • Increased the baud-rate (to 250000) and decreased ( to 9600)
  • increased the delay in between to give the serial transaction some time
  • I was initially using String to concatenate the data and send them as a whole and I read in several places that String might cause an issue and now in my code, I am just basically printing everything individually with multiple Serial.print command
  • I added a "Serial.flush();" in two places in my code in case its a buffer issue, but apparently it is not because when I use "Serial.println(Serial.availableForWrite());" it always prints out 63 even right before it hangs printing the data.

I am not 100% sure but I feel that decreasing the amount of delay in the code will cause the freeze issue to happen quicker.

I started to frustrate me and any help will be appreciated.