8000 Added Scripts for FCC/CE/RCM testing for LoRa and Sigfox · tdamsma/pycom-micropython-sigfox@45c7ba3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 45c7ba3

Browse files
author
iwahdan88
committed
Added Scripts for FCC/CE/RCM testing for LoRa and Sigfox
1 parent 55ad8c1 commit 45c7ba3

File tree

2 files changed

+179
-0
lines changed

2 files changed

+179
-0
lines changed

esp32/tools/FCC_CE_RCM_Cert/README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
### LoRa/Sigfox FCC/CE/RCM Certification Scripts
2+
3+
This directory contains script(s) that should be executed when the board boots, preparing it for the lab tests.
4+
5+
When beginning a test, after the board has been powered up (either for Sigfox or LoRa), the first thing is to call one of these functions:
6+
7+
```
8+
start_test_fcc()
9+
10+
start_test_rcm()
11+
12+
start_test_ce()
13+
```
14+
15+
####To begin test:
16+
17+
For Sigfox only these functions are used:
18+
19+
```
20+
do_freq_hopping_fcc()
21+
22+
do_freq_hopping_rcm()
23+
24+
do_freq_hopping_ce()
25+
26+
do_continuos_transmit(<frequency>)
27+
```
28+
29+
For LoRa these are the functions to use:
30+
31+
```
32+
select_new_frequency():
33+
34+
sock_send_repeat(packt_len,num_packts,
35+
delay_secs,
36+
fhss=False)
37+
38+
sock_send_all_channels(packt_len,delay_secs=0.1)
39+
```
40+
41+
_Both LoRa and Sigfox can also use the normal socket functions to send single messages during testing._

esp32/tools/FCC_CE_RCM_Cert/main.py

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
from network import Sigfox
2+
from network import LoRa
3+
import socket
4+
import machine
5+
import time
6+
7+
hop_num = 68
8+
start_freq = 863000000
9+
end_freq = 870000000
10+
11+
lora = LoRa(mode=LoRa.LORA, region=LoRa.EU868)
12+
sigfox = None
13+
14+
sock = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
15+
sock.setblocking(False)
16+
17+
def select_new_frequency():
18+
global hop_num
19+
global start_freq
20+
21+
r_num = (machine.rng() % hop_num) + 1
22+
hop = r_num * 100000
23+
frequency = start_freq + hop
24+
return frequency
25+
26+
def sock_send_repeat(packt_len, num_packts, delay_secs, fhss=False):
27+
global sock
28+
global lora
29+
30+
if delay_secs <= 0:
31+
delay_secs = 0.1
32+
33+
for i in range(num_packts):
34+
packet = bytes([machine.rng() & 0xFF for b in range(packt_len)])
35+
print("Sending packet number {}: {}".format(i, packet))
36+
if fhss:
37+
lora.frequency(select_new_frequency())
38+
sock.send(packet)
39+
time.sleep(delay_secs)
40+
41+
def sock_send_all_channels(packt_len, delay_secs=0.1):
42+
global sock
43+
global lora
44+
global start_freq
45+
global end_freq
46+
47+
start = start_freq
48+
end = end_freq
49+
50+
if delay_secs <= 0:
51+
delay_secs = 0.1
52+
53+
for i in range((end - start) / 100000):
54+
packet = bytes([machine.rng() & 0xFF for b in range(packt_len)])
55+
print("Sending packet number {}: {}".format(i, packet))
56+
lora.frequency(start + (i * 100000))
57+
sock.send(packet)
58+
time.sleep(delay_secs)
59+
60+
def start_test_fcc():
61+
global sigfox
62+
global lora
63+
global start_freq
64+
global end_freq
65+
global hop_num
66+
67+
sigfox = Sigfox(mode=Sigfox.SIGFOX, rcz=Sigfox.RCZ2)
68+
lora = LoRa(mode=LoRa.LORA, region=LoRa.US915)
69+
start_freq = 902000000
70+
end_freq = 928000000
71+
hop_num = 258
72+
73+
def start_test_rcm():
74+
global sigfox
75+
global lora
76+
global start_freq
77+
global end_freq
78+
global hop_num
79+
80+
sigfox = Sigfox(mode=Sigfox.SIGFOX, rcz=Sigfox.RCZ4)
81+
lora = LoRa(mode=LoRa.LORA, region=LoRa.AU915)
82+
start_freq = 915000000
83+
end_freq = 928000000
84+
hop_num = 128
85+
86+
def start_test_ce():
87+
global sigfox
88+
global lora
89+
global start_freq
90+
global end_freq
91+
global hop_num
92+
93+
sigfox = Sigfox(mode=Sigfox.SIGFOX, rcz=Sigfox.RCZ1)
94+
lora = LoRa(mode=LoRa.LORA, region=LoRa.EU868)
95+
start_freq = 863000000
96+
end_freq = 870000000
97+
hop_num = 68
98+
99+
def do_freq_hopping_fcc():
100+
global sigfox
101+
102+
frequency = 902200000 + 25000
103+
104+
while frequency < 904700000:
105+
sigfox.test_mode(8, frequency)
106+
frequency += 25000
107+
108+
109+
def do_freq_hopping_rcm():
110+
global sigfox
111+
112+
frequency = 915000000 + 25000
113+
114+
while frequency < 928000000:
115+
sigfox.test_mode(8, frequency)
116+
frequency += 25000
117+
118+
119+
def do_freq_hopping_ce():
120+
global sigfox
121+
122+
frequency = 863000000 + 100000
123+
124+
while frequency < 870000000:
125+
sigfox.test_mode(8, frequency)
126+
frequency += 100000
127+
128+
129+
def do_continuos_transmit(frequency):
130+
global sigfox
131+
132+
while True:
133+
sigfox.test_mode(8, frequency)
134+
time.sleep_ms(5)
135+
136+
print()
137+
print("*** LoRa/Sigfox radio setup complete, ready to test ***")
138+
print()

0 commit comments

Comments
 (0)
0