No start of nano BLE after upload

Hi,
I have a NANO 33 BLE Sense and once I uploaded a sketch it won't start automatically. I have also a MKR WiFi 1010 and the same sketch starts after upload.
Do I need to upload a bootloader manually or is it a problem of the board?

Thanks, Peter

check that :

Serial.begin(9600);
while(!Serial) {}

It is mandatory for some cards (nano 33 BLE for instance) to start the serial connection.
But in the same time, it will block your sketch untill serial connection is on.

So:

  • you need your Serial for debugging or others: plug the USB and the sketch should run flawlessly
  • you dont need Serial: comment Serial.begin() AND the blocking function while (!Serial) with // .

Dear GrandPete

I do not need Serial. I just downloaded the standard Blink sketch. However, I included it, but nothing changed. The onboard LED flashes in and out after uploading the sketch. Once I pushed the reset button, the LED is blinking according to sketch.
It seems, that the Serial.begin code is blocking the device. If I include it, it won't even start after pressing the reset button.

looks like you have your answer! :+1:

It's not mandatory. It's only needed if one does not want to miss the first printed messages over USB. And if the board is externally powered or serial monitor (or other terminal program) did not open de port on the PC, the Arduino will never get past that point.

thanks for the precision. and your words are right with what I have in mind. maybe mandatory was too strong for the situation?

As I said, initializing the serial monitor was not the solution. Any other idea why this board will not start after download?

If the serial monitor in setup procedure blocks the device, what can I do as workaround?

Don't use while(!Serial) if you don't have to wait for a print.

I do not know what the solution is for the problem where you have to manually reset your board after an upload.

You may encounter the same issue I do finally!
I will edit my post with a link to my topic but actually I have a sketch on board Nano 33 BLE I coded and debug with serial always plugged (the device has its own battery to power up the nano).
when finally needed to play the device on its own, I was stucked with the blocking command while(!Serial) I forgot to comment.
Corrected the code and nothing worked. Tried to erase EVERY Serial.xxx occurence in my code and nothing worked.

-> Finally I add delay(400) at the beginning of my Setup() . Interestingly, my sketch is running properly on the battery or with serial connected (thru USB), without blocking.
I can even add Serial.begin() without issues.

I presume BLE library may need time to set up and/or one of my code is interferating.

Please try to add a delay at the beginning of your Setup() and tell me back the result.

my topic :

DeR GandPete,

I included the delay as recommended by you but no change at all. The sketch starts running if I push the reset button or interrupt the power supply (HW reset). As I said, the MKR1010 board starts right after uploading the sketch.
So, the delay was at least for me not the solution. I even increased the delay value.

Thanks.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.