Pre-release SerialFlow 0.9.0 beta 2 works, but has rough edges. Tell us what you find.

Example · MDX-400 motor-drive bench · Logger

A compact UART logger for the MDX-400 bench

Pick the port and the baud. Colour, find and a log file need no firmware change.

  • Nothing to add to the firmware
  • 16, 256 and 24-bit ANSI colour
  • 7 keyword rules in one text file
  • Log to .txt or .csv

The MDX-400 is a simulated motor drive. A script printed the serial lines its firmware would send, and SerialFlow read them exactly as if they came from a COM port. Your own board works the same way.

On the MDX-400 bench the log window sat beside the IDE all day. It had to show everything the drive says, from the boot banner to an overcurrent trip, in the drive’s own colours, and keep a copy on disk. SerialFlow did that in a window about 700 × 830 pixels, with no graphs and no side panels.

What the firmware prints

At power-up the drive prints a boxed banner, one line per boot step and two bar lines. Each step starts with the drive’s own clock (seconds since boot) and a status tag:

║  MDX-400  Brushless Motor Drive                  firmware 2.4.1║
║  STM32G474 @ 170 MHz · 48 V / 40 A · sensorless FOC · 20 kHz   ║
[   0.004] [ OK ] Clock tree        HSE 24 MHz → PLL 170 MHz
[   0.057] [ OK ] UART1             921 600 baud · DMA · SerialFlow protocol v2
[   0.096] [INFO] Gate driver       DRV8353  VCP 11.2 V  VGLS 10.8 V  faults: none
[   0.184] [WARN] NTC MOSFET        sensor 2 reads 1.4 °C above sensor 1 (within tolerance)
[   0.203] [BATT] Pack              13S4P Li-ion · 98 % · 52.7 V · balancing idle
Thermal map  █████─────────────────────────  24.1 °C
Pack charge  █████████████████████████████─  98 %

During the 40-minute run it prints one line per event:

[ 120.000] [CTRL] Run profile 'cruise-hill-regen' started · setpoint 1 500 rpm
[ 900.000] [CTRL] Load step 150 % (hill climb) · torque limit 11.5 Nm
[ 984.000] [TRIP] Overcurrent phase B 42.3 A > 40.0 A · PWM off · auto-restart in 200 ms
[ 984.210] [ OK ] Fault cleared · restart OK · 1 trip in this session
[1260.000] [WARN] MOSFET 82.1 °C → thermal derate to 70 % torque
[1560.000] [BATT] Regenerative braking · +1.8 A into pack · Vbus 53.1 V
[2400.000] [ OK ] Run complete · 40 min · energy 286 Wh · peak MOSFET 82.6 °C · 1 trip

The colours are plain ANSI escape codes. Here is the trip line on the wire, with ESC (0x1B) written as \x1B:

