helium / sx1302_hal

SX1302 Hardware Abstraction Layer and Tools (packet forwarder...)
Other
36 stars 44 forks source link

Correct AU915 #19

Closed lthiery closed 2 years ago

lthiery commented 2 years ago

miner/sys.config presents:

'AU915' => [916.8, 917.0, 917.2, 917.4, 917.5, 917.6, 917.8, 918.0, 918.2],

Meanwhile, prior to this PR, the results from analysis with sx13xx-conf:

sx13xx-conf ~/sx1302_hal/packet_forwarder/global_conf.json.sx1250.AU915 AU915
1        916.8 MHz
2        917 MHz
3        917.2 MHz
4        917.4 MHz
5        917.6 MHz
6        917.8 MHz
7        918 MHz
8        918.2 MHz
Fat LoRa 917.5 MHz, BW 500 KHz
FSK      Disabled
Channel 4 mismatch! Expected 917500000, but got 917600000
Channel 5 mismatch! Expected 917600000, but got 917800000
Channel 6 mismatch! Expected 917800000, but got 918000000
Channel 7 mismatch! Expected 918000000, but got 918200000
Channel 8 mismatch! Expected 918200000, but got 917500000

Some corrections were made, including the centering of the radio0 range. The analysis now claims a match to miner/sys.config:

sx13xx-conf ~/sx1302_hal/packet_forwarder/global_conf.json.sx1250.AU915 AU915
1        916.8 MHz
2        917 MHz
3        917.2 MHz
4        917.4 MHz
5        917.5 MHz
6        917.6 MHz
7        917.8 MHz
8        918 MHz
Fat LoRa 918.2 MHz, BW 500 KHz
FSK      Disabled
mdaviesnz commented 2 years ago

Looking at this because I was going to add AU915 to the Frequency Plans page in the docs, went down the rabbit hole, and I'm wondering if this was actually originally correct and miners/sys.config was misleading.

Looking at RP2-1.0.3 LoRaWAN Regional Parameters upstream channels 0 through 63 are 125 kHz wide and incremented linearly by 200kHz from 915.2 MHz to 927.8 MHz so channels 8 through 15 are:

8   916.8
9   917
10  917.2
11  917.4
12  917.6
13  917.8
14  918
15  918.2

Upstream channels 64 to 71 are 500 kHz wide and incremented by 1.6 MHz from 915.9 to 927.1:

64  915.9
65  917.5 <--
66  919.1
67  920.7
68  922.3
69  923.9
70  925.5
71  927.1

So I suspect the 500 kHz channel is intended to be 65, rather than 918.2 as it looks has been changed here. Looks like this comes from the numerical sorting of the frequencies in sys.config which doesn't correspond to the actual channels.

Otherwise as per that LoraWAN doc the downstream channels are all 500kHz wide with 600 kHz increments between 923.3 and 927.5, but I don't know enough about this to see where that fits in with this config:

0   923.3
1   923.9
2   924.5
3   925.1
4   925.7
5   926.3
6   926.9
7   927.5

I'm new to this so I might be on the wrong track, just thought I'd call out an inconsistency that I noticed.

mdaviesnz commented 2 years ago

@lthiery @JayKickliter Not sure if you get a notification about this since it's merged already.

shawaj commented 2 years ago

@mdaviesnz your are correct and in fact on the sx1301 it breaks things.

See https://github.com/NebraLtd/hm-pktfwd/issues/48

lthiery commented 2 years ago

@shawaj @mdaviesnz if we are going to correct the AU915 configuration here, we must first fix it in miner/sys.config. But based on my reading, I think your corrections are right.

@mdaviesnz would you care to open a PR against Miner presenting your findings?

shawaj commented 2 years ago

@lthiery what is wrong in sys.config? all of the frequencies from the initial config are present there https://github.com/helium/miner/blob/a5a99c355b12dd312603913c7cb938cba3750ab4/config/sys.config#L114

lthiery commented 2 years ago

Sorry I misread. We need to simply revert this change it seems? And then update the test analysis software to be the following

pub const AU915_UPLINK_FREQUENCIES: [usize; 9] = [
    916_800_000,
    917_000_000,
    917_200_000,
    917_400_000,
    917_600_000,
    917_800_000,
    918_000_000,
    918_200_000,
    917_500_000, // fat channel
];
shawaj commented 2 years ago

Just for future reference also, the SX1257 has a bandwidth of 1MHz, so using std with 500kHz bandwidth and IF of 400kHz puts this beyond the range ... 400kHz + (500kHZ / 2) = 650kHZ which is higher than 550kHZ ( = 1.1MHz / 2) which is the usable bandwidth for 500kHz channels. Which is why it fails to work.

For SX1250 not sure if this is the same

mdaviesnz commented 2 years ago

Thanks for looking at this. I expect reverting this would fix in the short term. Maybe needs to be stored as an ordered list, or indexed by channel number, perhaps with bandwidth details too, to avoid this in the future (or with other band plans).