The Serial Console
The USB CDC Serial port, the Debug console option, the pre-connect boot log, and the console's independence from the video transport.
Serial on the Neuro N6 is a USB CDC port shared with Neuro Studio's terminal. It is a complete Stream: print, println, write, read, available, peek and flush are implemented, binary data is passed unchanged, and the port is usable from the first line of setup().
void setup() {
Serial.begin(115200);
while (!Serial) {
; // wait for a host to open the port
}
Serial.println("ready");
}Serial.begin(baud) is accepted for compatibility. USB has no baud rate, and the value is ignored, with one exception: a host opening the port at 1200 baud and dropping DTR requests a reboot into the bootloader.
while (!Serial) blocks until a host opens the port. Sketches that run unattended omit it.
Debug console option
Tools > Debug console determines whether the core shares the port.
Off, the default, reserves the port for the sketch.
On adds core diagnostics. About once per second a telemetry line is printed for each active subsystem: [CAMDBG] for the camera pipeline, [RATE] with capture, encode and transmit frame rates, [LCDDBG] for the display, [MICDBG] and [SPKDBG] for audio. Single-key commands are accepted: b reboots into the bootloader, r, s, v and d dump registers, X tests the watchdog, o toggles the display overlay layer. With the console On, typed bytes are consumed by the command parser and also delivered to Serial.read().
The diagnostics are compiled out when Off.
Independence from video
The console is independent of the video transport. Whether frames are sent over USB, WiFi or to the display, the CDC port remains active. The USB task that services it runs at higher priority than loop(), so a stalled sketch continues to answer on the console. Continuing telemetry combined with an absence of the sketch's own output indicates that loop() has stopped rather than the link.
Boot log
Output during setup() normally does not reach Neuro Studio, because the host attaches after the board has started. The core keeps a 2 KB log of every line published through vnd_meta_publish_debug_text() and replays it when a host attaches, paced at one line per 100 ms.
[bootlog] --- pre-connect boot log ---
...lines published during setup(), in order...
[bootlog] --- end of boot log, live from here ---The log retains the earliest lines and stops recording when full. Plain Serial.print output is not captured. A start-up message that must survive a late connection is published through both paths:
void report(const char *s) {
Serial.println(s);
vnd_meta_publish_debug_text(s); // requires PostProcess.h
}NeuroN6_DbgPrint
NeuroN6_DbgPrint(const char *) writes directly to the CDC port. It is a C function, available from C source files and from code that runs before Serial is initialised. It takes a complete string; formatting is done with snprintf first. The I2C scanner example uses it so its output appears alongside the core's own messages.
Input
void loop() {
if (Serial.available()) {
char c = Serial.read();
if (c == 's') printStatus();
}
}The OTA example reads single characters this way. With the debug console Off every typed byte reaches the sketch. With it On, the core's command letters are acted on first; b reboots the board before the sketch reads it.
Neuro Studio terminal
Neuro Studio opens the CDC port and shows it in a terminal panel. The port cannot be held by Neuro Studio and the Arduino Serial Monitor at the same time. Uploads work while Neuro Studio is connected, because the uploader closes and reopens the port during the 1200 baud touch.
Header UART
D0 and D1 are wired to UART4 and labelled RX and TX. The core does not expose them as a Serial1 object. The LTE modem library owns UART4 when linked. Serial is always the USB port.