Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LiteVNA #534

Open
PA3CCE opened this issue Sep 3, 2022 · 24 comments
Open

LiteVNA #534

PA3CCE opened this issue Sep 3, 2022 · 24 comments
Labels
enhancement New feature or request

Comments

@PA3CCE
Copy link

PA3CCE commented Sep 3, 2022

Please add support for LiteVNA

@zarath
Copy link
Collaborator

zarath commented Sep 7, 2022

whatever that device will be...

@zarath zarath added the enhancement New feature or request label Sep 7, 2022
@DiSlord
Copy link
Contributor

DiSlord commented Sep 11, 2022

LiteVNA correct work on NanoVNA-Saver
LiteVNA use V2 protocol

@PA3CCE
Copy link
Author

PA3CCE commented Sep 11, 2022

@ Zarath
LiteVNA is a well known upgrade to NanoVNA.H/H4.
@ DiSlord
Thank you very much for the info, so the update will be very easy I suppose..

@PA3CCE
Copy link
Author

PA3CCE commented Sep 29, 2022

LiteVNA is recognized as NanoVNA V2, so just the name should be corrected.

@github-actions
Copy link

There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.
Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a 👍
Because this issue is marked as stale, it will be closed and locked in 7 days if no further activity occurs.
Thank you for your contributions!

@github-actions github-actions bot added the stale Long time no reaction, will be closed soon label Dec 29, 2022
@zarath zarath reopened this Jan 30, 2023
@github-actions github-actions bot closed this as completed Mar 2, 2023
@zarath zarath reopened this Mar 2, 2023
@zarath
Copy link
Collaborator

zarath commented Mar 2, 2023

@PA3CCE do you have a debug output of the detection.
Is it possible to distinguish it from V2 on protocoll level?

@PA3CCE
Copy link
Author

PA3CCE commented Mar 2, 2023

@DiSlord
May I redirect this question to you, being the author of the specific firmware ?
@zarath
The LiteVNA has a much wider frequency range then the V2 but it looks like this is no prblem for the -Saver.
Thank you both

@github-actions github-actions bot removed the stale Long time no reaction, will be closed soon label Mar 3, 2023
@PA3CCE
Copy link
Author

PA3CCE commented Mar 4, 2023

@zarath:: Another diference in LiteVNA to NanoVNA V2 is that the number of measurements in LiteVNA can be set in units, from 1 to 1024 included.
In that respect, see my errormessage #405 still pending !

@github-actions
Copy link

github-actions bot commented Jun 3, 2023

There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.
Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a 👍
Because this issue is marked as stale, it will be closed and locked in 7 days if no further activity occurs.
Thank you for your contributions!

@github-actions github-actions bot added the stale Long time no reaction, will be closed soon label Jun 3, 2023
@PA3CCE
Copy link
Author

PA3CCE commented Jun 3, 2023

Sorry, in the latest version the LiteVNA and it's settings still are not implemented !

@github-actions github-actions bot removed the stale Long time no reaction, will be closed soon label Jun 4, 2023
@Entropy512
Copy link

@zarath - I have a LiteVNA and might be able to work on this, however I have no familiarity with your specific codebase and what mechanisms you might already have for autodetection.

What do NanoVNA-V2 units report for the deviceVariant register? http://nanovna.com/wp-content/uploads/2021/11/LiteVNA_User-Guide.pdf page 25

@zarath
Copy link
Collaborator

zarath commented Aug 2, 2023

@Entropy512 it reports the same values in deviceVariant register as an original S-A-A-2. So this class of devices is indistinguishable by client software. The document even tell, that this was intended. :-/

So the problem is just the wrong type name in the device selector? Or isn't it detected because it differs in USB_ID?

@Entropy512
Copy link

Entropy512 commented Aug 8, 2023

It works, however it supports additional functionality not supported by the Nano (more than 101 sweep points per segment, although leveraging this would require some additional UI work beyond detecting the device as being different)

So it's kind of annoying that they intentionally made deviceVariant match another device - really???? :(

I'm still trying to figure out WHY it is happening, but for some reason, while the unit has no problem calibrating for 1001 points locally in the 5 GHz wifi band, for some reason, trying to do a cal in NanoVNA-Saver leads to really bogus results (like 4:1 VSWR from a dummy load at around 5.8 GHz) - I am wondering if this is due to the LiteVNA having native support for 6 GHz instead of using harmonics.

@PA3CCE
Copy link
Author

PA3CCE commented Aug 9, 2023

Yes indeed, the device connects to NanoVNA-Saver, but showing it being a V2 is not the biggest problem.
It works more or less using the V2 characteristics, but it has more and better functionalities.

@Entropy512
Copy link

Entropy512 commented Aug 9, 2023

Among other things (which I am wondering if it might be a contributor to some of the issues I'm seeing):

It looks like https://github.com/NanoVNA-Saver/nanovna-saver/blob/main/src/NanoVNASaver/Hardware/NanoVNA_V2.py will allow setting TX power when the frequency is below 3 GHz. However, that register (0x42) is used on the LiteVNA to set the TX power for the high-frequency oscillator. 0x41 is used for the low-freq oscillator. I don't recall at the moment where the unit switches between these two. I need to do some debug runs to see if this is actually coming into play with my issues in the 5 GHz wifi band.

If I'm reading/grepping things correctly, the sweep_max_freq_Hz variable does nothing on any device but the NanoVNA_V2, where it determines what frequencies Tx power can be set for?

@zarath
Copy link
Collaborator

zarath commented Aug 9, 2023

perhaps one with a liteVNA can checkout https://github.com/zarath/nanovna-saver/tree/feature/clock_detect
and do a debug output with nanovna-saver (-D debug.txt) and can attach the output on this discussion.
If the unix timer registers are readable it would be possible to distinguish the devices from the original ones.

@Entropy512
Copy link

Entropy512 commented Aug 9, 2023

Will try that later this week.

Also, by default, apparently the LiteVNA does not apply calibrations to USB output, which kinda conflicts with NanoVNA-Saver requiring that the instrument be locally calibrated.

Apparently there's an (undocumented in the manual) method to change this:
DiSlord/NanoVNA-App@a5328bf

The documentation is extremely poor and in some cases blatantly inaccurate, since for that register, the document merely states "Writing 1 switches USB data format to raw samples mode and leaves this protocol."

Edit: It appears that @DiSlord tries to distinguish between a NanoVNA V2 and a LiteVNA using the firmware version? DiSlord/NanoVNA-App@a5328bf - Although the code refers to this as a "V2 Lite" - different device????

@PA3CCE
Copy link
Author

PA3CCE commented Aug 9, 2023

Better ask Dislord indeed, he wrote the firmwares and knows all the ins and outs of the LiteVNA and the V2, he was so kind to make some adaptions into NanoVNA-APP!

@PA3CCE
Copy link
Author

PA3CCE commented Aug 9, 2023

@zarath
I would like to do so, but recently I "upgraded" from Windows10 to Windows11 and since then I have big problems with the serial communiication to several devices, thank you Microsoft !!
I have been working on it quite a while, but still no luck, sorry.

@DiSlord
Copy link
Contributor

DiSlord commented Dec 2, 2023

Here is how NanoVNA-App detect V2 device:
01.323 tx: requesting device variant
01.323 tx: 10 F0
01.324 rx: 02 .. DEVICE VARIANT OK
01.324 tx: requesting serial protocol version
01.325 tx: 10 F1
01.384 rx: 01 .. PROTOCOL VERSION OK
01.385 tx: requesting hw-revision and fw-version
01.385 tx: 10 F2 10 F3 10 F4
01.386 rx: 02 ..... HARDWARE REVISION
01.387 rx: 02 02 .. FIRMWARE VERSION

Register F0 contain device revision, always 0x02 for V2 series
Refister F1 contain protocol version, always contain 0x01

Next registers depend from device:
F2 - BOARD_REVISION
0x02 for V2, LiteVNA
0x03 for V2Plus
0x04 for V2Plus4

F3 - FW_MAJOR_VER
0x01 for V2, V2Plus, V2Plus4
0x02 for LiteVNA

F4 - FM_MINOR_VER
0x02 - for all V2, V2Plus, V2Plus4, LiteVNA

LiteVNA and V2Plus4 allow 65535 points over USB
V2, V2Plus only 1024

@DiSlord
Copy link
Contributor

DiSlord commented Dec 3, 2023

V2 Binary protocol:
V2 contain 256 registers for read/write

On write to registers data put to reg[address] and V2 grab data and process (depend from address)

All values after in hex format!!!!
Commands for read/write
0x0D - read version (return "2")
0x10 - read byte
0x11 - read word
0x12 - read dword
0x13 - read qword

0x18 - read measured data (use 30 address for count)

0x20 - write byte
0x21 - write word
0x22 - write dword
0x23 - write qword
0x28 - write buffer (next byte data size, and data)

address:
0x00 - (qword) start frequency
0x10 - (qword) frequency step
0x20 - (word) points count
0x22 - (word) values pre frequency (need set to 1)

0x26 - (byte) mode (0 - USB mode, 1 - send raw data, 2 - normal mode, 3 - send calibrated data)
0x30 - (byte) get data points count (bytw limit to 255, but for Lite possible set to 0 for get all measured points from point count)

0x40 - (byte) average
0x41 - (byte) si power
0x42 - (byte) adf power
0x44 - (byte) write channel select (1 - send only CH0 data, 2 send only CH1, any other - send both)

0x50 - (dword) color value
0x54 - (byte) color index (use H/H4 indexes)
0x58 - (dword) write set time in UNIX format
0x5C - (word) read battery value in millivolts

0xEE - (byte) any value, on write V2 send screenshot

0xD0 - (dword) SN[0] (serial number 0)
0xD4 - (dword) SN[1] (serial number 1)
0xD8 - (dword) SN[2] (serial number 2)

0xF0 - (byte) device variant (2 for V2)
0xF1 - (byte) protocol version (1 for V2)
0xF2 - (byte) board revision (2 for V2, 3 - V2Plus, 4 - V2Plus4)
0xF3 - (byte) firmware major (1 for all)
0xF4 - (byte) firmware minor

Example:
Set "average = 5" command:
20 - write byte
40 - address (average)
05 - value
Need send : 204005

Set color[7]=RRGGBB:
20 - write byte
54 - address (color index)
07 - value (7 index is LCD_TRACE_2_COLOR)
22 - write dword
50 - address (color value)
BB - color in RGB
GG - color in RGB
RR - color in RGB
00 -
Need send: 2054072250BBGGRR00

Read color from color[8]:
20 - write byte
54 - address (color index)
08 - value (8 index is LCD_TRACE_3_COLOR)
12 - read dword
50 - address (color value)
Need send: 2054081250
rx *00 fc 00 00
BB GG RR 00

@PA3CCE
Copy link
Author

PA3CCE commented Dec 7, 2023

My USB problem on windows 11 solved :
I found that Windows 11 is using the COM ports 4 and 7 for Bluetooth on my system (Windows 10 did not), this gives conflicts with previously installed USB devices. So I have to disconnect Bluetooth in Windows 11 settings, to be able to use these devices again. Very anoying !
@ Zarath
DiSlord has sent a lot of information (see above, thank you so much DiSlord), I hope, now you have all the information needed. to implement LiteVNA into NanoVNASaver.
Jos

@zarath
Copy link
Collaborator

zarath commented Dec 8, 2023

I'll have to find some time to implement it... Tomorrow the Dortmunder Flohmarkt has priority :-;

@PA3CCE
Copy link
Author

PA3CCE commented Jan 10, 2024

I sincerely hope you will find it, it would be highly appreciated.
Please note : This is no complaint !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants