Skip to content

Debug and System Commands

Commands for system information, debugging, and remote desktop control.

Display device information.

info
ch> info
Board: NanoVNA-H
2019-2025 Copyright NanoVNA.com
based on @DiSlord @edy555 ... source
Licensed under GPL.
Version: 1.2.44 [p:101, IF:12k, ADC:192k, Lcd:320x240]
Build Time: Jan 29 2026 - 14:30:45
Architecture: ARMv6-M Core Variant: Cortex-M0
Platform: STM32F072xB
FieldDescription
BoardHardware variant
VersionFirmware version with build parameters
p:Maximum sweep points
IF:IF frequency in kHz
ADC:ADC sample rate in kHz
Lcd:Display resolution
ArchitectureCPU architecture
PlatformMCU part number

Display firmware version.

version
ch> version
1.2.44

Shorter output than info, useful for scripts checking version.


List available commands.

help
ch> help
Commands: scan scan_bin data frequencies freq sweep power bandwidth
time sd_list sd_read sd_delete saveconfig clearconfig dump
touchcal touchtest pause resume cal save recall trace marker
edelay s21offset capture measure refresh touch release vbat
tcxo reset smooth config usart_cfg usart vbat_offset transform
threshold help info version color

Reset the device.

reset [dfu]
ParameterDescription
(none)Normal reset
dfuReset into DFU bootloader
ch> reset
(device resets)
ch> reset dfu
(device enters DFU bootloader)

After reset dfu:

  1. Device appears as DFU device (VID:PID 0483:DF11)
  2. Flash new firmware using dfu-util
  3. Reset device to exit DFU mode
Terminal window
dfu-util -d 0483:df11 -a 0 -s 0x08000000:leave -D firmware.bin

These commands enable remote control and screen viewing.

Get current screen data.

refresh

Binary LCD buffer data in RGB565 format.

Used by remote desktop applications to display the NanoVNA screen.


Simulate touch press.

touch <x> <y>
ParameterDescription
xX coordinate (0-319 or 0-479)
yY coordinate (0-239 or 0-319)
ch> touch 200 120

Simulate touch release.

release
ch> touch 200 120
ch> release
  1. refresh - Get screen image
  2. touch x y - Send touch event
  3. release - Release touch
  4. refresh - Get updated screen

These commands are typically disabled in release builds. Enable by uncommenting defines in main.c.

Display ChibiOS RTOS thread information (requires ENABLE_THREADS_COMMAND, and CH_CFG_USE_REGISTRY in chconf.h).

threads
ch> threads
stklimit| stack|stk free| addr|refs|prio| state| name
20000200 200003F0 448 200003F8 1 128 READY sweep
20000600 200007F0 320 200007F8 1 64 SLEEP main
ColumnDescription
stklimitStack lower bound address
stackStack pointer (current position)
stk freeBytes of stack remaining (watch for low values)
addrThread control block address
refsReference count
prioThread priority (higher = more urgent)
stateChibiOS thread state (READY, SLEEP, SUSPENDED, etc.)
nameThread name string

Display system statistics (requires ENABLE_STAT_COMMAND).

stat

Shows timing and performance statistics.


Get/set codec gain (requires ENABLE_GAIN_COMMAND).

gain [value]

Used for debugging audio codec signal levels.


Write to Si5351 registers directly (requires ENABLE_SI5351_REG_WRITE).

si <register> <data>
ParameterDescription
registerSi5351 register address (0–255)
dataByte value to write (0–255, supports hex 0x prefix)
ch> si 16 0x4F
ch> si 3 0xFF

Write to TLV320AIC3204 audio codec registers via I2C (requires ENABLE_I2C_COMMAND).

i2c <page> <register> <data>
ParameterDescription
pageCodec register page (0–255)
registerRegister address within the page
dataByte value to write
ch> i2c 0 81 0xC0
ch> i2c 1 1 0x08
  • The TLV320AIC3204 uses a paged register space — you must specify the page
  • Calls tlv320aic3204_write_reg(page, reg, data) internally
  • Useful for adjusting codec gain, input routing, and sample rates during development

Send commands to the LCD controller (requires ENABLE_LCD_COMMAND).

lcd <cmd> [data...]
ParameterDescription
cmdLCD command byte
data...Optional data bytes (variable number)
ch> lcd 0x04
ret = 0x00858552
ch> lcd 0x28
ret = 0x00000000
  • Sends a register read/write via lcd_send_register()
  • Returns the controller response as a 32-bit hex value
  • The command byte and behavior depends on the display controller (ILI9341, ST7789, or ST7796S)
  • Useful for reading device ID registers or debugging display initialization

Configure Si5351 frequency band parameters (requires ENABLE_BAND_COMMAND).

