Nano BLE Bootloader Crash?

Hello all,

I am attempting to run the below program on an Arduino Nano 33 BLE sense. Out of the box, the micro-controller required that I reset the bootloader to upload code. I double tapped the reset button to run Blink. Blink worked fine. I modified Blink to use Serial communication, that worked fine. I then uploaded my own program, which failed to successfully run on the board.

I embedded a few simple lines of code into the initial segment of my program's loop function to to visually confirm the loop function was running. The LED failed to illuminate upon running the program. The IDE says the upload of my program was successful. I can only imagine this is a bootloader problem, unless there is something very wrong with my program. My program works perfectly fine when uploaded to an Arduino Micro.

I appreciate everyone's patience in helping me solve this problem.



#include <Filters.h>

//Defining Variables
int delayval = 15;            // delay for .15 sec
const int analogInPin1 = 10;  //pressure fabric for OUTSIDE, PIXEL 1
int sensorHeelValue = 0;      //value from heel pressure sensor
int sensorInsideValue = 0;    //value from inside pressure sensor
int sensorOutValue = 0;       //value from outside pressure sensor
int FilteredSensorHeelValue = 0;
int FilteredSensorInsideValue = 0;
int FilteredSensorOutValue = 0;

void setup() {

  pinMode(LED_BUILTIN, OUTPUT);

  Serial.begin(9600);
  
  pinMode(10, INPUT_PULLUP); //sensor pin

  pinMode(5, OUTPUT);        //LED pin

}

void loop(){

  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000); 

  // read the analog in values from digital pin:
  sensorOutValue = analogRead(analogInPin1);

  //Set up for LowPass filter
  FilterOnePole lowpassFilter(LOWPASS,50);

  //Filter Heel sensor signal value due to high noise levels
  lowpassFilter.input(sensorHeelValue);

  //Create new variable to hold filtered signal
  FilteredSensorHeelValue = lowpassFilter.output();
             
  //Print results to serial monitor:
  Serial.println("sensor values = " );                       
  Serial.println(sensorOutValue);

}

Please post a link (using the chain links icon on the forum toolbar to make it clickable) to where you downloaded that library from. Or if you installed it using Library Manager (Sketch > Include Library > Manage Libraries in the Arduino IDE or Libraries > Library Manager in the Arduino Web Editor) then say so and state the full name of the library.

Your filter lines take no part in modifying your analog read value .
If a program doesn’t run and you don’t know why , run the simple blink program from the IDE first before worrying about the loading bootloaders.

Hi, indeed the filter was used for another output, it is not relevant to the core code. Omit it.

Like I said, Blink program worked fine. My program however is not working.

So take all the filter stuff out and just run the led flashing part .
If that works then add the library only - see if it works - if not there is a compatibility problem with it ( the Ble has a different processor and that library might not work with it ).
Having checked the hardware is ok with the example flashing program , Build your program up a line at a time and see where it fails , then you’ve found the problem and can look for a fix

LED flashing works fine. I added each line of code and ran the program without the filter library, as soon as I add the following line: Serial.println(sensorOutValue); the IDE reports an error saying my board was not found. Upon checking my list of ports I see that my Arduino nano is no longer listed. What do I do when the port for my Arduino disappears after uploading?

For reference, the program which causes the com port to disappear after uploading:

  int sensorOutValue = 0;       //value from outside pressure sensor
  const int analogInPin10 = 10;  //pressure fabric for OUTSIDE

void setup() {
  
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);

  // initialize digital pin 10 as sensor input
  pinMode(10, INPUT_PULLUP);

  // setup serial communication
  Serial.begin(9600);
}


void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second

  // read the analog in values from digital pin:
  sensorOutValue = analogRead(analogInPin10);

  Serial.println("sensor values = " );
  Serial.println(sensorOutValue);    
}

const int analogInPin10 = 10; sensorOutValue = analogRead(analogInPin10);
The Nano33 BLE is not happy trying to analogRead() a digital pin. Why do you think 10 is an analog pin?

Change 10 to A0:A7 and the board behaves much better.

That was the result of a test I did uploading to an Arduino Flora where pin 10 is both digital and analog. I’ve updated the code accordingly making use of analog pin, however the comm port problem persists.

