CLion + PlatformIO Serial Monitor

I'm switching between the Arduino IDE and CLion + PlatformIO (plugin). I have both the Arduino UNO board and the Arduino R4 WiFi board.

Both boards are working fine with the serial monitor in the Arduino IDE.

The Arduino UNO board is working fine with the serial monitor in thePlatformIO (plugin) inside CLion.

My issue is the Arduino R4 WiFi board isn't working (no data received from the board using Serial.println) with the serial monitor in thePlatformIO (plugin) inside CLion. The serial monitor settings are identical.

Any clues?

Thanks.

Hi @adigitek. Does the problem occur even if you upload this simple sketch to the UNO R4 WiFi board?:

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

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

Yes…it’s independent of the sketch. It must be something to do with the PlatformIO env for the R2 wifi board

Some users shared a workaround they found for the board not being able to communicate with the Microsoft Excel "datastreamer":

If that technique was applicable to your situation, then we would expect the following sketch to work:

#include <HID.h>

void setup() {
  Serial.begin(9600);
  Serial.dtr();
}

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

There are a couple of things you need to know if you are using that sketch:

The first is that the board might have a different port number when it runs this sketch (caused by it being configured for USB HID capabilities), so make sure you verify that you still have the right port selected in the PlatformIO Serial Monitor.

The second is that, after you upload a sketch like this that configures the UNO R4 WiFi for USB HID capabilities, you must use a different procedure the next time you upload a sketch to the board:

  1. Unplug the USB cable of the UNO R4 WiFi board from your computer.
  2. Connect the UNO R4 WiFi board to your computer with the USB cable.
  3. Press and release the button marked "RESET" on your UNO R4 WiFi board quickly twice.
    You should now see the on-board LED that is marked "L" start pulsing.
  4. Select the port of the UNO R4 WiFi board from Arduino IDE's Tools > Port menu.
    :red_exclamation_mark: The double reset you performed in step (3) can cause the port number of the board to change, so don't assume you already have the correct port selected.
  5. Select Sketch > Upload from the Arduino IDE menus (or click the "Upload" button).

The upload should now complete successfully.

If the sketch you uploaded to the board uses the USB HID capabilities, it will be necessary to use the special upload procedure described above for subsequent uploads. If you switch to a sketch that does not use USB HID then you can resume uploading via the standard procedure.

Thanks. I tried that (USB HID) but that didn't work either (using your exact sketch).

I also tried adding the HID part to another sketch. What was interesting (other than it didn't work either) was the fact that the other sketch would normally blink the built-in LED and that didn't work either. This might suggest that there was some issue with the Serial.dtr() statement (i.e. things crashed after execution)

By "built-in LED", do you mean the LED that is marked "TX" on the board?

no the L as in LED_BUILTIN