TTN lorawan 923Mhz node 1: LMIC-arduino not working on 8266
This is made to test
the exa,ple is taken from https://github.com/matthijskooijman/arduino-lmic
using the ttn-abp example:
first need to go to TTN, console and application to create an applicaiton:
1. you can name the applicaiton ID and description as you wish, but the applicaiton can only be low cast.
2.Also you have to select a application handler, choose the one near you, since the down link is related to to time windows

it would look like this

3. then register an device.
name the device ID, for the device EUI you can input one or click on the left block, then they will make one for you.

after create, the device is in OTAA mode, go to setting , change it to ABP, then save.


when you back to the device overview, you will have info needed:
we need device address, network session key and appsession key

Now, goes back to the lmic ttn-abp example:
1. change the
static const PROGMEM u1_t NWKSKEY[16] =
static const u1_t PROGMEM APPSKEY[16] =
static const u4_t DEVADDR =
with the data from TTN pages
2. ping mapping, I'm using same connection as my 1ch gateway(8266+RFM95), so I make it as following. currently not using reset.
// Pin mapping
const lmic_pinmap lmic_pins = {
.nss = 16,
.rxtx = LMIC_UNUSED_PIN,
.rst = 0,
.dio = {15, 15, LMIC_UNUSED_PIN},
};
3. for the channel:line 204
I modified as this:
LMIC_setupChannel(0, 923200000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI);
LMIC_setupChannel(1, 923400000, DR_RANGE_MAP(DR_SF12, DR_SF7B), BAND_CENTI);
LMIC_setupChannel(2, 923600000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI);
LMIC_setupChannel(3, 923800000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI);
LMIC_setupChannel(4, 924000000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI);
LMIC_setupChannel(5, 924200000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI);
LMIC_setupChannel(6, 924400000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI);
LMIC_setupChannel(7, 924600000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI);
LMIC_setupChannel(8, 924500000, DR_RANGE_MAP(DR_SF7, DR_SF7), BAND_CENTI);
LMIC_setupChannel(9, 868800000, DR_RANGE_MAP(DR_FSK, DR_FSK), BAND_MILLI);
which match to my gateway frequency plan
and line 221, this is for downlink SF
// TTN uses SF10 for its RX2 window in asia 2 frequ plan.
LMIC.dn2Dr = DR_SF10;
it complied but I got failure from serial monitor:
Starting
FAILURE
D:\Dropbox\Arduino_projects\libraries\arduino-lmic\src\lmic\radio.c:689
the exa,ple is taken from https://github.com/matthijskooijman/arduino-lmic
using the ttn-abp example:
first need to go to TTN, console and application to create an applicaiton:
1. you can name the applicaiton ID and description as you wish, but the applicaiton can only be low cast.
2.Also you have to select a application handler, choose the one near you, since the down link is related to to time windows

it would look like this

3. then register an device.
name the device ID, for the device EUI you can input one or click on the left block, then they will make one for you.

after create, the device is in OTAA mode, go to setting , change it to ABP, then save.


when you back to the device overview, you will have info needed:
we need device address, network session key and appsession key

Now, goes back to the lmic ttn-abp example:
1. change the
static const PROGMEM u1_t NWKSKEY[16] =
static const u1_t PROGMEM APPSKEY[16] =
static const u4_t DEVADDR =
with the data from TTN pages
2. ping mapping, I'm using same connection as my 1ch gateway(8266+RFM95), so I make it as following. currently not using reset.
// Pin mapping
const lmic_pinmap lmic_pins = {
.nss = 16,
.rxtx = LMIC_UNUSED_PIN,
.rst = 0,
.dio = {15, 15, LMIC_UNUSED_PIN},
};
3. for the channel:line 204
I modified as this:
LMIC_setupChannel(0, 923200000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI);
LMIC_setupChannel(1, 923400000, DR_RANGE_MAP(DR_SF12, DR_SF7B), BAND_CENTI);
LMIC_setupChannel(2, 923600000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI);
LMIC_setupChannel(3, 923800000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI);
LMIC_setupChannel(4, 924000000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI);
LMIC_setupChannel(5, 924200000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI);
LMIC_setupChannel(6, 924400000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI);
LMIC_setupChannel(7, 924600000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI);
LMIC_setupChannel(8, 924500000, DR_RANGE_MAP(DR_SF7, DR_SF7), BAND_CENTI);
LMIC_setupChannel(9, 868800000, DR_RANGE_MAP(DR_FSK, DR_FSK), BAND_MILLI);
which match to my gateway frequency plan
and line 221, this is for downlink SF
// TTN uses SF10 for its RX2 window in asia 2 frequ plan.
LMIC.dn2Dr = DR_SF10;
it complied but I got failure from serial monitor:
Starting
FAILURE
D:\Dropbox\Arduino_projects\libraries\arduino-lmic\src\lmic\radio.c:689
it seems to inside the radio_int(), may be I need to add an reset pin
after reading this:
I change to this and try again:
// Pin mapping
const lmic_pinmap lmic_pins = {
.nss = 16,
.rxtx = LMIC_UNUSED_PIN,
.rst = LMIC_UNUSED_PIN,
.dio = {15, 15, LMIC_UNUSED_PIN},
};
the I comes to a watch dog reset
ets Jan 8 2013,rst cause:4, boot mode:(1,6)
wdt reset
after checking google, it says this type of error due to unsupported lib fro 8266....
So, google again I got this:
留言
張貼留言