¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Question on #consolecommands


 

Oristo,
I'm slowly working my way through understand all the Wiki shellcommands. A couple of the consolecommands aren't clear to me and I was hoping you might be able to help.

1. dump - Prints output buffer. What exactly is in the output buffer? I've haven't been able to corelate the returned numbers.

2. The "trace" command returns the following example data:

['0 LOGMAG CH0 1.000000000 7.000000000', '1 LOGMAG CH1 1.000000000 7.000000000', '2 SMITH CH0 1.000000000 0.000000000', '3 PHASE CH1 1.000000000 4.000000000']

What are the two numbers that follow the channel number?

I was also going to ask about the "gamma" command and its use but I see you have a question mark in the description field, so I assume its use is not defined.

-Tks


 

I'm slowly working my way through understand all the Wiki shellcommands.
A couple of the consolecommands aren't clear to me
Join the club!

1. dump - Prints output buffer. What exactly is in the output buffer? I've haven't been able to corelate the returned numbers.
For USB device to support SPP (virtual COM port), it must be prepared
to send many bytes, so STM32 needs a buffer.
Unlike other chips, STM32 integrates USB. That is why it can appear
as a different device in DFU mode.

2. The "trace" command returns the following example data:

['0 LOGMAG CH0 1.000000000 7.000000000', '1 LOGMAG CH1 1.000000000 7.000000000', '2 SMITH CH0 1.000000000 0.000000000', '3 PHASE CH1 1.000000000 4.000000000']
What are the two numbers that follow the channel number?
SCALE/DIV and REFERENCE POSITION

I was also going to ask about the "gamma" command and its use but I see you have a question mark in the description field, so I assume its use is not defined.
Question mark was not mine; it is returned by shell in current firmware.
Originally printed gamma[0]& gamma[1] - see message #101
It is presumably now replaced by 'sample gamma'
I suppose 'sample' works with 'port' command, but have not tested
enough to be certain.
I guess that 'sample' works with 'scan' and 'data' commands (which
implies 'pause') for results

See message #1219 for definition of gamma AKA S11


 

Tks Oristo,
When a command no longer serves a purpose, like "gamma", why is it still in firmware taking up valuable space? Just a rhetorical question.

Regards,

- Herb


 

On Thu, Oct 24, 2019 at 12:38 AM, hwalker wrote:


When a command no longer serves a purpose, like "gamma", why is it still in
firmware taking up valuable space?
These are debug commands, used to debug the code. Just ignore it :)


 

When a command no longer serves a purpose, like "gamma", why is it still in firmware taking up valuable space?
'gamma' is no longer standalone in firmware that I use; neither in
help or from the shell.
Unrecognized text strings provoke the shell to echo with '?' appended
Probably only the shell handling changed when it moved to a 'sample' option.
I have yet to do experiments for whether/how 'sample gamma' behaves
differently from e.g. default data.


 

Hi Herb,I'm slowly updating the console commands as I get expanded info on how they function.?Are you referring to my pdf ot Oristo's wiki page?
Larry



On Wed, 23 Oct 2019 at 4:14 PM, hwalker<herbwalker2476@...> wrote: Oristo,
I'm slowly working my way through understand all the Wiki shellcommands.? A couple of the consolecommands aren't clear to me and I was hoping you might be able to help.

1.? dump - Prints output buffer.? What exactly is in the output buffer?? I've haven't? been able to corelate the returned numbers.

2. The "trace" command returns the following example data:

['0 LOGMAG CH0 1.000000000 7.000000000', '1 LOGMAG CH1 1.000000000 7.000000000', '2 SMITH CH0 1.000000000 0.000000000', '3 PHASE CH1 1.000000000 4.000000000']

What are the two numbers that follow the channel number?

I was also going to ask about the "gamma" command and its use but I see you have a question mark in the description field, so I assume its use is not defined.

-Tks


 

On Wed, Oct 23, 2019 at 03:00 PM, Oristo wrote:


When a command no longer serves a purpose, like "gamma", why is it still in
firmware taking up valuable space?

