Keyboard Shortcuts
Likes
- Tinysa
- Messages
Search
Re: Mesure IMD with Two Tone and TinySA Ultra
Which brings up a good point.? When testing for weak signals such as IMD you should first look for the strongest signal that your device will be exposed to.? That includes other signals that may be present at the location you are at.? My Anritsu Sitemaster and Cellmaster both alert me with a tone to warn me that a high level signal above it's allowable level is present.? This may be a high powered FM or TV station at the site.? Also, you may be tempted to reduce attenuation to be able to see the IMD, only to allow another signal to cause damage to your device.
toggle quoted message
Show quoted text
Joe, K1ike On 1/5/2025 4:19 AM, MaxPi via groups.io wrote:
Firstly, 100 watts is 50 dBm, so the output power after your attenuator (50dBm - 40dB = 10dBm) will exceed the permitted 6 dBm for the TinySA. Although I would highly recommend not to exceed 0dBm at the input, for all signals including harmonics. |
Re: Issues with TinySA USB Connection in C#
I have this verion of TinySAUltra
?
tinySA4_v3.1.1-0-g216dfe30
HW Version:V0.4.5.1 ?
I created this script which use this Python class for the tinySA Ultra at??.
import time import datetime
import TinySAModule
def start_server():
? ?
? ? device = TinySAModule.tinySA()
? ? device.open()
? ? version = device.get_version()
? ? print(version)
? ? run_server(device)
def run_server(device):
? ? i = 0
? ? while True:
? ? ? ? try:
? ? ? ? ? ? i=i+1 ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? freq_data = device.get_freq_data()
? ? ? ? ? ? time.sleep(0.2)
? ? ? ? ? ? data1= device._data(1)
? ? ? ? ? ? time.sleep(0.2)
? ? ? ? ? ? data2= device._data(2)
? ? ? ? ? ? time.sleep(0.2)
? ? ? ? ? ? marker = device.get_marker_value()
? ? ? ? ? ? time.sleep(0.2)
? ? ? ? ? ?
? ? ? ? ? ? timestamp = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") ? ? ? ? ? ?
? ? ? ? ? ? print(f"{timestamp}: {i}: {marker} ")
? ? ? ? ? ?
? ? ? ? ?
? ? ? ? except Exception as e:
? ? ? ? ? ? print(f"An error occurred: {e}")
? ? ? ? ? ? device._send_command("reset\r")
? ? ? ? ? ? print(f"reseted")
? ? ? ? ? ? run_server(device) ? ? ? ? ?
if __name__ == "__main__":
? ? start_server()
After few iterations I get this error 2025-01-07 14:44:08: 51: (-56.9, 2412312214.0)?
An error occurred: could not convert string to float: '1 236 2412310036 -5.67e+01' reseted An error occurred: Write timeout Traceback (most recent call last): ? File "C:\Source\TinyPyton\TinySAServer1.py", line 19, in run_server ? ? freq_data = device.get_freq_data() ? File "C:\Source\TinyPyton\TinySAModule.py", line 240, in get_freq_data ? ? return self._fetch_frequencies() ? ? ? ? ? ?~~~~~~~~~~~~~~~~~~~~~~~^^ ? File "C:\Source\TinyPyton\TinySAModule.py", line 129, in _fetch_frequencies ? ? x.append(float(line)) ? ? ? ? ? ? ?~~~~~^^^^^^ ValueError: could not convert string to float: '1 236 2412310036 -5.67e+01' During handling of the above exception, another exception occurred:
Traceback (most recent call last):
? File "C:\Source\TinyPyton\TinySAServer1.py", line 19, in run_server ? ? freq_data = device.get_freq_data() ? File "C:\Source\TinyPyton\TinySAModule.py", line 240, in get_freq_data ? ? return self._fetch_frequencies() ? ? ? ? ? ?~~~~~~~~~~~~~~~~~~~~~~~^^ ? File "C:\Source\TinyPyton\TinySAModule.py", line 124, in _fetch_frequencies ? ? self._send_command("frequencies\r") ? ? ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ ? File "C:\Source\TinyPyton\TinySAModule.py", line 81, in _send_command ? ? self.serial.write(cmd.encode()) ? ? ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^ ? File "C:\Users\User\AppData\Local\Programs\Python\Python313\Lib\site-packages\serial\serialwin32.py", line 325, in write ? ? raise SerialTimeoutException('Write timeout') serial.serialutil.SerialTimeoutException: Write timeout During handling of the above exception, another exception occurred:
Traceback (most recent call last):
? File "C:\Source\TinyPyton\TinySAServer1.py", line 42, in <module> ? ? start_server() ? ? ~~~~~~~~~~~~^^ ? File "C:\Source\TinyPyton\TinySAServer1.py", line 11, in start_server ? ? run_server(device) ? ? ~~~~~~~~~~^^^^^^^^ ? File "C:\Source\TinyPyton\TinySAServer1.py", line 39, in run_server ? ? run_server(device) ? ? ~~~~~~~~~~^^^^^^^^ ? File "C:\Source\TinyPyton\TinySAServer1.py", line 37, in run_server ? ? device._send_command("reset\r") ? ? ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^ ? File "C:\Source\TinyPyton\TinySAModule.py", line 83, in _send_command ? ? _ = self.serial.readline() ?# discard empty line ? File "C:\Users\User\AppData\Local\Programs\Python\Python313\Lib\site-packages\serial\serialwin32.py", line 275, in read ? ? raise SerialException("ClearCommError failed ({!r})".format(ctypes.WinError())) serial.serialutil.SerialException: ClearCommError failed (PermissionError(13, 'The device does not recognize the command.', None, 22)) |
Re: Issues with TinySA USB Connection in C#
On Mon, Jan 6, 2025 at 08:36 AM, <voloshyn.v.v@...> wrote:
I tried to implement the same behavior using this Python script: . I created a small script and ran it, but it stopped working after a few hundred operation. That's surprising.? Python's serial port driver is much better implemented than the one for C#.? Both NanoVNASaver and QtTinySA are robust applications using Python and I have not heard of similar problems using them for long term operations.
?
Try this Python class for the tinySA Ultra at .
It appears well written with additional delays for read and write operations, and is based on the NanoVNASaver serial port script.?
?
Herb |
Re: Issues with TinySA USB Connection in C#
I tried to implement the same behavior using this Python script: . I created a small script and ran it, but it stopped working after a few hundred operation.?
?
import time
import TinySAModule
def start_server():
? ?
? ? nv = TinySAModule.tinySA()
? ? print("Connecting to TinySA...")
? ?
? ? i = 0
? ? try:
? ? ? ? while True:
? ? ? ? ? ? i=i+1
? ? ? ? ? ? print(i)
? ? ? ? ? ?
? ? ? ? ? ? nv.send_command("frequencies\r")
? ? ? ? ? ? frequencies = nv.fetch_data() ?
? ? ? ? ? ? time.sleep(0.2)
? ? ? ? ? ? nv.send_command("data 1\r")
? ? ? ? ? ? data1 = nv.fetch_data()
? ? ? ? ? ? time.sleep(0.2)
? ? ? ? ? ? nv.send_command("data 2\r")
? ? ? ? ? ? data2 = nv.fetch_data()
? ? ? ? ? ? time.sleep(0.2)
? ? ? ? ? ? nv.send_command("marker 1\r")
? ? ? ? ? ? marker = nv.fetch_data()
? ? ? ? ? ? time.sleep(0.2)
? ? ? ? ?
? ? ? ? ? ? packet = f"{frequencies},{data1},{data2},{marker}\n" ? ? ? ? ? ? ? ? ?
? ? except KeyboardInterrupt:
? ? ? ? print("Server stopped.")
? ? except Exception as e:
? ? ? ? print(f"An error occurred: {e}")
? ? finally: ? ? ?
? ? ? ? nv.disconnect()
? ? ? ? nv.close()
? ? ? ?
if __name__ == "__main__":
? ? start_server()
?
It looks strange because when I send only the 'marker 1' command from the C# program, it worked for a few days without stopping.
?
|
Re: Mesure IMD with Two Tone and TinySA Ultra
Hi:
?
As noted elsewhere, you'll need more attenuation in a form that can handle the power. I usually start my test chain with a 50db 100 watt attenuator and then add others as needed.
?
The neat built in function in the TinySA is really useful, but most amateur (and commercial) radio specifications for IMD are described in terms of the individual distortion components and how far below the "carrier" level they are in "dbc" the worst ones are - you may still need to examine the spectrum manually to determine the numbers you want.
?
The ARRL has a document describing how they conduct these measurements in their review labs and this is the usual way of arriving at the numbers used in their IMD measurements. It's important to set up the levels correctly for the tests.
?
?
I also have a number of short videos about doing this with other equipment (since the time the original TinySA lacked the resolution for doing this using the ARRL specs), but they might still be of some help in understanding the overall process.
?
?
hopefully this is not confusing the issue...
?
M
?
? |
Re: Issues with TinySA USB Connection in C#
On Sun, Jan 5, 2025 at 04:18 AM, <voloshyn.v.v@...> wrote:
The Issue: AI suggested the following:
?
1. **Concurrency Issue**: In the `Loop` method, `UsbService.SendCommandAsync("data 1")` and `UsbService.SendCommandAsync("data 2")` are called without awaiting them. This can lead to concurrency issues if these methods depend on shared resources. You should await these calls if you need their results before proceeding.
?
2. **Potential Deadlock**: The `Loop` method is an `async void` method, which is generally discouraged because it can lead to unhandled exceptions and is difficult to test. It should be changed to `async Task` if possible.
?
I tried your code after making the above suggestions but received the same results as you after 1046 iterations:
?
1035: 1 59 105081195 -4.43e+01
1036: 1 59 105110615 -4.43e+01 1037: 1 59 105067198 -4.48e+01 1038: 1 59 105085882 -4.43e+01 1039: 1 59 105086859 -4.43e+01 1040: 1 59 105088229 -4.48e+01 1041: 1 59 105088229 -4.48e+01 1042: 1 59 105062300 -4.48e+01 1043: 1 59 105085374 -4.48e+01 1044: 1 59 105074980 -4.48e+01 1045: 1 59 105085882 -4.53e+01 1046: 1 59 105104794 -4.48e+01 Error: Read operation timed out. Error: Read operation timed out. Error: Read operation timed out. Error: Read operation timed out. Error: Read operation timed out. Error: Read operation timed out.? ------------------------------------------------------------------------------
using?RJCP.IO.Ports;
void?Main() { ????Loop().Wait();?//?Ensure?the?loop?is?awaited } //?Assuming?these?are?defined?elsewhere string?PortName?=?"COM5"; int?BaudRate?=?9600; SemaphoreSlim?_sendCommandSemaphore?=?new?SemaphoreSlim(1,?1); bool?_isRunning?=?true; ILogger?Logger?=?new?ConsoleLogger();?//?Example?logger?implementation SerialPortStream?CreateSerialPort(string?portName,?int?baudRate) { ????return?new?SerialPortStream(portName,?baudRate) ????{ ????????Parity?=?Parity.None, ????????StopBits?=?StopBits.One, ????????DataBits?=?8, ????????WriteTimeout?=?500, ????????//ReadTimeout?=?10000, ????????ReadTimeout?=?50000, ????????Handshake?=?Handshake.None ????}; } public?async?Task<string>?SendCommandAsync(string?command) { ????await?_sendCommandSemaphore.WaitAsync(); ????try ????{ ????????using?(var?serialPortStream?=?CreateSerialPort(PortName,?BaudRate)) ????????{ ????????????if?(!serialPortStream.IsOpen) ????????????{ ????????????????serialPortStream.Open(); ????????????} ???????????? ????????????command?+=?"\r"; ????????????byte[]?commandBytes?=?Encoding.ASCII.GetBytes(command);???????????????????? ???????? ????????????serialPortStream.Write(commandBytes,?0,?commandBytes.Length); ????????????string?echoResponse?=?ReadUntil(serialPortStream,?"\r"); ???????????? ????????????if?(echoResponse.Trim()?==?command.Trim()) ????????????{???????????????????? ????????????????string?data?=?ReadUntil(serialPortStream,?"ch>"); ????????????????data?=?data.TrimEnd("\r\nch>".ToCharArray()); ????????????????return?data; ????????????} ????????????else ????????????{ ????????????????string?errorStr?=?$"Unexpected?echo?response:?{echoResponse}"; ????????????????Logger.Log(errorStr); ????????????????throw?new?InvalidOperationException(errorStr);?//?Throw?an?exception?for?unexpected?response ????????????}???????????????????? ????????} ????} ????finally ????{ ????????_sendCommandSemaphore.Release(); ????} } private?string?ReadUntil(SerialPortStream?serialPort,?string?terminator) { ????byte[]?buffer?=?new?byte[1];???????????? ????StringBuilder?responseBuilder?=?new?StringBuilder(); ????while?(true) ????{ ????????int?bytesRead?=?serialPort.Read(buffer,?0,?buffer.Length); ????????if?(bytesRead?>?0) ????????{ ????????????char?currentChar?=?(char)buffer[0]; ????????????responseBuilder.Append(currentChar); ????????????if?(responseBuilder.Length?>=?terminator.Length?&&? ????????????????responseBuilder.ToString().EndsWith(terminator)) ????????????{???????????????????????? ????????????????return?responseBuilder.ToString(); ????????????} ????????} ????????else ????????{ ????????????throw?new?TimeoutException("Read?operation?timed?out."); ????????} ????} } private?async?Task?Loop() { ????while?(_isRunning) ????{???????????????? ????????try ????????{ ????????????var?frequenciesString?=?await?SendCommandAsync("frequencies"); ????????????var?dataList1?=?await?SendCommandAsync("data?1"); ????????????var?dataList2?=?await?SendCommandAsync("data?2"); ????????????var?marker?=?await?SendCommandAsync("marker?1"); ???????????? ????????????//Console.WriteLine(frequenciesString); ????????????//Console.WriteLine(dataList2); ????????????Console.WriteLine(marker); ???????????? ????????} ????????catch?(Exception?ex) ????????{ ????????????Logger.Log($"Error:?{ex.Message}"); ????????} ???????? ????????await?Task.Delay(500);? ????} } //?Example?logger?implementation public?interface?ILogger { ????void?Log(string?message); } public?class?ConsoleLogger?:?ILogger { ????public?void?Log(string?message) ????{ ????????Console.WriteLine(message); ????} } ------------------------------------------------------------------------------
?
If I come across any additional information I will post it here. Herb
|
Re: ultra+ trigger options
Thanks for the answer.
?
Was hoping to leave the sa some distance and be alarmed by a beep when it captured something.?
Will try if the output can drive a small piezo speaker.
?
I did notice the 'armed' status message. It might be my logic, but since you have to manually re-arm the single trigger I sort of expected the screen to be cleared to the state at the moment you re-arm it. I work around it by briefly enabling 'auto' so no point, I was just curious if I misunderstood something.
( again, with the sa some distance I can visually determine of something new has been captured this way )
?
regards,
?
Henk
?
? |
Re: ultra+ trigger options
On Sun, Jan 5, 2025 at 04:28 AM, pa3cqn wrote:
Use headphone output Let me check Indeed intentional Left status panel shows ARMED after rearming
?
?
--
Designer of the tinySA For more info go to |
ultra+ trigger options
==
ZS406, oct 21 firmware
==
?
This firmware's trigger menu has some more options than explained in the wiki: beep, interval and autosave.
?
-Beep seems to not beep, or do you have to use headphones? Or is this for 407 hardware?
-interval blocks the UI, jogwheel as well as screen. You have to press for at least T-interval and release to get the menu to appear, and another T-interval to get to the interval input screen.
-re-arming single does not clear the screen. Might be intentional though.
?
Could not find any mentioning of this in the changelog other than that thes options were implemented.
?
Anyone have thoghts on this?
?
Regards?
?
Henk |
Re: Mesure IMD with Two Tone and TinySA Ultra
Use 30 dB extra attenuation between the -40 dB sniffer and the tinySA input
Set LEVEL/EXT GAIN to -70 dB
Use the MEASURE/OIP3 and enter the two test frequencies (in case of USB: 14245700 Hz and 14246900 Hz, do not use the decimal dot when entering frequencies)
and set the span to 25 kHz
?
?
--
Designer of the tinySA
For more info go to |
Re: Issues with TinySA USB Connection in C#
Let me provide more details about my setup. I have a SerialPortStream CreateSerialPort(string portName, int baudRate)
{ ? ? return new SerialPortStream(portName, baudRate) ? ? { ? ? ? ? Parity = Parity.None, ? ? ? ? StopBits = StopBits.One, ? ? ? ? DataBits = 8, ? ? ? ? WriteTimeout = 500, ? ? ? ? ReadTimeout = 10000, ? ? ? ? Handshake = Handshake.None ? ? }; } To send and receive commands, I use the following method: public async Task<string> SendCommandAsync(string command) ? Here’s the private string ReadUntil(SerialPortStream serialPort, string terminator) In my application, I run the following loop to receive data continuously: private async void Loop() ?
The Issue: |
Mesure IMD with Two Tone and TinySA Ultra
Hi Group, I'm an Ham Radio operator and I need to mesure the IMD for the modulation in SSB. I just built a two tone generator so I can inject 700hz and 1900hz at the same time to mesure the IMD but, I'm at my first steps with RF electonics and the TinySA Ultra. Does anybody can take me by the hand and tell my what setting I need to do with the TinySa Ultra in order to mesure the IMD.? Let's say for the test that I will? transmit at 14.245Mhz USB 100Watts in a dummy load. I built a RF sampler 40db attenuator so I can feed the TinySa without blowing it.? thanks? ?73 from VE2IBN (Canada). |