Skip to content

Commit 1316489

Browse files
authored
Merge pull request #36 from tmytek/dev/update-tlkcore-v210
Dev/update tlkcore v210
2 parents 52a4376 + 558eeec commit 1316489

18 files changed

+80
-26
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
* TMYTEK general API for Windows/Linux platform.
44

5-
# Menu
5+
# Outline
66

77
* [Introduction](#introduction)
88
* [Latest Release & Examples](#latest-release--examples)
@@ -67,7 +67,7 @@ The **.pyd** format release is for Windows shared library and **.so** format rel
6767

6868
### Python 3
6969

70-
* Install Python *3.6 or 3.8 or 3.10* which mapping with [TLKCore_release](/release), and follow reference user guide of [Getting Started with Python Sample Code](/examples/Python/README.md) to make sure your Python environment first.
70+
* Install Python *3.6 or 3.8 / 3.10 / 3.12* which mapping with [TLKCore_release](/release), and follow reference user guide of [Getting Started with Python Sample Code](/examples/Python/README.md) to make sure your Python environment first.
7171

7272
### Communication environment
7373

examples/C_Cpp/examples/tlkcore_fbs.cpp

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,13 @@ int fpga_conftrol(tlkcore_lib::tlkcore_ptr service, std::string sn)
124124

125125
int set_ud_freq(tlkcore_lib::tlkcore_ptr service)
126126
{
127+
// Here is a example we set freq for ALL UD devices
128+
// PLEASE MODIFY for your purpose
127129
for (std::string sn : ud_list) {
128-
service->set_ud_freq(sn, 24e6, target_freq*1e6, 4e6);
130+
if (service->set_ud_freq(sn, 24e6, target_freq*1e6, 4e6) < 0)
131+
{
132+
return -1;
133+
}
129134
}
130135
return 0;
131136
}
@@ -146,9 +151,18 @@ int tmy_device_control()
146151

147152
// Please provide the device config file for lib scanning & init
148153
const std::string path = "config/device.conf";
149-
ptr->scan_init_dev(path);
154+
if (ptr->scan_init_dev(path) < 0)
155+
{
156+
printf("[Main] Scan & init device got failed!\r\n");
157+
return -1;
158+
}
150159

151-
set_ud_freq(ptr);
160+
// Set UD example
161+
if (set_ud_freq(ptr) < 0)
162+
{
163+
return -1;
164+
}
165+
// Set BBox example
152166
if (update_beam_config(ptr) < 0)
153167
{
154168
return -1;

examples/Python/README.md

Lines changed: 61 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
11
# Getting Started with Python Sample Code
22

3+
* Outline
4+
* [Prerequisites](#prerequisites)
5+
* [Introduction of main.py](#introduction-of-mainpy)
6+
* [Usage](#usage)
7+
* [Basic call flow](#basic-call-flow)
8+
* [startService()](#startservice)
9+
* [testBBox()](#testbbox)
10+
* [testUDBox()](#testudbox)
11+
* [FBS](#fbs)
12+
* [DFU](#dfu)
13+
* [Extra usage](#extra-usage)
14+
315
## Prerequisites
416

5-
1. Install Python *3.6 or 3.8 or 3.10*, the version must mapping with [TLKCore_release](/release)
17+
1. Check your Python version
18+
* Windows: `python -V`
19+
* Linux: `python3 -V`
20+
1. Install Python *3.6 or 3.8 / 3.10 / 3.12*, the version MUST mapping with [TLKCore_release](/release)
621
* Example gives a default libraries for *Python 3.8* ([python-3.8.10 64-bit download Link](https://www.python.org/downloads/release/python-3810))
722
* Remember to **allow** the option: `Add python.exe to PATH`
823

@@ -15,6 +30,18 @@
1530

1631
`pip install -r requirements.txt`
1732

33+
* [Hint-1] Under Ubuntu, please install pip
34+
* `sudo apt-get update`
35+
* `sudo apt install python3-pip`
36+
* [PEP-668](https://peps.python.org/pep-0668/)
37+
* [error: externally-managed-environment](https://askubuntu.com/questions/1465218/pip-error-on-ubuntu-externally-managed-environment-%C3%97-this-environment-is-extern)
38+
* `pip install --break-system-packages --user <username> -r requirements.txt`
39+
* [Hint-2] Under Windows, sometimes you might met the following error: ![cpp_build_tool](/images/Python_cpp_build_tools.png)
40+
* Please install [Microsoft Visual C++ Redistributable](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170#latest-microsoft-visual-c-redistributable-version)
41+
* [Hint-3] Python 3.12 user please modify parts of requirements.txt
42+
* psutil==6.1.0
43+
* ft4222==1.10.0
44+
1845
4. Create the new directory named **files** to target directory.
1946

2047
![files](/images/TLKCore_release_files.png)
@@ -38,6 +65,18 @@ optional arguments:
3865
--root ROOT The root path/directory of for log/ & files/
3966
```
4067

68+
#### example
69+
70+
* Windows
71+
72+
python main.py
73+
74+
75+
* Linux
76+
77+
python3 main.py
78+
79+
4180
### Basic call flow
4281

4382
* main() -> startService() -> testDevice() -> testXXX()
@@ -143,18 +182,14 @@ BW = 1e5
143182
service.setUDFreq(sn, LO, RF, IF, BW)
144183
```
145184

146-
## Commandline to run
147-
148-
python3 main.py
149-
150185
## FBS
151186

152187
This topic introduces TLKCore how to process FBS (Fast Beam Steering), it loads a readable beam configuration file, then generates a internal data structure, and converts to SPI signals to BBoxOne/Lite.
153188

154189
* TMYBeamConfig
155190
* It comes from *tlkcore.TMYBeamConfig.py* in the downloaded library package with source code.
156191

157-
* Beam configuration file, i.g. [CustomBatchBeams_D2230E058-28.csv](/examples/C_Cpp/examples/config/CustomBatchBeams_D2252E058-28.csv). You can edit/pre-config it via Office-like software or any text editor, **PLEASE RENAME** it for real environment, and passing parameter to TMYBeamConfig()
192+
* Beam configuration file, i.g. [CustomBatchBeams_D2230E058-28.csv](/examples/C_Cpp/examples/config/CustomBatchBeams_D2252E058-28.csv). You can edit/pre-config it via Office-like software or any text editor, please **RENAME** it for real environment, and passing parameter to TMYBeamConfig()
158193
* Basic beam type, there are two basic types, usually we define to CHANNEL CONFIG as default.
159194
* A whole **BEAM config (BeamType=0)**
160195
* beam_db: gain with float type, please DO NOT EXCEED the DR (dynamic range).
@@ -174,6 +209,26 @@ This topic introduces TLKCore how to process FBS (Fast Beam Steering), it loads
174209
* Default gives **degree 0** for theta, phi ... etc
175210
* Example: TX beam1 will be MAX of DR with degree(0, 0), and TX beam8 just modify ch 9~12 to 1dB
176211
![CustomBatchBeams](/images/CustomBatchBeams.png)
212+
* [Notice] TLKCore generates the Beam_Configuration_{SN}_{Freq}GHz_{AAKitName}.json after fetch CSV file, please remove this json file if your json overrided.
213+
214+
## DFU
215+
216+
Device FW Update, starting from TLKCore v1.2.1, to update Beamform series firmware via TLKCore.
217+
218+
1. Make sure your Python environment installed tftpy package, if not, please `pip install tftpy==0.8.2`
219+
2. Query/download FW image for your BBoxOne/BBoxLite/BBoard/CloverCell device
220+
3. Please disable firewall first to allow tftp protocol transmission
221+
* Windows
222+
* `netsh advfirewall set allprofile state off`
223+
* Ubuntu
224+
* `sudo ufw disable`
225+
* CentOS
226+
* `sudo systemctl stop firewalld`
227+
* macOS
228+
* `sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off`
229+
4. Argument assign image path to main.py
230+
231+
python3 main.py --dfu {IMAGE_PATH}
177232

178233
## Extra usage
179234

@@ -216,18 +271,3 @@ This topic introduces TLKCore how to process FBS (Fast Beam Steering), it loads
216271

217272
2. Or passing to initDev()
218273
`service.initDev(sn, addr, dev_type)`
219-
220-
4. DFU(Device FW Update), from TLKCore v1.2.1, support to update BBox series firmware via TLKCore now!
221-
1. Query/download FW image for your BBoxOne/BBoxLite/BBoard device
222-
2. Please disable firewall first to allow tftp protocol transmission
223-
* Windows
224-
* `netsh advfirewall set allprofile state off`
225-
* Ubuntu
226-
* `sudo ufw disable`
227-
* CentOS
228-
* `sudo systemctl stop firewalld`
229-
* macOS
230-
* `sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off`
231-
3. Argument assign image path to main.py
232-
233-
python3 main.py --dfu {IMAGE_PATH}

images/Python_cpp_build_tools.png

27.5 KB
Loading
-7.04 MB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)