TheThingsNetwork / arduino-device-lib

Arduino Library for TTN Devices
MIT License
208 stars 96 forks source link

Initialize frequency plan #63

Closed n2jn closed 8 years ago

n2jn commented 8 years ago

(US && EU) new branch for #38

johanstokking commented 8 years ago

Looks good. @FokkeZB please test

FokkeZB commented 8 years ago

@johanstokking I will once I get my/an Uno joining again.

FokkeZB commented 8 years ago

Rebased on master, updated API.md (included private configureChannels) and tested both with only region and with custom sf and fsb. The only difference in what the debug logs show is the data rate. Which is 4 for the default and 5 when I use sf = 8, fsb = 3.

-- STATUS
EUI: 0004A30B001B7AD2
Battery: 3213
AppEUI: 70B3D57EF000003E
DevEUI: 0004A30B001B7AD2
Data Rate: 5
RX Delay 1: 1000
RX Delay 2: 2000
-- JOIN
Version is RN2483 1.0.1 Dec 15 2015 09:38:09, model is RN2483
Sending: mac set deveui 0004A30B001B7AD2
Sending: mac set adr off
Sending: mac set appeui with 8 bytes
Sending: mac set appkey with 16 bytes
Sending: mac save
Sending: mac set rx2 3 869525000
Sending: mac set ch dcycle 0 799
Sending: mac set ch dcycle 1 799
Sending: mac set ch dcycle 2 799
Sending: mac set ch freq 3 867100000
Sending: mac set ch drrange 3 0 5
Sending: mac set ch status 3 on
Sending: mac set ch dcycle 3 799
Sending: mac set ch freq 4 867300000
Sending: mac set ch drrange 4 0 5
Sending: mac set ch status 4 on
Sending: mac set ch dcycle 4 799
Sending: mac set ch freq 5 867500000
Sending: mac set ch drrange 5 0 5
Sending: mac set ch status 5 on
Sending: mac set ch dcycle 5 799
Sending: mac set ch freq 6 867700000
Sending: mac set ch drrange 6 0 5
Sending: mac set ch status 6 on
Sending: mac set ch dcycle 6 799
Sending: mac set ch freq 7 867900000
Sending: mac set ch drrange 7 0 5
Sending: mac set ch status 7 on
Sending: mac set ch dcycle 7 799
Sending: mac set ch drrange 1 0 6
Sending: mac set pwridx 1
Sending: mac set dr 5
Sending: mac set deveui 0004A30B001B7AD2
Sending: mac join otaa
Join accepted. Status: 00000401
DevAddr: 26012322
-- LOOP
Sending: mac tx uncnf 1 with 1 bytes
FokkeZB commented 8 years ago

@johanstokking I documented the min/max sf I found in the LoRa docs. Do we have information for the min/max fsb as well?

n2jn commented 8 years ago

@FokkeZB I couldn't find any document either with the min/max of fsb but I did some tests with the US915 frequency plan: I noticed that fsb activates 8 channels in a row starting by the beginning (for example for fsb = 1 it activates channels 0 to 7, for fsb = 2 channels 8 to 15, etc ...). So to be able to activate whatever channel we want it would be logical to put a maximum of 9 to fsb and a minimum of 1.

FokkeZB commented 8 years ago

Good to merge @johanstokking