'gamma' is no longer standalone in firmware that I use; neither in
help or from the shell.
Unrecognized text strings provoke the shell to echo with '?' appended
Probably only the shell handling changed when it moved to a 'sample' option.
I have yet to do experiments for whether/how 'sample gamma' behaves
differently from e.g. default data.
----------------------------------------------------------------------------------------------------------------------------------------------------

Hi Larry,
Yes I was referencing your Wiki console commands PDF. I couldn't think of a use case for some of the commands such as "gamma". After reading the replies from Oristo and QRP, it seems some commands such as "dump" are there for housekeeping and debugging purposes and otherwise do not return useful information to a casual script writer.

Trying to decipher the proper syntax and format of the returned data gives me a better understanding of how much work it must have been for you and Oristo to generate the Wiki page.

Regards,

- Herb


 

how much work it must have been for you and Oristo to generate the Wiki page.
I made only minor shellcommands tweaks before adding Erik's info today;
hard work was by Larry and Buck Calabro, and Larry's PDF my preferred reference.
I mostly update that Wiki page just to reduce misunderstandings;
its table format seems to me not ideal for the purpose;
multi-line descriptions have confusing line spacing.


 

On Wed, Oct 23, 2019 at 11:14 PM, hwalker wrote:


1. dump - Prints output buffer. What exactly is in the output buffer?
dump command returns buffer with audio data received from audiocodec.This is ADC output of SA602 mixers


What are the two numbers that follow the channel number?
first number is a scale of trace, see menu DISPLAY => SCALE/DIV

second number is a refpos of trace, see menu DISPLAY => REFERENCE POSITION

it returns these two numbers.


 

A couple of the consolecommands aren't clear to me
Join the club!
... Wiki page .. table format seems to me not ideal
Draft nanoVNA shell [ab]user guide list - in order returned by shell 'help'
mostly tested on NanoVNA-Q-usb-test.dfu
Some functions are possible or easier by shell commands?than screen menus,
while others are unique. Listing includes questions and complaints:

help - response is as poorly organized as screen menus
exit - unique; restarts shell; inapplicable to screen menu
? ? ? ? ?( although it might be nice to have a screen reset menu option)
info - comparable to lower part of CONFIG-VERSION
threads - unique, but mostly useful for firmware development
version - comparable to one line in CONFIG-VERSION
reset - comparable to device power off/on; a waste IMO
? ?but may be useful for apps that get lost..
reset dfu - comparable to CONFIG-DFU
? ?also IMO a waste, given DFU may require hardware jumper
? ?when firmware configuration is corrupted.
freq - comparable to STIMULUS-CW FREQ, in theory
? a waste IMO; why not just `sweep` with one point?
? My testing discovered no use for it...
? 'frequencies' after still returns 101 values in sequence...??!!
offset - unique; I suppose this sets IF (stimulus - LO)
? ? ? /g/nanovna-users/message/2597
time - unique; perhaps useful for timing other commands?
? but less useful for that than e.g. linux time(1)
dac - unique; seemingly not associated with ADC gain for DSP ? ?
? ? >>perhaps<< ?it may be related to touchscreen calibration ??
saveconfig comparable to CONFIG-SAVE
clearconfig unique; claimed to clear ALL (e.g. cal, touchscreen) settings..
data - with no args, scatter inphase and quadrature [for current port?]
? ? ? ?- with args 0-6 "internal calibration table"
frequencies - unique alternative to TRACE display for current 'sweep'
? ? ?or (if pause) 'scan' setting; needed for building Touchstone files.
stat - unique; returns firmware developer stats
gain - unique; sets but does not return tlv320aic3204 ADC gains
power - unique; sets but does not return Si5351A output level
sample - unique; (partly) presumably works with 'port'
? ? appears broken in my firmware, always returns usage when passed options??
scan - unique; like sweep, but for pause
scanraw - unique; like scan, but more options:
? ? {channel(0|1)} {start(Hz)} {step(Hz)} {count} [average]
sweep - comparable to STIMULUS; sets and returns
test - unique, dead? watch this space - developers??
touchcal - comparable to CONFIG-TOUCH CAL
touchtest - comparable to CONFIG-TOUCH TEST
pause - comparable to STIMULUS-PAUSE SWEEP
resume - comparable to unsetting STIMULUS-PAUSE SWEEP
? ? ?IMO, ?'pause' should have 'on' ?'off' options
cal - comparable to CAL, but what is 'in' option
save - comparable to CAL-SAVE
recall - comparable to RECALL
trace - comparable to TRACE; returns, but does not set, options:
? ?TRACE0-4 FORMAT CH0-1 scale offset
edelay - comparable to DISPLAY-SCALE-ELECTRICAL DELAY
? ? ? ? ? which IMO is crazy to be under DISPLAY,
? ? ? ? ? because I suppose edelay are associated with CAL..?
marker - comparable to MARKER, except actually usable
? ? ? ? ?set marker number and index,
? ? ? ? ?returns active marker numbers, indices and frequencies
capture - unique; currently broken for my python scripts, since not ASCII;
? ? ? ? returns display buffer in some(??) bitmap format.
vbat - unique; comparable to CONFIG-VERSION bottom line
? ? ? ? IMO waste of space; should be in info..
transform - comparable to DISPLAY-TRANSFORM
? ? ?don't know why here; does shell return TDR data? How??
threshold - unique; sets frequency for switching to Si5351A harmonics

