Repository navigation
Description
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"); // visibleAfter 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)viaFL_DBG_F-- this does reach the host. - The bring-up phase's
Serial.println("RAW: direct Serial.println after begin")andfl::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:
-
Print::println()is virtual or template-resolved and the LPC core'sHardwareSerialdoesn't get the override -- soSerial.println(s)calls a different write path thanSerial.print(s). Checkcores/lpc8xx/HardwareSerial.hfor whetherprintlnis inherited or overridden. -
Print::println(const char*)calls some implementation that allocates or usesflush()in a way that blocks on TXIDLE forever -- e.g. the LPC USART0'sSTAT.TXIDLEpolling has a window where a back-to-back\r\nwrite deadlocks. The fact thatSerial.print(str)followed bySerial.print("\n")works (viaFL_DBG_F's separatefl::printf("\n")call) butSerial.println(str)(which writes\r\natomically) does not suggests something about the combined operation. Possibly a missingavailableForWrite()semantic, or a buffer that gets stuck becauseHardwareSerial::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:
- [BLOCKER] LPC845-BRK AutoResearch bring-up echo returns empty RX (suspected HardFault) — blocks #3102 #3300 -- bring-up echo silence investigation. We needed
FL_WARN_LIT/fl::printlntrace markers insetup()to localize where the bring-up hangs. The markers compiled correctly and made it into the ELF but never reached the wire. - Any LPC8xx user sketch that calls
Serial.println(literal)for status output.
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::printlnrewritten as twoSerial.printcalls. - Reproduction sketch above shows BETA on the host after the fix.
-
fl::println("hello world")fromsetup()shows up onCOM<N>after flash + reset. - Companion
Serial.printlnArduino-core bug filed atzackees/ArduinoCore-LPC8xx(link from this issue). -
bash test --cpp333/333 pass (host unaffected -- only LPC'splatforms::printlnchanges).
Refs
- [BLOCKER] LPC845-BRK AutoResearch bring-up echo returns empty RX (suspected HardFault) — blocks #3102 #3300 -- LPC845-BRK bring-up echo silence (blocked by this bug).
- fix(startup): override HardFault_Handler with sync-emit + reboot (closes #30) framework-arduino-lpc8xx#31 -- HardFault override (recently merged; works because it uses raw USART register writes, not
Serial.println). src/platforms/arm/lpc/io_lpc.cpp.hpp-- the FastLED-sideplatforms::printlnshim that needs updating.<framework-arduino-lpc8xx>/cores/lpc8xx/HardwareSerial.{h,cpp}-- the Arduino-core suspect.
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".
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
fix(platforms/lpc): work around Serial.println silent-drop on LPC8xx (c…