Arm Mbed OS support forum

TTN Node using RFM95, mbed 1768 & LORAWAN example project - possible?

Hello all,

I have an mbed LPC1768 & was considering trying to implement a ‘Things Newtork Node’ using it, a RFM95 & the the mbed LORAWAN example project.

The idea would be to send simple temperature & humidity data.

Has anyone been successful with such a setup? I’ve tried using the RFM95 with a raspberry pi with success & I’ve successfully compiled the example project on the online compiler for the '1768. I understand that the example project has config data for the SX1276 so is it a matter of simply using that?

Thanks for any input,

Leo

Hi Owen,

The most important thing you should consider is the pin definition, make sure you configure it right. I don’t see there will be problem to use Mbed LoRaWAN stack on RFM95, looking forward to your sharing!

Regards,
Desmond

Desmond,

Thanks for the response.

Do you know happen to know if the protocol between the SX1276 & RFM95 is identical?

Well it seems it is possible, I got at least 2 packets captured on TTN portal, however I can’t seem to get any more to appear!

The setup I used was:

{
    "config": {
        "lora-radio": {
            "help": "Which radio to use (options: SX126X, SX1272, SX1276) -- See config/ dir for example configs",
            "value": "SX1276"
        },
        "main_stack_size":     { "value": 4096 },
        "lora-radio":          { "value":"SX1276"},
        "lora-spi-mosi":       { "value": "p5" },
        "lora-spi-miso":       { "value": "p6" },
        "lora-spi-sclk":       { "value": "p7" },
        "lora-cs":             { "value": "p8" },
        "lora-reset":          { "value": "p11" },
        "lora-dio0":           { "value": "p30" },
        "lora-dio1":           { "value": "NC" },
        "lora-dio2":           { "value": "NC" },
        "lora-dio3":           { "value": "NC" },
        "lora-dio4":           { "value": "NC" },
        "lora-dio5":           { "value": "p12" },
        "lora-rf-switch-ctl1": { "value": "NC" },
        "lora-rf-switch-ctl2": { "value": "NC" },
        "lora-txctl":          { "value": "NC" },
        "lora-rxctl":          { "value": "NC" },
        "lora-ant-switch":     { "value": "NC" },
        "lora-pwr-amp-ctl":    { "value": "NC" },
        "lora-tcxo":           { "value": "NC" }
    },
    "target_overrides": {
        "*": {
            "mbed-trace.enable": 1,
            "platform.stdio-convert-newlines": true,
            "platform.stdio-baud-rate": 115200,
            "platform.default-serial-baud-rate": 115200,
            "lora.over-the-air-activation": true,
            "lora.duty-cycle-on": true,
            "lora.phy": "EU868", 

But all I’m getting now is:

Mbed LoRaWANStack initialized

CONFIRMED message retries : 3

Adaptive data rate (ADR) - Enabled
[DBG ][LSTK]: Initiating OTAA
[DBG ][LSTK]: Sending Join Request …
[DBG ][LMAC]: Frame prepared to send at port 0
[DBG ][LMAC]: TX: Channel=2, TX DR=5, RX1 DR=5

Connection - In Progress …
[DBG ][LSTK]: TX Timeout
[ERR ][LSTK]: Joining abandoned: Radio failed to transmit

Transmission Error - EventCode = 3

Dummy Sensor Value = 3

send() - Error code -1017

Will continue to plug away…

No success yet. However I notice that if the RFM95W board is unpowered I get the same console output.

Its not clear if there’s a simple way to check if the SPI connection is occuring

Looks like I’ve cracked it…

I experimented with the connections & found that leaving the RESET line unconnected on the RFM95W resulted in successful transmissions. This is what I get on the console now:

Mbed LoRaWANStack initialized 

CONFIRMED message retries : 3

Adaptive data rate (ADR) - Enabled
[DBG ][LSTK]: Initiating OTAA
[DBG ][LSTK]: Sending Join Request …
[DBG ][LMAC]: Frame prepared to send at port 0
[DBG ][LMAC]: TX: Channel=2, TX DR=5, RX1 DR=5

Connection - In Progress …
[DBG ][LSTK]: Transmission completed
[DBG ][LMAC]: RX1 slot open, Freq = 868500000
[DBG ][LMAC]: RX2 slot open, Freq = 869525000
[DBG ][LMAC]: Frame prepared to send at port 0
[DBG ][LMAC]: TX: Channel=2, TX DR=4, RX1 DR=4
[DBG ][LSTK]: Transmission completed
[DBG ][LMAC]: RX1 slot open, Freq = 868500000
[DBG ][LMAC]: RX2 slot open, Freq = 869525000
[DBG ][LMAC]: Frame prepared to send at port 0
[DBG ][LMAC]: DC enforced: Transmitting in 5538 ms
[DBG ][LMAC]: TX: Channel=0, TX DR=3, RX1 DR=3
[DBG ][LSTK]: Transmission completed
[DBG ][LMAC]: RX1 slot open, Freq = 868100000
[DBG ][LSTK]: OTAA Connection OK!

Connection - Successful

Dummy Sensor Value = 3
[INFO][LMAC]: RTS = 23 bytes, PEND = 0, Port: 15
[DBG ][LMAC]: Frame prepared to send at port 15
[DBG ][LMAC]: TX: Channel=3, TX DR=3, RX1 DR=3

23 bytes scheduled for transmission
[DBG ][LSTK]: Transmission completed
[DBG ][LMAC]: RX1 slot open, Freq = 867100000
[DBG ][LMAC]: RX2 slot open, Freq = 869525000

Message Sent to Network Server

Dummy Sensor Value = 5
[INFO][LMAC]: RTS = 23 bytes, PEND = 0, Port: 15
[DBG ][LMAC]: Frame prepared to send at port 15
[DBG ][LMAC]: DC enforced: Transmitting in 12807 ms

23 bytes scheduled for transmission

My mbed_app.json setup:

{
    "config": {
        "lora-radio": {
            "help": "Which radio to use (options: SX126X, SX1272, SX1276) -- See config/ dir for example configs",
            "value": "SX1276"
    },
    "main_stack_size":     { "value": 4096 },
        
        "lora-spi-mosi":       { "value": "p5" },
        "lora-spi-miso":       { "value": "p6" },
        "lora-spi-sclk":       { "value": "p7" },
        "lora-cs":             { "value": "p8" },
        "lora-reset":          { "value": "p11" },
        "lora-dio0":           { "value": "p28" },
        "lora-dio1":           { "value": "p27" },
        "lora-dio2":           { "value": "p26" },
        "lora-dio3":           { "value": "p30" },
        "lora-dio4":           { "value": "p29" },
        "lora-dio5":           { "value": "p12" },
        "lora-rf-switch-ctl1": { "value": "NC" },
        "lora-rf-switch-ctl2": { "value": "NC" },
        "lora-txctl":          { "value": "NC" },
        "lora-rxctl":          { "value": "NC" },
        "lora-ant-switch":     { "value": "NC" },
        "lora-pwr-amp-ctl":    { "value": "NC" },
        "lora-tcxo":           { "value": "NC" }
    },
    "target_overrides": {
        "*": {
            "mbed-trace.enable": 1,
            "platform.stdio-convert-newlines": true,
            "platform.stdio-baud-rate": 115200,
            "platform.default-serial-baud-rate": 115200,
            "lora.over-the-air-activation": true,
            "lora.duty-cycle-on": true,
            "lora.phy": "EU868",
            "lora.device-eui": "{ 0x00, etc..................

Hope this helps & best of luck!