LoRaMAC-node not sending - NucleoL476RG + Dragino 1.4

Hello everyone,
I hope you can help me in getting the LoRaMAC-node library to work with my hardware.
I am using a Nucleo-L476RG Board + Dragino 1.4 with a SX1276 module. What I already did is:

  • download the latest codebase of LoRaMAC-node from github.
  • copy src/boards/NucleoL476/sx1276mb1mas-board.c to src/boards/NucleoL476/dragino14-board.c and add the target in the matching CMakeLists.txt.
  • Change the pins in src/boards/NucleoL476/board-config.h accordingly.
  • Turn on OTAA and fill in the Credentials in src/apps/LoRaMac/classA/NucleoL476/Commissioning.h.
  • Compile the example for ClassA in src/apps/LoRaMac/classA/NucleoL476.

The build is done with this command:

build
cmake 	-DCMAKE_BUILD_TYPE=Debug \
		-DCMAKE_TOOLCHAIN_FILE="../cmake/toolchain-arm-none-eabi.cmake" \
		-DAPPLICATION="LoRaMac" \
		-DCLASS="classA" \
		-DCLASSB_ENABLED="OFF" \
		-DACTIVE_REGION="LORAMAC_REGION_EU868" \
		-DREGION_EU868="ON" \
		-DREGION_US915="OFF" \
		-DREGION_CN779="OFF" \
		-DREGION_EU433="OFF" \
		-DREGION_AU915="OFF" \
		-DREGION_AS923="OFF" \
		-DREGION_CN470="OFF" \
		-DREGION_KR920="OFF" \
		-DREGION_IN865="OFF" \
		-DREGION_RU864="OFF" \
		-DBOARD="NucleoL476" \
        -DRADIO="sx1276" \
        -DUSE_RADIO_DEBUG="" \
        -DMBED_RADIO_SHIELD="DRAGINO14" .. && make -j4

You can find my current codebase at https://github.com/Luddi1/LoRaMac-node.

After uploading I get following output on the UART:

Serial output
###### ===== ClassA demo application v1.0.RC1 ==== ######

DevEui      : 00-07-redacted out-F5-A7
AppEui      : 70-B3-redacted out-01-98-1D
AppKey      : 47 8C E2 76 redacted out B2 3A CC 3D


###### ===== MLME-Request - MLME_JOIN ==== ######
STATUS      : OK
###### ===== JOINING ==== ######

###### ===== MLME-Confirm ==== ######
STATUS      : Rx 2 timeout

###### ===== MLME-Request - MLME_JOIN ==== ######
STATUS      : Duty-cycle restricted

###### ===== MLME-Request - MLME_JOIN ==== ######
STATUS      : Duty-cycle restricted

###### ===== MLME-Request - MLME_JOIN ==== ######
STATUS      : Duty-cycle restricted

...

And the there seems to be no traffic at my local gateway. As I have no access to a spectrum analyzer at the moment I do not know if the module sends anything. But I can do that in the next days if it helps.

Also the gateway and this exact setup works because following this guide by skovholm I am able to send messages using the LMiC library. I would like to be able to use the official Semtech one, though.

The SPI communication seems to be working. Here are some oscilloscope screenshots right after reset of the MCU with top to bottom: MISO, MOSI, SCLK, NSS

Oscilloscope screenshots

DS1Z_QuickPrint2
DS1Z_QuickPrint1
This last pic shows the whole communication with a short one after ~1.6s.
DS1Z_QuickPrint3

Current setup:
photo_2019-04-22_11-18-18

I haven’t dived deeper into the differences between the LMiC implementation and this one as I hope that someone can point me in the right direction here.
Thanks in advance!

EDIT 1:
Here is another measurement with the oscilloscope. Channels 3 and 4 are now DIO0 and DIO1, which if I understand correctly are interrupts for RxDone/TxDone and TimeOut.
Apparently the DIO0 gets asserted after ~1.6s which should indicate that a packet has been transmitted and ~5s later there are two communications and assertions of DIO1.
Is this the normal behavior of the software?

DIO0 and DIO1

DS1Z_QuickPrint4

Configured for ABP the stack believes to send out messages successfully but there is still no traffic at the application or the gateway in the console.
This is the output of the uart:

ABP uart
###### ===== ClassA demo application v1.0.RC1 ==== ######

DevEui      : 00-07-redacted out-A7
AppEui      : 70-B3-redacted out-98-1D
AppKey      : 47 8C E2 76 redacted out B2 3A CC 3D

###### ===== JOINED ==== ######

ABP

DevAddr     : 2601110E
NwkSKey     : 1F E4 F0 59 DB redacted out 31 61 26 2B 4F
AppSKey     : EF FF 5C 7D 6A redacted out 9E F0 B2


###### ===== MCPS-Request ==== ######
STATUS      : OK

###### ===== MCPS-Confirm ==== ######
STATUS      : OK

###### ===== UPLINK FRAME 1 ==== ######

CLASS       : A

TX PORT     : 2
TX DATA     : UNCONFIRMED
00 

DATA RATE   : DR_0
U/L FREQ    : 868500000
TX POWER    : 0
CHANNEL MASK: 0007 


###### ===== MCPS-Request ==== ######
STATUS      : Duty-cycle restricted

###### ===== MCPS-Request ==== ######
STATUS      : Duty-cycle restricted

One obvious question would be if the frequency logged by the node is one on which your gateway is listening (and of course if that is appropriate or at least legal for your location).

Also other radio settings.

Good point. The gateway is a Raspberry with a iC880A-SPI 868 MHz Concentrator and the end node software is compiled with -DACTIVE_REGION="LORAMAC_REGION_EU868". So that should fit together. Also it is legal because I am in Europe.