Please post that code. I could not confirm your issue on a Nano 33 BLE when I used an analog Pin for the reading.

Hello,

I appear to be having a similar problem, however this solution is not working. I used the reset button procedure as described and ran the generic code for Blink. The Blink upload was successful and yielded the expected output on my board. However, as soon as I uploaded my own code to my Arduino Nano BLE the com port disappeared. The IDE says the upload was successful. I'm fairly confused as to why this is happening, I don't see anything wrong with my code. My code worked perfectly fine on an Arduino micro board. Below is my code for reference:

  int sensorOutValue = 0;       //value from outside pressure sensor
  const int analogInPin10 = 10;  //pressure fabric for OUTSIDE

void setup() {
  
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);

  // initialize digital pin 10 as sensor input
  pinMode(10, INPUT_PULLUP);

  // setup serial communication
  Serial.begin(9600);
}


void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second

  // read the analog in values from digital pin:
  sensorOutValue = analogRead(analogInPin10);

  Serial.println("sensor values = " );
  Serial.println(sensorOutValue);    
}

I think your ble 33 loses bootloader address.

If you have J-link edu, you can reload the bootloader.

I also experienced the same bug.

In my case, I reloaded the bootloader, then after the ble re-works well.

I think the 33 BLE works unstable.

When I use the Mega or Uno, I don't have experienced many problems.

but, now.. I need the BLE 5.0 communication,

so I'm doing a coding of the 33 BLE . but it doesn't work well T.T...

You don't know how many I reload the bootloader of the 33 BLE....

when I use some headers (wire.h, RTClib.h, SPI.h etc.), sometimes, the 33 BLE doesn't work.

Good Luck...

Here is your problem:

Pin 10 does not have ADC capabilities on the Nano 33 BLE, so you can't use it with the analogRead function. The pins that have ADC capabilities are the ones prefixed with an "A", as marked on the bottom of the board or on the pinout provided on the documentation page:

  int sensorOutValue = 0;       //value from outside pressure sensor
  
void setup() {
  
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);

  // initialize analog pin A0 as sensor input
  pinMode(A0, INPUT_PULLUP);

  // setup serial communication
  Serial.begin(9600);
}


void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second

  // read the analog in values from digital pin:
  sensorOutValue = analogRead(A0);

  Serial.println("sensor values = " );
  Serial.println(sensorOutValue);    
}

I've merged your cross-posts @roboticfan101 .

Cross-posting is against the rules of the forum. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend 15 minutes (or more) writing a detailed answer on this topic, without knowing that someone else already did the same in the other topic.

Repeated cross-posting will result in a suspension from the forum.

In the future, please take some time to pick the forum board that best suits the topic of your question and then only post once to that forum board. This is basic forum etiquette, as explained in the "How to get the best out of this forum" guide you will find at the top of every forum category. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

I certainly can not find any issues with your sketch.

I double press the white button to place the Nano 33 in bootload mode. I then select the bootload port and upload the code. After upload I go back to tools and select the usb serial port for the monitor. I then can open the monitor and see this output

21:35:44.777 -> sensor values = 
21:35:44.777 -> 1023
21:35:46.792 -> sensor values = 
21:35:46.792 -> 1020
21:35:48.807 -> sensor values = 
21:35:48.807 -> 1021
21:35:50.775 -> sensor values = 
21:35:50.775 -> 1023

It clearly appears to be working on your end. That is exactly the output I'm trying to produce. I double pressed the reset button before uploading. My Nano appears in the comm ports, it is appropriately selected, then I proceed with pressing the upload button. The IDE then says my upload was successful, but upon opening the serial monitor I find that the com port is now blank and I am no longer able to find my board among the port options (it did not change names, it is literally not there).

Is the onboard led blinking after the upload?

but upon opening the serial monitor I find that the com port is now blank and I am no longer able to find my board among the port options (it did not change names, it is literally not there).

Before opening the serial monitor, you need to select that port with Tools>Port>
Do you not see two serial ports after the upload?
image

No, after “successful” upload the onboard LED does not blink like the code instructs it to do.

After upload, there are no ports shown that correspond to my board. The port I selected before upload disappears after uploading.