forked from open-sdr/openwifi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrf_init.sh
executable file
·115 lines (98 loc) · 3 KB
/
rf_init.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/bin/sh
# Author: Xianjun Jiao
# SPDX-FileCopyrightText: 2019 UGent
# SPDX-License-Identifier: AGPL-3.0-or-later
home_dir=$(pwd)
if test -f "openwifi_ad9361_fir.ftr"; then
echo "Found openwifi_ad9361_fir.ftr"
else
echo "Can not find openwifi_ad9361_fir.ftr!"
exit 1
fi
set -x
if test -f "/sys/bus/iio/devices/iio:device0/in_voltage_rf_bandwidth"; then
cd /sys/bus/iio/devices/iio:device0/
else if test -f "/sys/bus/iio/devices/iio:device1/in_voltage_rf_bandwidth"; then
cd /sys/bus/iio/devices/iio:device1/
else if test -f "/sys/bus/iio/devices/iio:device2/in_voltage_rf_bandwidth"; then
cd /sys/bus/iio/devices/iio:device2/
else if test -f "/sys/bus/iio/devices/iio:device3/in_voltage_rf_bandwidth"; then
cd /sys/bus/iio/devices/iio:device3/
else if test -f "/sys/bus/iio/devices/iio:device4/in_voltage_rf_bandwidth"; then
cd /sys/bus/iio/devices/iio:device4/
else
echo "Can not find in_voltage_rf_bandwidth!"
echo "Check log to make sure ad9361 driver is loaded!"
exit 1
fi
fi
fi
fi
fi
set +x
echo 17500000 > in_voltage_rf_bandwidth
sync
echo 37500000 > out_voltage_rf_bandwidth
sync
echo 40000000 > in_voltage_sampling_frequency
sync
echo 40000000 > out_voltage_sampling_frequency
sync
sleep 1
echo 5240000000 > out_altvoltage0_RX_LO_frequency
sync
echo 5250000000 > out_altvoltage1_TX_LO_frequency
sync
cat $home_dir/openwifi_ad9361_fir.ftr > filter_fir_config
sync
sleep 0.5
echo 1 > in_voltage_filter_fir_en
echo 0 > out_voltage_filter_fir_en
cat filter_fir_config
cat in_voltage_filter_fir_en
cat out_voltage_filter_fir_en
echo "rx0 agc fast_attack"
#echo "rx0 agc manual"
cat in_voltage0_gain_control_mode
echo fast_attack > in_voltage0_gain_control_mode
#echo manual > in_voltage0_gain_control_mode
cat in_voltage0_gain_control_mode
sync
echo "rx1 agc fast_attack"
#echo "rx1 agc manual"
cat in_voltage1_gain_control_mode
echo fast_attack > in_voltage1_gain_control_mode
#echo manual > in_voltage1_gain_control_mode
cat in_voltage1_gain_control_mode
sync
sleep 1
cat in_voltage_sampling_frequency
cat in_voltage_rf_bandwidth
cat out_voltage_sampling_frequency
cat out_voltage_rf_bandwidth
echo "rssi"
cat in_voltage0_rssi
cat in_voltage1_rssi
# # --------not needed maybe-------- # #
echo "rx0 gain to 70" # this set gain is gpio gain - 5dB (test with agc and read back gpio in driver)
cat in_voltage0_hardwaregain
echo 70 > in_voltage0_hardwaregain
cat in_voltage0_hardwaregain
sync
echo "rx1 gain to 70"
cat in_voltage1_hardwaregain
echo 70 > in_voltage1_hardwaregain
cat in_voltage1_hardwaregain
sync
echo "tx0 gain -89dB"
cat out_voltage0_hardwaregain
echo -89 > out_voltage0_hardwaregain
cat out_voltage0_hardwaregain
sync
echo "tx1 gain 0dB"
cat out_voltage1_hardwaregain
echo 0 > out_voltage1_hardwaregain
cat out_voltage1_hardwaregain
sync
# # --------not needed maybe-------- # #
cd $home_dir