Go Down

Topic: Uploading problem  (Read 441 times) previous topic - next topic

sfr7

Hi, I am trying to test my arduino due with basic code examples but when uploading them to my board I recieve this message:



El Sketch usa 11116 bytes (2%) del espacio de almacenamiento de programa. El máximo es 524288 bytes.
Atmel SMART device 0x285e0a60 found
Erase flash
done in 0.031 seconds

Write 12304 bytes to flash (49 pages)

[                              ] 0% (0/49 pages)
[==                            ] 8% (4/49 pages)
[====                          ] 16% (8/49 pages)
[=======                       ] 24% (12/49 pages)
[=========                     ] 32% (16/49 pages)
[============                  ] 40% (20/49 pages)
[==============                ] 48% (24/49 pages)
[=================             ] 57% (28/49 pages)
[===================           ] 65% (32/49 pages)
[======================        ] 73% (36/49 pages)
[========================      ] 81% (40/49 pages)
[==========================    ] 89% (44/49 pages)
[============================= ] 97% (48/49 pages)
[==============================] 100% (49/49 pages)
done in 2.401 seconds

Verify 12304 bytes of flash

[                              ] 0% (0/49 pages)
[==                            ] 8% (4/49 pages)
[====                          ] 16% (8/49 pages)
[=======                       ] 24% (12/49 pages)
[=========                     ] 32% (16/49 pages)
[============                  ] 40% (20/49 pages)
[==============                ] 48% (24/49 pages)
[=================             ] 57% (28/49 pages)
[===================           ] 65% (32/49 pages)
[======================        ] 73% (36/49 pages)
[========================      ] 81% (40/49 pages)
[==========================    ] 89% (44/49 pages)
[============================= ] 97% (48/49 pages)
[==============================] 100% (49/49 pages)
Verify successful
done in 2.209 seconds
Set boot flash true
CPU reset. 

pert

Congratulations! That means the upload was successful. Carry on.

sfr7

Thank you very much for your response, the problem is that I am trying to impement the code below, and I cannot visualize the values in the serial monitor.



void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() {
  // read the input on analog pin 0:
  int sensorValue = analogRead(A0);
  // print out the value you read:
  Serial.println(sensorValue);
  delay(1);        // delay in between reads for stability
}



ard_newbie


1/Check you have selected the same baud rate in your sketch (here 9600) as in Serial Monitor (Would be much better to select 250000).

2/analogRead() will give you a positive 12-bit number, therefore sensorValue should be an uint16_t, not an int.

3/ Select A0 as an input pin : pinMode(A0, input); in setup()

sfr7

Thank you ard_newbie but it still doesn't work. I've checked the board, the port, updated the libraries, reseted the board but it returns the same message and the serial monitor doesn't give a feedback of the sensor response.

ard_newbie


In  Tools>Board Select Arduino Programming Port
In Tools>Port, select the correct COM Port (e.g. COM9 Arduino DUE(Programming Port))

Push the Reset button after uploading,even though  this is usually not neccesary to run the sketch.

Your code runs when the Serial Monitor is open with the correct baud rate. Without anything connected to A0, you should read the noise (~ 500)

pert

There are two USB jacks on the Due:

Your code is written for use with the Due connected to the computer via the Programming Port.

https://www.arduino.cc/reference/en/language/functions/communication/serial/

sfr7

Thank you for your answer, but I've checked that and the serial monitor still doesn't work

pert

What happens if you run this simple sketch?:
Code: [Select]
void setup() {
  Serial.begin(9600);
}

void loop() {
  Serial.println("hello");
  delay(1000);
}

Make sure the baud rate menu at the bottom right corner of the Serial Monitor is set to 9600.

sfr7

The serial monitor is empty and it returns this information:


El Sketch usa 22212 bytes (4%) del espacio de almacenamiento de programa. El máximo es 524288 bytes.
Atmel SMART device 0x285e0a60 found
Erase flash
done in 0.033 seconds

Write 24480 bytes to flash (96 pages)

[                              ] 0% (0/96 pages)
[==                            ] 9% (9/96 pages)
[=====                         ] 18% (18/96 pages)
[========                      ] 28% (27/96 pages)
[===========                   ] 37% (36/96 pages)
[==============                ] 46% (45/96 pages)
[================              ] 56% (54/96 pages)
[===================           ] 65% (63/96 pages)
[======================        ] 75% (72/96 pages)
[=========================     ] 84% (81/96 pages)
[============================  ] 93% (90/96 pages)
[==============================] 100% (96/96 pages)
done in 4.716 seconds

Verify 24480 bytes of flash

[                              ] 0% (0/96 pages)
[==                            ] 9% (9/96 pages)
[=====                         ] 18% (18/96 pages)
[========                      ] 28% (27/96 pages)
[===========                   ] 37% (36/96 pages)
[==============                ] 46% (45/96 pages)
[================              ] 56% (54/96 pages)
[===================           ] 65% (63/96 pages)
[======================        ] 75% (72/96 pages)
[=========================     ] 84% (81/96 pages)
[============================  ] 93% (90/96 pages)
[==============================] 100% (96/96 pages)
Verify successful
done in 4.327 seconds
Set boot flash true
CPU reset.

ard_newbie


Try this out:

At the beginning of your sketch, add this line #define Serial SerialUSB

Connect your board to the Native USB Port,
In Tools>Board select Arduino (Native USB Port)
In Tools > Port select COMx (Arduino Native USB Port) --> unplug/plug the USB cable until you see the correct COM port
Build your sketch and upload.



Once upload is completed, open serial Monitor. What's going on this time on Serial Monitor ?

sfr7

My computer doesn't recognise the native usb port, only the programming port.

Go Up