Skip to content

[BUG-LPC] Serial.println / fl::println silent on LPC845-BRK -- Serial.print works fine (blocks #3300) #3313

Closed

Description

@zackees

Symptom

On LPC845-BRK with the Arduino core (zackees/ArduinoCore-LPC8xx@da8f2b8), Serial.println(...) produces zero output on the host's USB-VCOM serial monitor -- but Serial.print(...) works fine. Every byte sent via Serial.print reaches the bridge and the host; bytes sent via Serial.println do not.

Discovered during the LPC845 bring-up echo investigation (#3300 / #3102). FastLED's fl::println -> platforms::println -> Serial.println chain inherits the bug -- every literal-string call to fl::println on LPC is silently dropped.

Empirical evidence

Built examples/AutoResearch/AutoResearch.ino (LowMemory mode auto-engages on LPC8xx) with these instrumented call sites:

// In setup, after Serial.begin(115200):
Serial.println("RAW: direct Serial.println after begin");  // silent
fl::println("TRACE A: after serial_begin");                  // silent

// In src/fl/log/log.h log_emit_f (called via FL_DBG_F):
//     fl::printf("%s(%d): %s: ", file, line, log_kind_name(kind));   // visible
//     fl::printf(format, args...);                                    // visible
//     fl::printf("\n");                                                // visible

After bash autoresearch lpc845brk --upload-port COM20:

  • The schema-validation phase emits src/fl/remote/remote.cpp.hpp(151): INFO: Stored request ID for rpc.discover (id=N) via FL_DBG_F -- this does reach the host.
  • The bring-up phase's Serial.println("RAW: direct Serial.println after begin") and fl::println("TRACE A: ...") -- both do not reach the host.
  • Subsequent direct serial probe via PowerShell [System.IO.Ports.SerialPort]::Open('COM20') -> WriteLine(...echo...) -> 0 bytes back, confirming the silence is not an autoresearch parser issue.

The TRACE literals are confirmed present in firmware.elf via arm-none-eabi-strings, so the compiler emitted the call. The HardFault override (PR FastLED/framework-arduino-lpc8xx#31) is also linked at distinct address from Default_Handler, so if a fault were occurring, the override would emit FAULT: ... over USART -- we get silence, not a fault.

Suspected root cause

Print::println(const char*) in the LPC8xx Arduino core inherits from Arduino's Print base. It typically routes:

size_t Print::println(const char *s) {
    size_t n = print(s);
    n += println();  // writes "\r\n"
    return n;
}

size_t Print::println(void) {
    return print("\r\n");  // or write('\r'); write('\n');
}

Two distinct hypotheses for where the LPC version breaks:

  1. Print::println() is virtual or template-resolved and the LPC core's HardwareSerial doesn't get the override -- so Serial.println(s) calls a different write path than Serial.print(s). Check cores/lpc8xx/HardwareSerial.h for whether println is inherited or overridden.

  2. Print::println(const char*) calls some implementation that allocates or uses flush() in a way that blocks on TXIDLE forever -- e.g. the LPC USART0's STAT.TXIDLE polling has a window where a back-to-back \r\n write deadlocks. The fact that Serial.print(str) followed by Serial.print("\n") works (via FL_DBG_F's separate fl::printf("\n") call) but Serial.println(str) (which writes \r\n atomically) does not suggests something about the combined operation. Possibly a missing availableForWrite() semantic, or a buffer that gets stuck because HardwareSerial::flush() polls TXRDY instead of TXIDLE.

Reproduction

#include <Arduino.h>
void setup() {
    Serial.begin(115200);
    delay(100);
    Serial.print("ALPHA: this appears on host\r\n");   // visible -- explicit \r\n via print
    Serial.println("BETA: this does NOT appear");      // silent
    Serial.print("GAMMA: this appears too\n");         // visible -- bare \n via print
}
void loop() {}

Build with bash compile lpc845brk --examples <sketch>; flash via pyocd; open COM at 115200; expected output is all three lines; observed output is ALPHA + GAMMA only, BETA missing.

Why this is bring-up-blocking

The entire FastLED diagnostic surface on LPC8xx routes through fl::println for any callsite that wants a string-literal trace marker. With fl::println silently failing on LPC, every TRACE / WARN / FAULT helper is invisible until rewritten to use the fl::printf("...\n") form that goes through fl::print instead.

Specifically blocks:

Proposed fix

In fl::platforms::println for LPC (src/platforms/arm/lpc/io_lpc.cpp.hpp:39), replace:

void println(const char* str) FL_NO_EXCEPT {
    if (!Serial) return;
    Serial.println(str);
}

with the safe two-step form that's known-good per the FL_DBG_F evidence:

void println(const char* str) FL_NO_EXCEPT {
    if (!Serial) return;
    Serial.print(str);
    Serial.print("\r\n");
}

This bypasses Serial.println's broken path while preserving the observable behavior (one logical line terminated with CRLF).

Open question on the Arduino-core side: does Print::println actually need to be re-overridden in HardwareSerial? Or is it Print's base implementation that's broken on this stack? Filing as a sibling issue at zackees/ArduinoCore-LPC8xx so the maintainer can diagnose the root cause; FastLED's platforms::println workaround unblocks #3300 today regardless.

Acceptance criteria

  • src/platforms/arm/lpc/io_lpc.cpp.hpp::println rewritten as two Serial.print calls.
  • Reproduction sketch above shows BETA on the host after the fix.
  • fl::println("hello world") from setup() shows up on COM<N> after flash + reset.
  • Companion Serial.println Arduino-core bug filed at zackees/ArduinoCore-LPC8xx (link from this issue).
  • bash test --cpp 333/333 pass (host unaffected -- only LPC's platforms::println changes).

Refs

Filed during /clud-fix burn-down on #3208 while diagnosing #3300; user identified the binding gap directly: "our io printf in fastled is not correctly binding to the LPC print function the same way the arduion core is".

Activity

  1. moved this from Triage to Done in FastLED Trackeron Jun 20, 2026
  2. added a commit that references this issue on Jun 20, 2026
    943ad5c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions