Arduino Uno R4 WiFi (AUR4W) data only rec'd w/ Arduino's IDE

Greetings,

I can upload code and view AUR4W's USB UART data using Arduino IDE Serial.
I cannot view this data on any other terminal tool (settings are appropriately set, yes); Yes, the Arduino IDE is not running and COM6 is available--it connects but no other terminal tool except Arduino IDE registers any receipt of transmissions.
All my other boards work with any terminal (e.g. my Arduino Uno R3 works with any terminal tool e.g. CoolTerm, Bray's, etc.).
It seems the Arduino IDE is doing something to the AUR4W USB port that the other terminal tools are not doing.
Same code running and port settings running on Uno R3.
Tried dead simple code too:

#include <stdint.h>

void setup() {
Serial.begin(115200);
}

void loop() {
Serial.println(" Arduino UNO R4 WiFi");
delay(1000);
}

Again, works on Arduino IDE Serial Output, not with others. Same settings, USB cable, etc.
Again, other boards work with any terminal tool.
Brand new Arduino Uno R4 WiFi .

I found out the issue:
On my AUR4W I have to set other terminal's DTR; on Arduino's IDE I don't.
Also my other Arduinos I did not set the DTR.
At least it is working now; I will see if, on the USB UART, there is a HW difference btwn R4 and my other boards.

As with any MCU with a native USB, this is not enough:

void setup() {
Serial.begin(115200);
}

.... as explained in the reference you need to add:

void setup() {
Serial.begin(115200);
while ( !Serial ) delay(10);
}

...to wait until the port is configured and ready before you can use it. :wink:

Guglielmo

Warning, doing the code above will hang the Arduino forever, which may be fine in some cases, but for example if you wish for your code to work without the USB being plugged in, I often
put a timeout on the waiting for Serial.

That is something like:
while (!Serial && (millis() < 5000)) {}
Which will wait only up to 5 seconds for the Serial Terminal to connect

... of course, if you want the program to continue running even if no one is connected to the serial port, then you are right to introduce a timeout mechanism. :wink:

Guglielmo

Thanks, that is good advice for future. However:

  1. In this particular case the port was available i.e. Serial==true but the external terminal tool would not receive until I turned on the DTR. The Arduino was transmitting and the tool showed it was connected...just no data rec'd. It just took me a long time to figure it out what was going on with the external terminal tool. I really don't use the Arduino IDE Serial Monitor once I am confident that the Arduino serial communication works; I have the external terminal tool OFF then once I program the Arduino I turn the external terminal tool ON.

  2. Even in development I should add a flag so that the serial code doesn't try to run and/or maybe turn on a 'SerialOpen' LED):

#define SERIALCOM
#define TMR_SERIALAVAILABLE 5000

bool gFlg_SerialAvailable; //global variable
setup()
{
  while(!Serial && (millis() < TMR_SERIALAVAIABLE));  //max for serial connect wait
  if(Serial)
  {
    gFlg_SerialAvailable = true;
  }
  digitalWrite(LED_SerialAvailable, gFlg_SerialAvailable);
}

// Use for serial comm when SERIALCOM is #define[d]:
#ifdef SERIALCOM
if(gFlg_SerialAvailable)
{
  //Serial Comm stuff
}
#endif
}
  1. FYI, I am transferring this program to Arduino Uno R4 WiFi from Pro Mini ATmega328 where I had BT programming. This project will normally not be connected to a serial port; I only use it for development (uses #ifdef SERIALCOMM/#endif around all serial code) and at some point I will add programming over bluetooth.

Wait ... UNO R4 WiFi, normally, does NOT have a native USB, but uses a normal UART that communicates with the ESP32 ... you connect to the ESP32's USB. :roll_eyes:

Guglielmo

My Arduino Uno R4 WiFi is programming and communicating with the computer via the USB-C cable. I have not modified it i.e. soldered SJ1 (which BTW is not a good design...if it is soldered and P408 sends logic 0 then that would short the uC pin. Should have a series resistor or blocking diode). The net P408 controls a pair of analog switches that connect the USB to either the ESP32 or R7FA4M1AB3CFM uC. When it does this...I am not sure. But I am programming / serial communicating the R4 at 115200 baud.

My point is and has been:

  1. I found that for USB Serial Communication I have to set the DTR to ON for any terminal tool except the Arduino IDE's Serial Monitor (which at least on v1.8 the DTR configuration is not exposed). This solved my initial problem stated as post's topic...the Arduino IDE obscured the DTR requirement so I did not know why my terminal with its confirmed open port was not receiving information i.e. no RX activity.

  2. With no Uno R4 HW modifications I am programming and communicating over USB; I am also reading/writing the R4 RA4M1 microcontroller's 8K EEPROM through USB (by sending a R/W command/data string from my computer's serial communication terminal tool, using a USB port, to the R4) and viewing its contents on the either the Arduino IDE's Serial Monitor or external monitor tool;

So I am in this sense not concerned how the USB bridge is being controlled; I am able to program and serially communicate over USB-C. Once my core programming is done I will seek to add programming over Bluetooth (from my computer to the R4) as I had with previous project's Pro Mini ATmega328.

This is just a heads-up (in case anyone searches for this issue) that if external serial communication tool is not receiving data that, at least in my experience, the initial state of the port DTR has to be set to ON.

For what it is worth, on my main UNO R4 Wifi board, I soldered a switch across those two pads, so I can turn it on and off.

I much prefer running it with USB connected to the main processor. I have a fork of the software where I added a new variant, which is setup for this configuration... WIsh it would come with the releases, but...