No output from platformio serial monitor teensy

I just install PlatformIO today, so I am all up-to-date on versions.

I am using a Teensy 4.1, and VSCode.

The code uploads fine, but the issue is, there is no output on the serial monitor. I have set the monitor_speed in platformio.ini to 115200 because that is what my program uses.


platform = teensy
board = teensy41
framework = arduino
lib_deps = 
	adafruit/Adafruit MPU6050@^2.2.6
	adafruit/Adafruit BMP280 Library@^2.6.8
monitor_speed = 115200

I am on a Windows laptop.
What can I do to fix this?

It may be possible that the USB-CDC implementation only outputs data if DTR is asserted. You can add monitor_dtr = 1 in that to the platformio.ini.

If there is no serial port at all, then the sketch may have crashed the processor. Make sure you’re using an absolute minimal of

#include <Arduino.h>

void setup() { Serial.begin(115200); }
void loop() { Serial.println("Hello"); delay(1000); }

to exclude any errors in the code.

I have the same problem with the serial monitor.
The minimal app of maxgerhard works well.
My app uses RAW_HID with the build flag
build_flags = -D USB_RAWHID
Entering this flag in the platformio.ini of the minimal app stopps the output on the console.

Is there a workaraound to fix this?

I don’t know the teensy nor I have a teensy board but as far as I can see, choosing USB_RAWHID also disables serial device via USB.

#2: …To use serial, make sure the Tools > USB Type menu is set to “Serial”, and understand Teensy only becomes a serial device when it runs your program built with this setting…

See here

By setting build_flags = -D USB_RAWHID Serial via USB seems to be disabled.
That’s also shown in ArduinoIDE Settings where you have to choose between Serial and different other device types:


Thanks, all clear. Good to know.