Skip to content

UART Logger

Robin Verhagen-Guest edited this page Oct 13, 2023 · 19 revisions

UARTLogger is a configurable plugin for the CSpect emulator.

The plugin monitors data traffic transmitted and received between the Next and its ESP and Pi UARTs.

Installation

You must be running CSpect version 2.19.4.4, or newer. The latest version of CSpect is always available to download here.

The latest tested version of the plugin is always available at the releases page.

Download the CSpectPlugins.zip file, then extract the UARTLogger.dll and UARTLogger.dll.config files. Exit CSpect, then copy these into your CSpect directory (the one which contains CSpect.exe).

CSpect is supplied with some plugins preinstalled. If your CSpect installation already has these two files, skip to the Configuration section unless you wish to update to the latest plugin version.

Restart CSpect to enable the plugin.

Uninstallation

It is not normally neccessary to uninstall the plugin, unless it is adversely affecting how CSpect runs. It is usually more convenient to disable logging with the EnableESPLogging and EnablePiLogging settings.

To uninstall, exit CSpect and delete the UARTLogger.dll file from the CSpect directory.

Configuration

The plugin can be configured by editing the UARTLogger.dll.config file in your favourite text editor. Always restart CSpect after changing the configuration. You may configure these settings:

EnableESPLogging

Set this to true to enable ESP logging, or false to disable. When enabled, any ESP traffic will be written to the file specified in ESPLogFile.

The default value is true, enabling ESP logging.

EnablePiLogging

Set this to true to enable Pi logging, or false to disable. When enabled, any Pi traffic will be written to the file specified in PiLogFile.

The default value is true, enabling Pi logging.

TruncateLogsOnStartup

Set this to true to create new log files every time CSpect starts up. This setting is useful if you are repeatedly debugging, as it makes it easier to keep track of the latest traffic.

Set this to false to append to the existing log files every time CSpect starts up. This setting is useful if you are debugging an intermittent problem, or trying to capture data over a longer period.

The default value is true, so the logs are always truncated.

ESPLogFile

Set this to be the path/filename of the ESP log file you wish to create. The setting may be blank, a filename, a relative path, or an absolute path.

Absolute paths are useful if you have installed CSpect inside a restricted directory such as program files. Otherwise relative paths are usually the easiest to use.

The default value is blank, which creates an ESPLogFile.txt file in the CSpect directory.

PiLogFile

Set this to be the path/filename of the Pi log file you wish to create. The setting may be blank, a filename, a relative path, or an absolute path.

Absolute paths are useful if you have installed CSpect inside a restricted directory such as program files. Otherwise relative paths are usually the easiest to use.

The default value is blank, which creates an PiLogFile.txt file in the CSpect directory.

FlushLogsAfterSecs

The plugin only writes to the log file when switching between reads and writes, or between ESP and Pi traffic. This keeps the log files nicely grouped and readable.

However, the last reads or writes in a session usually don't do any further switching, so the traffic won't appear in the log. This setting forces the logs to be flushed after a period of inactivity, so that you always see the latest traffic.

The default value is 2 seconds, which suits most typical debugging sessions. If you are logging a particularly sparse UART session, increasing this value may improve log readability.

The shortest value you can specify is 1 second.

Viewing Log Files

Many popular log viewers are available with tail-logging capabilities. This means they automatically display the latest contents of a text file, and keep scrolling so the most recent entries at the bottom are always visible.

Linux and MacOS have native tail-logging capabilities.

My personal favourite to use on Windows is Notepad++, with the Document Monitor plugin. This works well with UARTLogger.

External Serial Port Loggers

The UART Logger plugin is useful, and can capture all traffic sent from CSpect. However, it can only capture traffic sent to CSpect after a Z80/BASIC program has read it from CSpect's emulated UART buffer.

Usually this is not a problem, but if you wish to get a comprehenensive log of all traffic, an external serial port logger application might be useful. These hook into the OS serial port drivers using special admin privileges, so make sure you use an app that you trust.