Serial Monitor unusable

The Serial Monitor shows only bullshit

What baud rate have you got in Serial.begin() in the sketch ?

9600

Please post a complete sketch that illustrates the problem, not a picture of part of it. Which Arduino board are you using ?

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

macOS Monterey 12.1
Board is Arduino UNO Wifi Rev2
The code is CheckFirmwareVersion.ino from Files>Examples>WIFININA>Tools

/*
 * This example checks if the firmware loaded on the NINA module
 * is updated.
 *
 * Circuit:
 * - Board with NINA module (Arduino MKR WiFi 1010, MKR VIDOR 4000 and UNO WiFi Rev.2)
 *
 * Created 17 October 2018 by Riccardo Rosario Rizzo
 * This code is in the public domain.
 */
#include <SPI.h>
#include <WiFiNINA.h>

void setup() {
  // Initialize serial
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  // Print a welcome message
  Serial.println("WiFiNINA firmware check.");
  Serial.println();

  // check for the WiFi module:
  if (WiFi.status() == WL_NO_MODULE) {
    Serial.println("Communication with WiFi module failed!");
    // don't continue
    while (true);
  }

  // Print firmware version on the module
  String fv = WiFi.firmwareVersion();
  String latestFv;
  Serial.print("Firmware version installed: ");
  Serial.println(fv);

  latestFv = WIFI_FIRMWARE_LATEST_VERSION;

  // Print required firmware version
  Serial.print("Latest firmware version available : ");
  Serial.println(latestFv);

  // Check if the latest version is installed
  Serial.println();
  if (fv >= latestFv) {
    Serial.println("Check result: PASSED");
  } else {
    Serial.println("Check result: NOT PASSED");
    Serial.println(" - The firmware version on the module does not match the");
    Serial.println("   version required by the library, you may experience");
    Serial.println("   issues or failures.");
  }
}

void loop() {
  // do nothing
}

Does the code produce the required output using the classic IDE ?

I have the classic IDE not installed. But on PlatformIO the serial monitor output is ok.

I don't have this board so I can't test the code fully

After restart the IDE the serial monitor works for a while. But after a minute this happens again. I think it is a general problem.