I am working on a project with the Arduino Giga R1 WiFi and I tried uploading a simple sketch which will print a message on the serial monitor. It compiled and uploaded fine but the serial monitor was empty, I tried a different sketch for making an LED glow and that one uploaded fine too but it did nothing. I tried everything, I made sure the baud rate was right, I uninstalled the device via device manager multiple times but nothing worked. Can somebody help me?
Hi @stardroid5000.
Please post your full sketch.
I'll provide instructions you can follow to do that:
- If you are using Arduino IDE, select Tools > Auto Format from the menus.
- Click on the window that contains your sketch code.
- Press the Ctrl+A keyboard shortcut (Command+A for macOS users).
This will select all the text. - Press the Ctrl+C keyboard shortcut (Command+C for macOS users).
This will copy the selected text to the clipboard. - Open a reply here on this forum topic by clicking the "Reply" button.
- Click the
<CODE/>icon on the post composer toolbar.
This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
- Press the Ctrl+V keyboard shortcut (Command+V for macOS users).
This will paste the copied code into the code block. - Move the cursor outside of the code block markup before you add any additional text to your reply.
- Repeat the above process if your sketch has multiple tabs.
- Click the "Reply" button to publish the post.
Hi @stardroid5000 . Just to be sure, can you confirm you're targeting the main core and not the m4 core in the IDE?
I actually tried both
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("yello");
}
void loop() {
// put your main code here, to run repeatedly:
}
It’s literally just printing a message to serial monitor.
And for the LED example:
void setup() {
// put your setup code here, to run once:
pinMode(2, OUTPUT);
digitalWrite(2, HIGH);
}
void loop() {
// put your main code here, to run repeatedly:
}
Try adding while (!Serial) {} before the println in sketch #1
nope, still nothing
Please try this:
- Create a sketch with the following content:
void setup() { Serial.begin(115200); } void loop() { Serial.println("hello"); delay(1000); } - Select Tools > Target core > Main core from the Arduino IDE menus
- Select Sketch > Upload from the Arduino IDE menus.
- Wait for the upload to finish successfully.
- Open the Arduino IDE Serial Monitor.
Do you now see "hello" printed periodically in Serial Monitor?
Yes, although I don’t understand why wont it print it void setup?
Are you using the sketch with the modification @steve9 suggested in post #6?:
Like this:
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
while(!Serial) {}
Serial.println("yello");
}
void loop() {
// put your main code here, to run repeatedly:
}
That sketch works as expected for me.
As for why your original sketch from post #5 didn't work, the reason is that the board starts running the sketch program before Serial Monitor can get the serial port open. That means any serial output produced by the program right after startup will not be seen in Serial Monitor. This is why, in cases where we want to see all the serial output from the very start of the program execution, we must add code that causes the program to wait until the board's serial port has been opened before proceeding. That is accomplished by the code @steve9 provided.
This might be unexpected if you have previous experience working with the boards like UNO R3, Mega 2560, or classic Nano that have a dedicated USB to serial bridge chip. When using those boards, there is no need to configure your sketch program to wait for the serial port to be opened. The reason for this is that those board have a special circuit that causes them to automatically reset when the serial port is opened. So even though the program starts running before the port is opened by Serial Monitor, the reset causes the program to restart, and so you always see all the serial output from the start of the program.
You should note that, in the case where you want to use the GIGA R1 WiFi board without Serial Monitor running, you must make sure to remove that while(!Serial) statement. If you don't do that, then the program will never run.
Yes, i am using that and still nothing, I tried both scripts on a different board and both worked.
In some cases, you might need to add a short delay before the first serial output:
Serial.begin(115200);
while(!Serial) {}
delay(500);
Serial.println("yello");
It seems that it takes some time for the serial port to be fully initialized, and if you try to send any serial output before that happens, it will not be received in Serial Monitor. I have not found this to be necessary with the GIGA R1 WiFi, but perhaps it depends on the specifics of the system in which the board is being used. So give that a try.
Is the different board also a GIGA R1 WiFi, or is it some other board model?
Yep, that does it, thank you for your help.
You are welcome. I'm glad it is working now.
Regards, Per
