You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* documentation for original command usage and library functions
13
13
* examples for basic functionality
14
+
* some Debian-flavored Linux testing
14
15
15
16
Working on it:
16
17
* filling in unfinished args and any new tinySA features
17
18
* scan and scanraw occasionally throw back bad data. handled in an example, but actual fix in progress
18
19
* trigger needs more alias funcs to cover full functionality
20
+
* scanraw serial FROM DEVICE issues with the buffer. This is being explored see Example #3 in [Plotting Data with Matplotlib](#plotting-data-with-matplotlib) for details.
19
21
* An argparse option + some example scripts
20
22
* Beginner notes, vocab, and some examples for common usage
21
23
@@ -84,16 +86,19 @@ numpy
84
86
pandas
85
87
matplotlib
86
88
pillow
89
+
pyQt5
87
90
88
91
```
89
92
90
93
For anyone unfamiliar with using requirements files, or having issues with the libraries, these can also be installed manually in the terminal (we recommend a Python virtual environment) with:
`pyQt5` is used with `matplotlib` to draw the figures. It needs to be installed in Linux systems to follow the examples included in tinySA_python, but is not needed on all Windows machines.
101
+
97
102
98
103
99
104
## Library Usage
@@ -120,7 +125,7 @@ Some error checking includes:
120
125
121
126
## Example Implementations
122
127
123
-
This library has been tested on Windows, but not yet on Unix systems. The primary difference should be the format of the serial port connection, but there may be smaller bugs in format that have not been detected yet.
128
+
This library was developed on Windows and has been lightly tested on Linux. The main difference (so far) has been in the permissions for first access of the serial port, but there may be smaller bugs in format that have not been detected yet.
124
129
125
130
### Finding the Serial Port
126
131
@@ -142,14 +147,18 @@ from src.tinySA_python import tinySA
142
147
# create a new tinySA object
143
148
tsa = tinySA()
144
149
150
+
# set the return message preferences
151
+
tsa.set_verbose(True) #detailed messages
152
+
tsa.set_error_byte_return(True) #get explicit b'ERROR' if error thrown
153
+
154
+
145
155
# attempt to autoconnect
146
156
found_bool, connected_bool = tsa.autoconnect()
147
157
148
158
# if port found and connected, then complete task(s) and disconnect
149
-
if connected_bool ==True: # or if success == True:
159
+
if connected_bool ==True:
150
160
print("device connected")
151
-
tsa.set_verbose(True) #detailed messages
152
-
tsa.set_error_byte_return(True) #get explicit b'ERROR' if error thrown
161
+
153
162
msg = tsa.get_device_id()
154
163
print(msg)
155
164
@@ -195,9 +204,37 @@ Port: COM10, Description: USB Serial Device (COM10), Hardware ID: USB VID:PID=04
This method identified the `/dev/ttyACM0`. Now, when attempting to use the autoconnect feature, the following error was initially returned:
228
+
229
+
```python
230
+
[Errno 13] could notopen port /dev/ttyACM0: [Errno 13] Permission denied: '/dev/ttyACM0'
231
+
199
232
```
200
233
234
+
This was due to not having permission to access the port. In this case, this error was solved by opening a terminal and executing `sudo chmod a+rw /dev/ttyACM0`. Should this issue be persistent, other solutions related to user groups and access will need to be investigated.
235
+
236
+
237
+
201
238
202
239
### Serial Message Return Format
203
240
@@ -227,6 +264,11 @@ from src.tinySA_python import tinySA
227
264
# create a new tinySA object
228
265
tsa = tinySA()
229
266
267
+
# set the return message preferences
268
+
tsa.set_verbose(True) #detailed messages
269
+
tsa.set_error_byte_return(True) #get explicit b'ERROR' if error thrown
270
+
271
+
230
272
# attempt to connect to previously discovered serial port
231
273
success = tsa.autoconnect()
232
274
@@ -239,6 +281,7 @@ else:
239
281
tsa.disconnect()
240
282
241
283
```
284
+
242
285
Example output for this method is as follows:
243
286
244
287
```python
@@ -313,16 +356,20 @@ from src.tinySA_python import tinySA
313
356
314
357
# create a new tinySA object
315
358
tsa = tinySA()
359
+
360
+
# set the return message preferences
361
+
tsa.set_verbose(True) #detailed messages
362
+
tsa.set_error_byte_return(True) #get explicit b'ERROR' if error thrown
363
+
364
+
316
365
# attempt to connect to previously discovered serial port
317
366
success = tsa.autoconnect()
318
367
319
368
# if port open, then complete task(s) and disconnect
tsa.set_error_byte_return(True) #get explicit b'ERROR' if error thrown
625
+
626
+
563
627
# attempt to autoconnect
564
628
found_bool, connected_bool = tsa.autoconnect()
565
629
566
630
# if port closed, then return error message
567
631
if connected_bool ==False:
568
632
print("ERROR: could not connect to port")
569
633
else: # if port found and connected, then complete task(s) and disconnect
570
-
# detailed messages turned on
571
-
tsa.set_verbose(True)
572
-
# set scan values
634
+
573
635
# set scan values
574
636
start =int(1e9) # 1 GHz
575
637
stop =int(3e9) # 3 GHz
576
638
pts =450# sample points
577
639
outmask =2# get measured data (y axis)
640
+
578
641
# scan
579
642
data_bytes = tsa.scan(start, stop, pts, outmask)
580
643
@@ -609,6 +672,16 @@ This example uses `scan()` and `scanraw()` to take a data measurement of data th
609
672
610
673
Extra processing needs to be done to get `dBm power` from `scanraw()`.
611
674
675
+
676
+
NOTE FOR LINUX USERS: the serial read with SCANRAW is finicky. It's also ONLY with this function on Linux. Reading the serial buffer after SCANRAW failed in several situations:
677
+
1. Requesting data too quickly after the last read
678
+
* Expected, as the tinySA needs to resume and re-measure.
679
+
2. Requesting data when the screen is frozen
680
+
* Mildly expected, user error can trigger this too. Turns out in some situations, the frozen screen is not the same as a `pause`, and there is no data to flush from the buffer because no more data has been taken. This is either a safe error state, a feature of how SCANRAW works, or potentially a bug with the device/firmware/this library. Using the `resume()` function after this will restart measurements.
681
+
3. {UNKNOWN}. There are several conditions that can cause issues, but it's unclear what 'symptoms' go to which problems
682
+
* On the first few reads after the tinySA has been turned on and operational for at least 1 minute.
683
+
* After sitting unused for more than a few minutes the returned buffer is < 50% the expected size or more than 5x the expected size. This is AFTER the flush command.
print("SCANRAW did not return the expected amount of data for the read")
707
817
708
818
```
709
819
<palign="center">
@@ -725,20 +835,26 @@ from src.tinySA_python import tinySA
725
835
726
836
# create a new tinySA object
727
837
tsa = tinySA()
838
+
839
+
# set the return message preferences
840
+
tsa.set_verbose(True) #detailed messages
841
+
tsa.set_error_byte_return(True) #get explicit b'ERROR' if error thrown
842
+
843
+
728
844
# attempt to autoconnect
729
845
found_bool, connected_bool = tsa.autoconnect()
730
846
731
847
# if port closed, then return error message
732
848
if connected_bool ==False:
733
849
print("ERROR: could not connect to port")
734
850
else: # if port found and connected, then complete task(s) and disconnect
735
-
# detailed messages turned on
736
-
tsa.set_verbose(True)
851
+
737
852
# set scan values
738
853
start =150e6# 150 MHz
739
854
stop =200e6# 200 MHz
740
855
pts =450# for tinySA Ultra
741
856
outmask =1# get measured data (y axis)
857
+
742
858
# scan
743
859
data_bytes = tsa.command("scan 150e6 200e6 5 2")
744
860
@@ -1437,7 +1553,7 @@ Marker levels will use the selected unit Marker peak will activate the marker (i
1437
1553
### **scanraw**
1438
1554
***Description:** Performs a scan of unlimited amount of points and sends the data in binary form
1439
1555
***Original Usage:**`scanraw {start(Hz)} {stop(Hz)} [points][option]` or `scanraw {start(Hz)} {stop(Hz)} [points] [unbuffered]` depending on the source
1440
-
***Direct Library Function Call:**
1556
+
***Direct Library Function Call:**`scan_raw(start=Int|Float, stop=Int|Float, pts=Int|Float, unbuf=1)`
0 commit comments