my Arduino Nano Every reboots himself after connecting to Serial Comunication.
How to avoid this?
Im using this code with the Arduino IDE 1.0:
#include <Adafruit_BMP280.h>
Adafruit_BMP280 bmp;
const int i =2396;
unsigned int pres [i];
unsigned int x=0;
bool doloop =true;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
bmp.begin(0x76);
bmp.setSampling(Adafruit_BMP280::MODE_NORMAL, // Operating Mode.
Adafruit_BMP280::SAMPLING_X2, // Temp. oversampling
Adafruit_BMP280::SAMPLING_X16, // Pressure oversampling
Adafruit_BMP280::FILTER_X16, // Filtering
Adafruit_BMP280::STANDBY_MS_1); // Standby time. */
}
void loop() {
// put your main code here, to run repeatedly:
if(doloop==true)
{
if (x<=i)
{
pres[x]=(((trunc(bmp.readPressure()))*100)-(75000*100))/100;
x++;
}
else
{
Serial.println("Memory full");
delay(100);
}
if (Serial.available()>0)
{
for (x=0;x<=i;x++)
{
//Serial.print(x);
//Serial.print(":");
Serial.println(pres[x]);
}
doloop=false;
}
/*!!!!!!!!!!!!!!AAAAAAAAAAAAACHTUNGGGGGGGGGGGGGGGGGGGGGGGGGGG!!!!!!!!!!!!!!!!!!!!*/
delay(10);
}
}
The code reads out data from the BMP280 and stores it in the RAM of the Arduino Nano Every. After reporting that the memory is full, Arduino is connected to a PC.
The data should be read out with the Aduino Serial Monitor( or any other Serial Monitor). But after connecting to the PC and creating a connection the Arduino resets.
Hint, posting an annotated schematic, not a frizzy picture generally gets you a good answer in maybe a day, not weeks of guessing games. Be sure the schematic is as you have wired it, similar to is not allowed. Also links to hardware items technical information helps a lot in answering. Links to azon and other market places generally do not have the needed information. There are many items with the same name and number that are not the same. Have you checked the appropriate data sheets?
The engineers I worked with always did the schematic first then from the BOM (Bill Of Material) ordered the parts they need, even a few extra.
I would recommend that you change the title of this post to
"Nano Every resets after connecting to Serial Port".
The triggering of program mode (via a 1200 bps pulse) and reset is very different for the Nano Every, and its not clear to me if it should be happening on connection to USB.
How is the Nano Every powered? Perhaps you are getting a POR(power on reset) or BOD (Brownout Detector) reset.
I am very pleased with the quick response and glad that someone is helping me. Unfortunately, I can only try the solution tomorrow because I had very little time today. Just enough to write this thank you!
I have had some issues with the rts/dtr management using the Serial Monitor, and I would recommend using Cool Term or some other terminal program which can control the settings.
Thanks for solving the problem that quick. I was actually using CoolTerm.
I have been able to successfully implement this solution. Of course, after that came another problem. I will create a new thread about it..