[Nano 33 BLE Sense] Garbage at beginning of serial output

Hi there!

I'm starting to play with my new Arduino 33 BLE Sense. Running the examples offered by the IDE I discovered that the first twenty or so seconds there is only garbage in the serial monitor.

The following is a slightly changed example of the IDE:

// Nano BLE LPS22HB Test
// Luftdruck

// Der Sensor 

#include <Arduino_LPS22HB.h>

//----------------------------- 80 Zeichen ------------------------------------|

void setup()
{
  Serial.begin(9600);
  Serial.println("LPS22HB Test gestartet.");

  for(byte n=30; n>0; n--)
  {
    Serial.print(n);
    Serial.print(" ");    
    delay(1000);
  }

  
  if(!BARO.begin())
  {
    Serial.println("Barometer nicht bereit!");
    while(1);
  }
}

void loop()
{
  Serial.print("Luftdruck: ");
  Serial.print(BARO.readPressure(MILLIBAR));
  Serial.println(" millibar");
  delay(3000);
}

And this is its output:

24 20  110 9 8 7 6 5 4 3 2 1 Luftdruck: 757.93 millibar
Luftdruck: 995.81 millibar
Luftdruck: 995.77 millibar
Luftdruck: 995.78 millibar
Luftdruck: 995.77 millibar
Luftdruck: 995.78 millibar
...

So the first 20 seconds are completely unusable.

There is no USB hub and this doesn't change on another USB port or at a different baud rate (9600, 300).

Is my Arduino some kind of bricked? Is this „normal“? I'm used to believe that Arduino produces things I can rely on a 100 percent. So ... wtf?

TIA

Gregor

That's not garbage. Garbage is non-latin and unprintable characters. That is a sequence of correctly printing numbers in decimal format. Particularly the fact that it seems to be counting down to startup.

My guess would be that that is coming from the firmware or bootloader during the boot process. Is there a caveat regarding serial on these boards anywhere?

DrAzzy:
That's not garbage. Garbage is non-latin and unprintable characters. That is a sequence of correctly printing numbers in decimal format. Particularly the fact that it seems to be counting down to startup.

My guess would be that that is coming from the firmware or bootloader during the boot process. Is there a caveat regarding serial on these boards anywhere?

Well, if I uploaded a sketch, make a change and want to upload it fails with:

Globale Variablen verwenden 42152 Bytes (16%) des dynamischen Speichers, 219992 Bytes für lokale Variablen verbleiben. Das Maximum sind 262144 Bytes.
Erzwinge Reset durch öffnen/schließen mit 1200 bps auf dem Port /dev/ttyACM0
processing.app.debug.RunnerException
	at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:152)
	at cc.arduino.UploaderUtils.upload(UploaderUtils.java:77)
	at processing.app.SketchController.upload(SketchController.java:732)
	at processing.app.SketchController.exportApplet(SketchController.java:703)
	at processing.app.Editor$UploadHandler.run(Editor.java:2075)
	at java.lang.Thread.run(Thread.java:748)
Caused by: processing.app.SerialException: Fehler beim Ansprechen des seriellen Ports "/dev/ttyACM0".
	at processing.app.Serial.touchForCDCReset(Serial.java:107)
	at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:136)
	... 5 more
Caused by: jssc.SerialPortException: Port name - /dev/ttyACM0; Method name - openPort(); Exception type - Port busy.
	at jssc.SerialPort.openPort(SerialPort.java:164)
	at processing.app.Serial.touchForCDCReset(Serial.java:101)
	... 6 more

The next time I click upload, just a few seconds after the first try, it works.

Gregor

Interesting - likely the same cause IMO...

DrAzzy:
Interesting - likely the same cause IMO...

Hm. Instead of giving up playing I should try uploading a new bootloader. Or stick with the good old 5 V Arduinos.

At least it seems not to be a problem with my >5 years old i5 with its quite fresh Debian 10.

Hm. Weekend. Hm.

Gregor

PS: If I click „Tools->Burn“ Bootloader I get a „choose programmer“ message. I have an AVRISPII but the Nano doesn't have an ICSP header. Is there any bootloader thing I could upload (how?) anyway?

I dont have enough experience to know what type of programmer is needed for that part, it is not an ISP programmer.

I also do not know enough about that part to know if this is a known issue or something; should defer decision until you get a response from someone qualified to answer

DrAzzy:
I also do not know enough about that part to know if this is a known issue or something; should defer decision until you get a response from someone qualified to answer

Thanks!

Well, I will have to play with a WSthingy-RGB-LED-Strip. Just bought one to get to know it. This one needs 5 V anyway.

Gregor

DrAzzy:
That's not garbage. Garbage is non-latin and unprintable characters. That is a sequence of correctly printing numbers in decimal format. Particularly the fact that it seems to be counting down to startup.

My guess would be that that is coming from the firmware or bootloader during the boot process. Is there a caveat regarding serial on these boards anywhere?

The countdown is in the sketch code:

gregorss:

  for(byte n=30; n>0; n--)

{
    Serial.print(n);
    Serial.print(" ");   
    delay(1000);
  }

There is some serial debug output printed to Serial1 from MbedOS after a crash, which is indicated by a 3x long, 3x short blink pattern, but nothing to Serial that I've seen yet.

So the countdown is not unexpected, but the first part of the countdown being corrupted is. I just ran the sketch on my Nano 33 BLE Sense and couldn't reproduce any of the problems gregorss reported.

gregorss:
PS: If I click „Tools->Burn“ Bootloader I get a „choose programmer“ message. I have an AVRISPII but the Nano doesn't have an ICSP header. Is there any bootloader thing I could upload (how?) anyway?

You can't use the AVRISP mkII on the Nano 33 BLE. The AVRISP mkII is only for AVR architecture microcontrollers. The nRF52840 microcontroller on the Nano 33 BLE Sense is a different architecture, and requires a different programmer. I don't have any experience with burning the bootloader on the Nano 33 BLE boards yet. I saw that some work has been done to add nRF52840 support to Adafruit_DAP:

but it says in the readme:

Right now we only have commands for the ATSAMD series.

I don't know whether they haven't finished the nRF52840 support, or if they did finish and just forgot to update the readme.

I have used Adalink to burn the bootloader on my MKR board:

I see that claims to also support nRF52840. You'd need a J-Link programmer. Adalink also claims to work with the ST-Link V2 programmer, but I had no luck using that programmer with my MKR board. The situation may be completely different with the nRF52840 though.

Ugh, how did I miss that part of the sketch...

pert:
... The AVRISP mkII is only for AVR architecture microcontrollers. ...

Uh sure. See how confusing things can be ...

After all I have the answers I wanted.

There is something wrong with my (first) Nano 33 and I can't use it except for the things that are working as expected like the onboard RGB-LED. If it is capable of communicating with an RTC I will make it a nice universal reminder for technoids.

Gregor