dump - unique; deprecated ?or disabled
? ? ? returns buffer with audio data from is ADC output of SA602 mixers


 

11:04am #5728
Oristo wrote:

Draft nanoVNA shell [ab]user guide list - in order returned by shell 'help' ¡­..

-----------------------------------------------------------------------
Some comments regarding the draft :

time - unique; perhaps useful for timing other commands? but less useful for that than e.g. linux time(1)

[per NanoVNA_Console_Commands_Oct-24-19a.pdf: Cannot be set, it is the Linux "time" command - Useful only if you have a RTC in the system]
- Do Linux and MAC systems have a RTC? Don't believe many windows systems do (industrial maybe?).

dac - unique; seemingly not associated with ADC gain for DSP. >>perhaps<< it may be related to touchscreen calibration ??

[per NanoVNA_Console_Commands_Oct-24-19a.pdf: It seems to set the output voltage of an analog output of the STM uP]
- Is this used internally to control a voltage controlled oscillator (VCO) or voltage controlled amplifier (VCA)?

data - with no args, scatter inphase and quadrature [for current port?] With args 0-6 "internal calibration table"
- "data 0" seems to return s-params for port 0 and "data 1" for port 1. Not specified what " Data 2-6" return.

capture - unique; currently broken for my python scripts, since not ASCII; returns display buffer in some(??) bitmap format.
- QRP seems to have gotten this working in his latest NanoVNA-Sharp branch with latest -Q firmware. May someone can
translate the C-Sharp code for dealing with the returned image data to Python.

vbat - unique; comparable to CONFIG-VERSION bottom line. IMO waste of space; should be in info..
- It would be informative if "vbat" and any other new commands added since the original Aug retail release included a blurb showing which firmware versions are required (i.e. 2.3.1+). Would also short circuit the inevitable, "I don't see that command on my NanoVNA." In the special case where additional hardware, such as the diode for vbat, that info would also be useful.

Regards,

-Herb


 

On Fri, Oct 25, 2019 at 11:41 PM, hwalker wrote:


capture - unique; currently broken for my python scripts, since not ASCII;
returns display buffer in some(??) bitmap format.
- QRP seems to have gotten this working in his latest NanoVNA-Sharp branch
with latest -Q firmware.
Wrong information. capture command is not unique, it is available in all firmware versions, except these which is very-very old, completely outdated with a bunch of bugs.

If you're still using so ancient and buggy firmware, I strongly recommend to update. You will get significant improvements.


 

Hi QRP -