b <band_index> <parameter> <value>
ParameterDescription
band_indexBand configuration index
parameterOne of the subcommands below
valueNumeric value to set
SubcommandDescription
modeOutput mode for this band
freqFrequency boundary
divPLL divider
mulPLL multiplier
omulOutput multiplier
powOutput power level
opowOpposite port power level
lLeft channel configuration
rRight channel configuration
lrBoth channels
adjFrequency adjustment
ch> b 0 mode 1
ch> b 2 freq 300000000
ch> b 1 pow 3
  • Calls si5351_update_band_config() with the parsed index, parameter, and value
  • Used for characterizing synthesizer behavior at different frequency ranges
  • Incorrect settings can degrade measurement accuracy

Run diagnostic tests (requires ENABLE_TEST_COMMAND).

test

Runs internal hardware tests.


Set the DAC output value (requires __VNA_ENABLE_DAC__).

dac <value>
ParameterDescriptionRange
valueDAC output value0–4095 (12-bit)
ch> dac
usage: dac {value(0-4095)}
current: 2048
ch> dac 1024
  • Sets channel 2 of the on-chip DAC via dac_setvalue_ch2()
  • With no arguments, displays usage and the current DAC value
  • Value is masked to 12 bits (& 0xFFF)
  • Used for calibrating analog circuits or testing signal levels

Select the audio codec input port (requires ENABLE_PORT_COMMAND).

port <channel>
ValueDescription
0TX port (measurement/stimulus channel)
1RX port (reference channel)
ch> port 0
ch> port 1
  • Calls tlv320aic3204_select() to switch the codec input multiplexer
  • Used for debugging signal path routing between the TX and RX channels

Configure Si5351 timing parameters (requires ENABLE_SI5351_TIMINGS).

t <index> <value>
ParameterDescription
indexTiming parameter index
valueTiming value
ch> t 0 100
ch> t 1 50
  • Calls si5351_set_timing() to adjust PLL settling and output timing
  • Used for optimizing sweep speed vs. measurement stability
  • Incorrect values can cause PLL lock failures or measurement glitches

Configure I2C bus timing parameters (requires ENABLE_I2C_TIMINGS).

i <scldel> <sdadel> <sclh> <scll>
ParameterDescription
scldelSCL delay (setup time)
sdadelSDA delay (hold time)
sclhSCL high period
scllSCL low period
ch> i 4 2 15 15
  • Directly configures the STM32 I2C TIMINGR register fields
  • Used for tuning I2C bus speed when experimenting with different clock rates
  • All four parameters are required
  • Applies immediately via set_I2C_timings()

To enable debug commands, edit main.c and uncomment the relevant defines:

// Enable for debug builds
#define ENABLE_THREADS_COMMAND // threads
#define ENABLE_STAT_COMMAND // stat
#define ENABLE_GAIN_COMMAND // gain
#define ENABLE_TEST_COMMAND // test
#define ENABLE_I2C_COMMAND // i2c (codec register access)
#define ENABLE_LCD_COMMAND // lcd (display controller access)
#define ENABLE_SI5351_REG_WRITE // si (synth register write)
#define ENABLE_BAND_COMMAND // b (band configuration)
#define ENABLE_PORT_COMMAND // port (codec input select)
#define ENABLE_SI5351_TIMINGS // t (synth timing)
#define ENABLE_I2C_TIMINGS // i (I2C bus timing)
#define ENABLE_SAMPLE_COMMAND // sample, gamma
#define __VNA_ENABLE_DAC__ // dac

Then rebuild the firmware.


Check stack usage:

// In threads output, stack column shows used stack
// Compare to allocated: waThread1 = 1024 bytes

Time domain profiling (if enabled):

START_PROFILE;
// code to measure
STOP_PROFILE;

All debug commands in main.c:

CommandHandlerLineCompile Flag
infocmd_info2630ENABLE_INFO_COMMAND
versioncmd_version2561(always)
helpcmd_help3035(always)
resetcmd_reset517(always)
refreshcmd_refresh2774__REMOTE_DESKTOP__
touchcmd_touch2785__REMOTE_DESKTOP__
releasecmd_release2791__REMOTE_DESKTOP__
threadscmd_threads2706ENABLE_THREADS_COMMAND
statcmd_stat2499ENABLE_STAT_COMMAND
gaincmd_gain1262ENABLE_GAIN_COMMAND
sicmd_si5351reg2597ENABLE_SI5351_REG_WRITE
i2ccmd_i2c2665ENABLE_I2C_COMMAND
lcdcmd_lcd2691ENABLE_LCD_COMMAND
bcmd_band2678ENABLE_BAND_COMMAND
testcmd_test2416ENABLE_TEST_COMMAND
daccmd_dac690__VNA_ENABLE_DAC__
portcmd_port2475ENABLE_PORT_COMMAND
tcmd_si5351time2587ENABLE_SI5351_TIMINGS
icmd_i2ctime2619ENABLE_I2C_TIMINGS