Is there maybe anything I should be aware of when using this specific library with TTN? I use it mostly as is at the moment.

Some additional information:
The RF Part works when I use the LMiC implementation. It is an old one which still uses the 864MHz join frequencies.

Spectrum LMiC

tek00000

With the loramac-node library I get no activity of the transmitter when it should join:

Spectrum LoRaMAC-ndoe

tek00001

Looking at your build script you should change the line -DCLASS="ClassA" by -DSUB_PROJECT="classA" and -DUSE_RADIO_DEBUG="" by -DUSE_RADIO_DEBUG="OFF"

Everything else looks to be correct at first sight.

If you enable USE_RADIO_DEBUG definition you should be able to see when the radio is transmitting and when it is receiving.
If you have access to the gateway antenna port you could connect an RF splitter and then connect a cable to an oscilloscope (input impedance set to 50 Ohms) as well as to an antenna. This will show when the gateway transmits.

You should observe something like the following (done with LoRaMac-node setup for AS923 region):
AS923-JoinReq-Accept

Also control that the antenna switch pin is correctly controlled.

Thanks for pointing that out. Unfortunately I have still no luck. Now I configured the build with cmake -DCMAKE_TOOLCHAIN_FILE="cmake/toolchain-arm-none-eabi.cmake" .. followed by cmake-gui .. and doing the appropriate settings, so they should be as expected. The behavior is still the same.

That’s a nice idea for a setup and I have access to the gateway port but I think it is of no help at the moment because the node does not even send anything to which the gateway could respond.

Good point, too. Though on this specific board the antenna pin of the SX1276 connects directly to the SMA connector.

Thanks so far for your help.

The TX and RX debug pins get set comparable to your example. They differ in the durations they are set.
DS1Z_QuickPrint5

The difference in timing is normal as my screenshot was generated with stack setup for AS923 region. The JoinReq is done at DR_2 (SF10BW125) while in your case you are using EU868 region where the JoinReq is done at DR_0 (SF12BW125).

In order to check if the radio is correctly setup could you try the tx-cw example project?

This example project will generate an RF continuous wave (un-modulated). On you spectrum analyzer you should observe a vertical line (sinus wave) at the setup frequency and output power.

Another thing you could check is if your board is using RFO or PA_BOOST pin to connect the antenna port. Currently your drivers look to be setup for RFO pin.

Maybe you could build a simple LoRa receiver. It would show something if your node transmits (node has to transmit at a single channel etc.).

I tried the tx-cw example but unfortunately there is no cw on the output of the radio.

This is a very simple board which connects the SX1276 antenna pin directly to the sma connector. Good suggestion, nonetheless.

Good idea, should I come so far that anything comes out of the radio :slight_smile: For now I can check with the spectrum analyzer.

Thank you all for your suggestions so far.

Then you really need to debug the code’s interaction with the radio. That codebase does work, so it’s probably something different about your setup vs the assumed Nucleo + LoRa “shield”.

Since you report the same hardware works with LMiC you have working code to compare…

I’d start with verifying things like the SPI pins, SPI chip select, then the DIO pins…

Exactly, I’m just in the process of doing so.

Just a random example from the cw-tx code:
SX1276Write( REG_FRFMSB, ( uint8_t )( ( freq >> 16 ) & 0xFF ) );
in void SX1276SetChannel( uint32_t freq )
gives the following result measured directly at the pins of the SX1276.


From top to bottom the digital channels are MISO, MOSI, SCK, NSS. It shows the rnw bit first for a write acess, the address 0x06 for RegFrfMsb and in the second byte the new data to be written. CPOL = 0 and CPHA = 0, as the datasheet demands. So apparently the basic SPI communication works. Testing the read back of data in the same fashion works, too.

I will compare to the working LMiC implementation as you suggest.

@Ludwig
This is a very simple board which connects the SX1276 antenna pin directly to the sma connector. Good suggestion, nonetheless.

Yes, but the radio has 2 possible outputs RFO and PA_BOOST. As I understand you are using a module. You need to check how the ANT pin is connected inside the module.

1 Like

Looking at the LMIC implementation it looks like that by default the PA_BOOST pin is used.

static void configPower () {
#ifdef CFG_sx1276_radio
    // no boost used for now
    s1_t pw = (s1_t)LMIC.txpow;
    if(pw >= 17) {
        pw = 15;
    } else if(pw < 2) {
        pw = 2;
    }
    // check board type for BOOST pin
    writeReg(RegPaConfig, (u1_t)(0x80|(pw&0xf)));  // <--- 0x80 -> RF_PACONFIG_PASELECT_PABOOST
    writeReg(RegPaDac, readReg(RegPaDac)|0x4);

#elif CFG_sx1272_radio
    // set PA config (2-17 dBm using PA_BOOST)
    s1_t pw = (s1_t)LMIC.txpow;
    if(pw > 17) {
        pw = 17;
    } else if(pw < 2) {
        pw = 2;
    }
    writeReg(RegPaConfig, (u1_t)(0x80|(pw-2)));
#else
#error Missing CFG_sx1272_radio/CFG_sx1276_radio
#endif /* CFG_sx1272_radio */
}

Can you try to modify the following function in sx1276-board.c
From:

static uint8_t SX1276GetPaSelect( uint32_t channel )
{
    return RF_PACONFIG_PASELECT_RFO;
}

To:

static uint8_t SX1276GetPaSelect( uint32_t channel )
{
    return RF_PACONFIG_PASELECT_PABOOST;
}
1 Like

Hooray! That was it. Thanks for your patience with me :slight_smile:

Later I’ll be near my gateway and will see if the join works, too.

EDIT:
Class A operation works like a charm. Now I can go on and build my applications around this.
Thanks again.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.