# LoRaMAC-node not sending - NucleoL476RG + Dragino 1.4

**URL:** <https://www.thethingsnetwork.org/forum/t/loramac-node-not-sending-nucleol476rg-dragino-1-4/25273>\
**Category:** End Devices (Nodes)\
**Created:** [April 22, 2019, 9:25am UTC](https://www.thethingsnetwork.org/forum/t/loramac-node-not-sending-nucleol476rg-dragino-1-4/25273 "2019-04-22T09:25:30Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ludwig](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/ludwig/32/25844_2.png) [@Ludwig](https://www.thethingsnetwork.org/forum/u/Ludwig)\
**Post date:** [April 22, 2019, 9:25am UTC](https://www.thethingsnetwork.org/forum/t/loramac-node-not-sending-nucleol476rg-dragino-1-4/25273/1 "2019-04-22T09:25:30Z")

</div>

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](http://wiki.dragino.com/index.php?title=Lora_Shield) with a SX1276 module. What I already did is:

- download the latest codebase of [LoRaMAC-node from github](https://github.com/Lora-net/LoRaMac-node).
- 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](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](https://www.thethingsnetwork.org/forum/t/lmic-for-stm32cubemx-in-15-minutes/20366) 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](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/c/9/c97a6917fe1048291834b55f248f332ce21d42ad.png)  
> ![DS1Z_QuickPrint1](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/c/1/c1c08720129659fffd4b180656311a8e0365e8a9.png)  
> This last pic shows the whole communication with a short one after ~1.6s.  
> ![DS1Z_QuickPrint3](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/6/6/66cba118347fd3c70a3b323d5ac5cc76a41b9009.png)
> 
> Current setup:  
> ![photo_2019-04-22_11-18-18](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/4/2/427d5ffc38729530b4326dde0c30a439a6a1e785.jpeg)

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](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/9/8/98ef86d596d56f56a275acf4637951bc71cbc002.png)

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
> 
> ```

---

<div class="post-metadata">

**Author:** ![cslorabox](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/cslorabox/32/35697_2.png) [@cslorabox](https://www.thethingsnetwork.org/forum/u/cslorabox)\
**Post date:** [April 22, 2019, 4:47pm UTC](https://www.thethingsnetwork.org/forum/t/loramac-node-not-sending-nucleol476rg-dragino-1-4/25273/2 "2019-04-22T16:47:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Ludwig](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/ludwig/32/25844_2.png) [@Ludwig](https://www.thethingsnetwork.org/forum/u/Ludwig)\
**Post date:** [April 22, 2019, 5:37pm UTC](https://www.thethingsnetwork.org/forum/t/loramac-node-not-sending-nucleol476rg-dragino-1-4/25273/3 "2019-04-22T17:37:31Z")

</div>

> [@cslorabox](#):
>
> One obvious question would be if the frequency logged by the node is one on which your gateway is listening.

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.

> [@cslorabox](#):
>
> Also other radio settings.

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.

---

<div class="post-metadata">

**Author:** ![Ludwig](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/ludwig/32/25844_2.png) [@Ludwig](https://www.thethingsnetwork.org/forum/u/Ludwig)\
**Post date:** [April 23, 2019, 7:39am UTC](https://www.thethingsnetwork.org/forum/t/loramac-node-not-sending-nucleol476rg-dragino-1-4/25273/4 "2019-04-23T07:39:19Z")

</div>

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](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/d/0/d04621df3855e8258e2c3a68a7f7d5cc733ff165.png)

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

> **Spectrum LoRaMAC-ndoe**
>
> ![tek00001](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/5/9/595756597988d7944bb0dc1efa10c41b08bcbf0c.png)

---

<div class="post-metadata">

**Author:** ![mluis1](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/mluis1/32/44669_2.png) [@mluis1](https://www.thethingsnetwork.org/forum/u/mluis1)\
**Post date:** [April 23, 2019, 11:16am UTC](https://www.thethingsnetwork.org/forum/t/loramac-node-not-sending-nucleol476rg-dragino-1-4/25273/5 "2019-04-23T11:16:11Z")

</div>

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](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/7/f/7fb07e5fcc3c591519d7dad3bb3de9ca04c05cab.png)

---

<div class="post-metadata">

**Author:** ![mluis1](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/mluis1/32/44669_2.png) [@mluis1](https://www.thethingsnetwork.org/forum/u/mluis1)\
**Post date:** [April 23, 2019, 11:19am UTC](https://www.thethingsnetwork.org/forum/t/loramac-node-not-sending-nucleol476rg-dragino-1-4/25273/6 "2019-04-23T11:19:03Z")

</div>

Also control that the antenna switch pin is correctly controlled.

---

<div class="post-metadata">

**Author:** ![Ludwig](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/ludwig/32/25844_2.png) [@Ludwig](https://www.thethingsnetwork.org/forum/u/Ludwig)\
**Post date:** [April 23, 2019, 7:19pm UTC](https://www.thethingsnetwork.org/forum/t/loramac-node-not-sending-nucleol476rg-dragino-1-4/25273/7 "2019-04-23T19:19:03Z")

</div>

> [@mluis1](#):
>
> 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`

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.

> [@mluis1](#):
>
> 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.

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.

> [@mluis1](#):
>
> Also control that the antenna switch pin is correctly controlled.

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.

> [@mluis1](#):
>
> If you enable `USE_RADIO_DEBUG` definition you should be able to see when the radio is transmitting and when it is receiving.

The TX and RX debug pins get set comparable to your example. They differ in the durations they are set.  
 ![DS1Z_QuickPrint5](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/4/2/423ab41fda545b2b18a4a59fb6bb1505a7953873.png)

---

<div class="post-metadata">

**Author:** ![mluis1](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/mluis1/32/44669_2.png) [@mluis1](https://www.thethingsnetwork.org/forum/u/mluis1)\
**Post date:** [April 24, 2019, 7:18am UTC](https://www.thethingsnetwork.org/forum/t/loramac-node-not-sending-nucleol476rg-dragino-1-4/25273/8 "2019-04-24T07:18:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![vldbzh](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/vldbzh/32/35697_2.png) [@vldbzh](https://www.thethingsnetwork.org/forum/u/vldbzh)\
**Post date:** [April 25, 2019, 8:49am UTC](https://www.thethingsnetwork.org/forum/t/loramac-node-not-sending-nucleol476rg-dragino-1-4/25273/9 "2019-04-25T08:49:57Z")

</div>

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.).

---

<div class="post-metadata">

**Author:** ![Ludwig](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/ludwig/32/25844_2.png) [@Ludwig](https://www.thethingsnetwork.org/forum/u/Ludwig)\
**Post date:** [April 25, 2019, 5:47pm UTC](https://www.thethingsnetwork.org/forum/t/loramac-node-not-sending-nucleol476rg-dragino-1-4/25273/10 "2019-04-25T17:47:07Z")

</div>

> [@mluis1](#):
>
> In order to check if the radio is correctly setup could you try the `tx-cw` example project?

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

> [@mluis1](#):
>
> 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.

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

> [@vldbzh](#):
>
> 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.).

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

Thank you all for your suggestions so far.

---

<div class="post-metadata">

**Author:** ![cslorabox](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/cslorabox/32/35697_2.png) [@cslorabox](https://www.thethingsnetwork.org/forum/u/cslorabox)\
**Post date:** [April 25, 2019, 6:55pm UTC](https://www.thethingsnetwork.org/forum/t/loramac-node-not-sending-nucleol476rg-dragino-1-4/25273/11 "2019-04-25T18:55:32Z")

</div>

> [@Ludwig](#):
>
> I tried the `tx-cw` example but unfortunately there is no cw on the output of the radio.

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…

---

<div class="post-metadata">

**Author:** ![Ludwig](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/ludwig/32/25844_2.png) [@Ludwig](https://www.thethingsnetwork.org/forum/u/Ludwig)\
**Post date:** [April 25, 2019, 7:40pm UTC](https://www.thethingsnetwork.org/forum/t/loramac-node-not-sending-nucleol476rg-dragino-1-4/25273/12 "2019-04-25T19:40:30Z")

</div>

> [@cslorabox](#):
>
> 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.

 ![tek00002](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/3/0/3069b42535b8a9666d0e2214c216e4b4f0de54a9.png)  
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.

---

<div class="post-metadata">

**Author:** ![mluis1](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/mluis1/32/44669_2.png) [@mluis1](https://www.thethingsnetwork.org/forum/u/mluis1)\
**Post date:** [April 26, 2019, 8:16am UTC](https://www.thethingsnetwork.org/forum/t/loramac-node-not-sending-nucleol476rg-dragino-1-4/25273/13 "2019-04-26T08:16:23Z")

</div>

> @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.

---

<div class="post-metadata">

**Author:** ![mluis1](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/mluis1/32/44669_2.png) [@mluis1](https://www.thethingsnetwork.org/forum/u/mluis1)\
**Post date:** [April 26, 2019, 9:19am UTC](https://www.thethingsnetwork.org/forum/t/loramac-node-not-sending-nucleol476rg-dragino-1-4/25273/14 "2019-04-26T09:19:15Z")

</div>

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

```auto
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:

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

```

To:

```auto
static uint8_t SX1276GetPaSelect( uint32_t channel )
{
    return RF_PACONFIG_PASELECT_PABOOST;
}

```

---

<div class="post-metadata">

**Author:** ![Ludwig](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/ludwig/32/25844_2.png) [@Ludwig](https://www.thethingsnetwork.org/forum/u/Ludwig)\
**Post date:** [April 26, 2019, 4:37pm UTC](https://www.thethingsnetwork.org/forum/t/loramac-node-not-sending-nucleol476rg-dragino-1-4/25273/15 "2019-04-26T16:37:13Z")

</div>

> [@mluis1](#):
>
> 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.

> [@mluis1](#):
>
> Looking at the LMIC implementation it looks like that by default the `PA_BOOST` pin is used.

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

 ![tek00003](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/3/5/35396b43817534d97b46c1b3570a77ba487f62fa.png)

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.

---

<div class="post-metadata">

**Author:** ![system](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/6/2/6250ea44fd2b0d6259489e1a92748df681e1f970.png) [@system](https://www.thethingsnetwork.org/forum/u/system)\
**Post date:** [June 25, 2019, 4:37pm UTC](https://www.thethingsnetwork.org/forum/t/loramac-node-not-sending-nucleol476rg-dragino-1-4/25273/16 "2019-06-25T16:37:17Z")

</div>

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