capture - unique; currently broken for my python scripts, since not ASCII;
returns display buffer in some(??) bitmap format.
- QRP seems to have gotten this working in his latest NanoVNA-Sharp branch
with latest -Q firmware.
Wrong information. capture command is not unique, it is available in all
firmware versions, except these which is very-very old,
completely outdated with a bunch of bugs.
Sorry, key part of message was: "broken for my python scripts, since not ASCII"

- problem is in >>MY<< Python code, NOT firmware

- I need to add some Python that correctly handles 'capture' response,
e.g. from :

def capture(self):
from PIL import Image
self.send_command("capture\r")
b = self.serial.read(320 * 240 * 2)
x = struct.unpack(">76800H", b)
# convert pixel format from 565(RGB) to 8888(RGBA)
arr = np.array(x, dtype=np.uint32)
arr = 0xFF000000 + ((arr & 0xF800) >> 8) + ((arr & 0x07E0) << 5) + ((arr & 0x001F) << 19)
return Image.frombuffer('RGBA', (320, 240), arr, 'raw', 'RGBA', 0, 1)


 

Hi Herb -

Thanks for reviewing

Some comments regarding the draft :
Some further comments

"time" command - Useful only if you have a RTC in the system
I think their point was that some nanoVNA >>may<< wire in a Real Time Clock.
IMO, firmware anticipating hardware is doomed, but perhaps RTC was in some prototype..
Meanwhile, linux/msys time(1) utility is handy for measuring nanoVNA USB shell command response
e.g. by my Python scripts.

dac - unique; seemingly not associated with ADC gain for DSP.
It seems to set the output voltage of an analog output of the STM uP
Agreed, but STM32F072CBT6 PA4 and PA5 "DAC_FC" appear unconnected:
/g/nanovna-users/attachment/4059/0/NanoVNA%20Schematic.pdf


data - with no args, scatter inphase and quadrature [for current port?]
- "data 0" seems to return s-params for port 0 and "data 1" for port 1.
My >>guess<< was that data 0-1 returned "internal calibration table" for S11, S21
while 2-6 error terms are respectively: directivity, source match, reflection tracking, transmission tracking, isolation

I will be testing 'data' with 'port' vs 'data 0' and 'data 1' vs interactions with related screen menu settings


 

data 0 returns S11 (all in complex format)
data 1 returns S21
data 2-6 returns the 4 internal calibration tables

dac was used by edy555 to calibrate the SI5351 frequency by setting a vxco, hugen did not copy that part of the design so the vxco was replaced by a xco


 

I need to add some Python that correctly handles 'capture' response,
e.g. from
My first "working" script gets screen colors wrong:



$ python screenV.py
screenV.py: PNG filename (without .png) expected
$ python screenV.py foo
$ ls -l foo.png
-rw-r--r-- 1 ormpoa None 9759 Oct 26 10:35 foo.png


 

erik@...> wrote:

data 0 returns S11 (all in complex format)
data 1 returns S21
data 2-6 returns the 4 internal calibration tables
-----------------------------------------------------------------------------------

Erick,
Does that mean that the data returned by "scanraw" can be corrected by applying the applicable data returned by "data 2-6" ?

- Herb


 

In my view scanraw should return raw readings (as it does) and BOTH S11 and S21 instead of currently EITHER S11 or S21
and yes, if you do not want to do your own calibration you can use the internal calibration data.
but I do not know how to find out on what frequency range the calibration data was generated


 

Oristo wrote:

My first "working" script gets screen colors wrong:

-
---------------------------------------------------------------------------------

The screen capture command, in addition to tdr and battery display, is another good reason for upgrading to the latest firmware. Your script works as advertised, including wrong colors :)

Notes:
1. Edit the line port = 'COM3' , if required, to the serial the NanoVNA is attached to.
2. I believe the capture command is only applicable to firmware versions 0.2.3 and higher.

- Herb


 

first "working" script gets screen colors wrong:
Update corrects colors (endian was wrong):



Notes:
1. Edit the line port = 'COM3' , if required
2. I believe the capture command is applicable to firmware versions >= 0.2.3