\x1B[38;5;245m[ 984.000]\x1B[0m \x1B[38;5;196m\x1B[1m[TRIP]\x1B[0m Overcurrent phase B \x1B[38;5;196m\x1B[1m42.3 A\x1B[0m > 40.0 A · PWM off · auto-restart in 200 ms

And the start of the thermal bar. Every block carries its own 24-bit colour, from blue towards red, and the empty part is a dim ─:

\x1B[38;5;245mThermal map  \x1B[0m\x1B[38;2;40;110;255m█\x1B[38;2;36;119;247m█\x1B[38;2;32;128;238m█…\x1B[38;5;238m─────…\x1B[0m  \x1B[38;5;245m24.1 °C\x1B[0m
CodeWhat it doesWhere the MDX-400 uses it
ESC[38;5;nm256-colour text, palette index nthe tags: 42 green [ OK ], 45 cyan [INFO], 220 yellow [WARN], 196 red [TRIP], 39 blue [CTRL], 171 magenta [BATT]; 245 grey for the clock
ESC[1mbold[ OK ], [WARN], [TRIP]
ESC[38;2;r;g;bm24-bit TrueColor texteach block of the bar lines
ESC[0mreset colour and attributesafter every coloured part

Set it up in SerialFlow

  1. Pick the port and the baud rate in the two boxes on the toolbar. The drive names its own rate in the boot log, UART1 921 600 baud, so choose 921600 (9 600 to 3 000 000). Press Connect or F5.
  2. Make it compact. Close the panes you don’t need with their ✕; ☰ → View brings any of them back. The bench window held the terminal, one row of Quick Send buttons and the send line.
  3. Timestamps and line numbers. In ☰ → Settings → Terminal tick Show Timestamps (default format HH:mm:ss.fff). On the Behavior page tick Show Line Numbers. Press OK.
  4. Find. Ctrl+F opens a find box with a match counter (3 / 4) at the top right of the terminal. F3 and Shift+F3, or Enter and Shift+Enter in the box, step through the matches. Aa matches case, Ab| whole words, and .* reads the text as a regular expression. For a find strip that stays open, dock ☰ → View → Search Panel under the terminal.

Each line now carries two clocks: [19:53:47.384] is the PC time the line arrived, [ 984.000] the drive’s own time since boot. The gutter number lets you point a colleague to the trip: line 28.

Keyword highlighting

Keyword rules mark any word you choose, in your own colours, even when the firmware prints it plain. Open ☰ → View → Keyword Highlighter, press Add, type the keyword and click the FG and BG swatches. Aa makes a rule case-sensitive, the On box switches it off, and Up / Down set the priority.

The bench used seven rules. Save As writes them as .json or text, and Load reads either back. The text file:

# Format: keyword | foreground | background | enabled | case_sensitive
TRIP | #FFFFFF | #C62828 | true | true
Overcurrent | #FFFFFF | #8E2A2A | true | false
WARN | #1A1A1A | #FFB300 | true | true
derate | #1A1A1A | #FF8A3D | true | false
Regenerative | #0E2A12 | #5BD16B | true | false
Run complete | #0B2239 | #4FC3F7 | true | false
Telemetry | #E0E0E0 | #3A3F4B | false | false

Lines that start with # are comments. TRIP and WARN are case-sensitive, so they match the capital tags only. Telemetry is switched off until you want the routine lines to stand out too.

Log to a file

While you watch. Open ☰ → View → Data Logger. Pick txt, csv or binary, type the full path of the file in Path and press Start. The status line reads Logging and counts the bytes; Stop closes the file. The 35-line bench log came to 2.9 KB as txt and 3.9 KB as csv.

The txt file holds each line as the terminal shows it: UTF-8, ANSI codes removed, box-drawing characters kept:

[ 984.000] [TRIP] Overcurrent phase B 42.3 A > 40.0 A · PWM off · auto-restart in 200 ms
[1260.000] [WARN] MOSFET 82.1 °C → thermal derate to 70 % torque

Tick Time in the panel and each txt line starts with the PC time it arrived, as [19:56:21.469] .

The csv file starts with a header and adds the PC time each line arrived and its number in the file, counted from 1:

time,n,text
…
2026-11-04 19:56:21.469,28,"[ 984.000] [TRIP] Overcurrent phase B 42.3 A > 40.0 A · PWM off · auto-restart in 200 ms"
2026-11-04 19:56:21.768,30,"[1260.000] [WARN] MOSFET 82.1 °C → thermal derate to 70 % torque"

A line goes into the file once it is complete, so a line that reaches the PC in two pieces is logged whole. The firmware can also start and stop the logger itself, with ~LogOn:label and ~LogOff: see Device commands in the manual.

Every session, without pressing Start. In ☰ → Settings → Data Logger tick Enable Long-Term Logging Mode, then Auto-log all data to disk, and set Log Directory, Max File Size (default 50 MB) and Max Log Files (default 10). Each port writes serial-log-{port}-{yyyyMMdd-HHmmss}.txt files: a new one when the size limit is reached, and the oldest one goes when there are too many. Without a directory they go to Documents\SerialFlow\logs\.

The result

Animation: a compact SerialFlow window filling with a colour-coded log line by line.
The bench log arriving in the compact window: ANSI colour, keyword colours, and SerialFlow’s timestamps and line numbers.
Three small SerialFlow windows showing the same motor-drive log: without timestamps and line numbers, with both switched on, and with the find bar and four highlighted matches.
The same window three ways: timestamps and line numbers off, both on, and the Ctrl+F find bar (MOSFET, 2 / 4). The keyword rules are on in all three. Here the drive’s own uptime column is left out, so every time on screen is SerialFlow’s.

In your own firmware

If your firmware prints a log already, it works as it is. To get the same tags and colours, wrap your lines like this (plain C, printf to the UART):

#include <stdio.h>

#define GREY     "\x1B[38;5;245m"
#define RST      "\x1B[0m"
#define TAG_OK   "\x1B[38;5;42m\x1B[1m[ OK ]" RST
#define TAG_INFO "\x1B[38;5;45m[INFO]" RST
#define TAG_WARN "\x1B[38;5;220m\x1B[1m[WARN]" RST
#define TAG_TRIP "\x1B[38;5;196m\x1B[1m[TRIP]" RST

/* t = seconds since boot, printed as "[ 984.000]" */
static void log_line(float t, const char *tag, const char *msg)
{
    printf(GREY "[%8.3f]" RST " %s %s\n", t, tag, msg);
}

void report_trip(float t, float amps)
{
    char msg[64];
    snprintf(msg, sizeof msg, "Overcurrent phase B %.1f A > 40.0 A", amps);
    log_line(t, TAG_TRIP, msg);
}

On Arduino, Serial.print the same strings.

Good to know

  • Find matches plain text. With .* on it takes a regular expression, such as TRIP|WARN.
  • The txt log carries times only with Time ticked; the csv always has them. Its n counts the lines written to the file, from 1.
  • Start creates the file anew: a file with the same name is overwritten.
  • Timestamps are PC arrival times. With ☰ → Test → Load Test File the whole file arrives at once, so the stamps hardly differ; Delayed Playback gives each line its own.
  • The terminal keeps 100 000 lines by default (Settings → Terminal → Max Lines). With Long-Term Logging on, Retention Mode can instead keep the last minutes (TimeBased, 30 by default) or stay under a memory limit (MemoryBased, 50 MB by default).

Try it yourself

  1. Start SerialFlow. You don’t need to connect a port.
  2. ☰ → Settings → Terminal → tick Show Timestamps, then Behavior → tick Show Line Numbers, and press OK.
  3. ☰ → View → Keyword Highlighter → Add a rule for TRIP with a red BG, and one for WARN in amber.
  4. ☰ → View → Data Logger: pick txt, type a full path such as C:\Users\<you>\Documents\SerialFlow\bench.txt and press Start.
  5. ☰ → Test → Delayed Playback → Demo → showcase_text.txt. The log scrolls in with timestamps, and TRIP and WARN light up.
  6. Press Ctrl+F and type MOSFET. F3 steps through the matches.
  7. Press Stop in the Data Logger and open bench.txt in Notepad: the same lines, without colour codes.