Giter VIP home page Giter VIP logo

lorawan-library-for-pico's People

Contributors

ep1cman avatar jbinko avatar jerryneedell avatar keichan34 avatar sandeepmistry avatar thomasleister avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lorawan-library-for-pico's Issues

SX1276Read(REG_LR_VERSION) returns 0

A new gateway was opened near my home, so I am re-opening my LoraWAN project.

I have cloned the repository and have built the examples. Changing only the region in config.h and the device and app key.

In the "hello_otaa" and the "otaa_temperature_led" example, initialization fails consistently in lorawan.c at SX1276Read(REG_LR_VERSION)

The function returns 0, so the test against 0x12 fails.
Hardware: Raspberry Pi Pico, Waveshare Pico-LoRa-SX126x module.

What am I missing?

Lora example

If I don't want the complexity of LoRaWAN, are there any examples for simpler Lora communication?

Shutting down the stack to be sure NVM is no longer being written to before power-down

Hello,

I had a quick (hopefully easy) query : )
What do you suggest could be the best way to shut down the stack, or at least to know when the NVM is not being written to? Is there a lorawan_close() type of function?
The reason I'd like to do such a shutdown or be able to be sure when NVM is not being written, is because I managed to corrupt the portion of Flash that the LoRaWAN stack uses as NVM somehow, I believe through removing power at an incorrect time. I'd like to first check (or shutdown the stack) that it is not writing to NVM, and then remove power. I have only corrupted it once, but I wanted to reduce the risk of it occurring.

For now, I can do a force erase of the NVM portion on startup if corruption has occurred, so it's a minor thing.

Also, I was wondering, when does the NVM get written to? Is it when lorawan_init_otaa() is executed, or also at any other point?

Many thanks!

Needed to edit two files to include spi.h when using the code

(Please ignore this issue, it was a fault in my CMakeLists.txt file. I have corrected it, and this issue can be closed.
For the benefit of anyone interested, it was a conflict with the header files for pico-lorawan, and a SD card FAT library, which both use files called spi.h. The solution was to place the text pico-lorawan/lib/LoRaMac-node/src/system as the first entry for
target_include_directories in CMakeLists.txt).

Hello,

I don't know if it is an issue with my CMakeLists.txt or not, but when I tried integrating the pico-lorawan project into the rest of my application, I received an error, relating to spi.h during the code building.

The error is:

C:/development/pico/myproj/pico-lorawan/src/boards/rp2040/sx1276-board.c
In file included from C:/development/pico/myproj/pico-lorawan/lib/LoRaMac-node/src/boards/sx1276-board.h:33,
                 from C:/development/pico/myproj/pico-lorawan/src/boards/rp2040/sx1276-board.c:33:
C:/development/pico/myproj/pico-lorawan/lib/LoRaMac-node/src/radio/sx1276/sx1276.h:148:5: error: unknown type name 'Spi_t'
  148 |     Spi_t         Spi;
      |     ^~~~~
C:/development/pico/myproj/pico-lorawan/src/boards/rp2040/sx1276-board.c: In function 'SX1276IoInit':
C:/development/pico/myproj/pico-lorawan/src/boards/rp2040/sx1276-board.c:114:26: error: request for member 'Nss' in something not a structure or union
  114 |     GpioInit( &SX1276.Spi.Nss, SX1276.Spi.Nss.pin, PIN_OUTPUT, PIN_PUSH_PULL, PIN_NO_PULL, 1 ); // CS
      |                          ^

To fix it, I had to do these things:

  1. in src/boards/rp2040/spi-board.c I had to add this line:
    #include "../../../LoRaMac-node/src/system/spi.h"

  2. in lorawan.c I had to add this line:
    #include "spi.h"

Now the code builds fine, and runs.

My code structure consists of several files (main.c and so on) at a top level, and the pico-lorawan library is in a folder.

I'm a beginner with CMake, so I don't know if it's a real issue, or some fault at my end.
This is what my CMakeLists.txt file contains:

cmake_minimum_required(VERSION 3.12)
include(pico_sdk_import.cmake)
project(myproj)

pico_sdk_init()

add_subdirectory(pico-lorawan pico-lorawan/lib/LoRaMac-node)
add_subdirectory(no-OS-FatFS-SD-SPI-RPi-Pico/FatFs_SPI)

# rest of your project
add_executable(myproj
    main.c
    hw_config.c
)

target_include_directories(myproj PUBLIC
        no-OS-FatFS-SD-SPI-RPi-Pico/FatFs_SPI/include
        no-OS-FatFS-SD-SPI-RPi-Pico/FatFs_SPI/sd_driver
        no-OS-FatFS-SD-SPI-RPi-Pico/FatFs_SPI/ff14a/source
        pico-lorawan/lib/LoRaMac-node/src/system
        )

target_link_libraries(myproj pico_lorawan hardware_adc pico_stdlib hardware_clocks
        FatFs_SPI hardware_i2c hardware_dma hardware_spi
        )

# enable usb output, disable uart output
pico_enable_stdio_usb(myproj 1)
pico_enable_stdio_uart(myproj 0)

# create map/bin/hex/uf2 file in addition to ELF.
pico_add_extra_outputs(myproj)

If you think my CMakeLists.txt looks OK, then I'm happy to create a pull request with the modifications.

Many thanks!

Compiler error

Getting a complier error here on line 295 of lorawan.c file
int lorawan_process_timeout_ms(uint32_t timeout_ms)

Error message is this
a value of type "int" cannot be used to initialize an entity of type "absolute_time_t"
Any ideas?

How to configure for use with SX1262 Semtech Shield

Hello,

I am trying to use this package for the SX1261/1262 with the Pico, but I am having a hard time trying to figure out how to get it to compile safely for the SX1262 instead of the SX1276; is this documented anywhere? If not, would this be possible to implement?

Thank you

Include the library in VSCode

Hello, the project build perfectly on it's own but I would like to know how where should I copy the library in order to use it in other projects, I'm using Visual Studio Code on Windows 10.

Thank You

spi1 does not work

I'm trying to use an ILABS CHALLENGER RP2040 Lora 868M module. This has an RFM95 on-board with SX1276 chip and uses spi1 not spi0.

I'm trying to get the otaa_temperature_led example working on it

in main.c I have this.

// pin configuration for SX12xx radio module
const struct lorawan_sx12xx_settings sx12xx_settings = {
    .spi = {
        .inst = spi1,
        .mosi = 11,
        .miso = 12,
        .sck  = 10,
        .nss  = 3
    },
    .reset = 15,
    .busy = 2,
    // sx127x would use dio0 pin, and sx126x dont use it 
    // .dio0  = 7,
    .dio1  = 20
};

These pins work fine using a simple SPI program to read the sx1276 Version (0x12).

However when using pico-lorawan your code blocks and never returns a value. The reason is in spi-board.c here:-

uint16_t SpiInOut( Spi_t *obj, uint16_t outData )
{
    const uint8_t outDataB = (outData & 0xff);
    uint8_t inDataB = 0x00;

    spi_write_read_blocking((obj->SpiId == 0) ? spi0 : spi1, &outDataB, &inDataB, 1);

    return inDataB;
}

obj->SpiId returned zero instead of 1 when I added print statements. It seems that the 'obj' hasn't been updated somewhere along the line. (I have to break off now but will hunt for that later)

Regards
Brian

Including The Library In SDK System

Hello everyone,

could anyone of you please explain to me how I can include this library in my pico-sdk folder? I am totally overwhelmed.

Thanks in advance!

second join always ends in rx 2 timeout

I have this reproducable pattern:
Step 1: I reset pico with flash_nuke.uf2
Step 2: I flash and run otaa_temperature_led.uf2
Step 3: I disconnect/reconnect power from pico and run otaa_temperature_led.uf2

Step 1 and Step 2 run flawless (DevEui is masked):

Pico LoRaWAN - OTAA - Temperature + LED

Erasing NVM ... success!
Initilizating LoRaWAN ... DevEui      : XX-XX-XX-XX-XX-XX-XX-XX
JoinEui     : 00-00-00-00-00-00-00-00
Pin         : 00-00-00-00

success!
Joining LoRaWAN network ...
###### =========== MLME-Request ============ ######
######               MLME_JOIN               ######
###### ===================================== ######
STATUS      : OK
........
###### =========== MLME-Confirm ============ ######
STATUS      : OK
###### ===========   JOINED     ============ ######

OTAA

DevAddr     :  01481CFE


DATA RATE   : DR_0


###### ============ CTXS STORED ============ ######
Size        : 2208

. joined successfully!
sending internal temperature: 20 °C (0x14)...
###### =========== MCPS-Request ============ ######
######           MCPS_UNCONFIRMED            ######
###### ===================================== ######
STATUS      : OK
success!

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

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

CLASS       : A

TX PORT     : 2
TX DATA     : UNCONFIRMED
14

DATA RATE   : DR_0
U/L FREQ    : 867300000
TX POWER    : 0
CHANNEL MASK: 00FF

In step 3 the device cannot join:

Pico LoRaWAN - OTAA - Temperature + LED

Erasing NVM ... success!
Initilizating LoRaWAN ... DevEui      : XX-XX-XX-XX-XX-XX-XX-XX
JoinEui     : 00-00-00-00-00-00-00-00
Pin         : 00-00-00-00

success!
Joining LoRaWAN network ...
###### =========== MLME-Request ============ ######
######               MLME_JOIN               ######
###### ===================================== ######
STATUS      : OK
.......
###### =========== MLME-Confirm ============ ######
STATUS      : Rx 2 timeout
############################################# cut out a couple of rows here as it is repeated 12 times.

###### =========== MLME-Request ============ ######
######               MLME_JOIN               ######
###### ===================================== ######
STATUS      : Duty-cycle restricted
Next Tx in  : 3507312 [ms]

###### ============ CTXS STORED ============ ######
Size        : 2208

......

The only point that helps at this point is restart at Step 1 from above. - or wait for an hour.
Are those symptoms related to the gateway or the node? I am using RAK7289CV2.
If a pro could give me a hint where to look next or some context I would be very grateful.

LoRaWAN, Raspberry Pi Pico, HOPERF Module RFM95W, The Things Network V3

I wanted to document the configuration steps for European region, TTNv3 and for RFM95.
Based on the articles here:
https://www.raspberrypi.org/blog/how-to-add-lorawan-to-raspberry-pi-pico/
https://www.hackster.io/sandeep-mistry/connect-your-adafruit-feather-rp2040-to-the-things-network-5c0c84

I started with draft of the documentation here:
https://github.com/jbinko/jbinko.github.io/tree/master/RFM95W

But I cannot make it run.
I did exactly what I wrote in the documentation and I believe it is correct based on articles above.
Not sure if I’m missing something specific for European region (like MAC version, Regional Parameters, Tx Power, etc), or source code of pico lorawan project changed meanwhile, TTN changed meanwhile and is not compatible. Not sure.
I tried couple of options/tweaks but it is not able to join TTN network. It always timeouts on Joining LoRaWAN network.
If I use the same RFM module with Arduino + Arduino library I can connect with TTN just fine.
So HW should be OK.

I also received different value for JoinEUI but I guess it is OK and how the library works.
Maybe some more detailed debugging option can help.

Please, if you have any guidance what might be wrong, please let me know.
I guess it is some detail which I didn’t find for my last two weeks of explorations.

Pico LoRaWAN - OTAA - Temperature + LED

Initilizating LoRaWAN ... DevEui : E6-60-58-38-XX-XX-XX-XX
JoinEui : 3B-3A-01-10-XX-XX-XX-XX
Pin : 00-00-00-00

success!
Joining LoRaWAN network ...

=========== MLME-Request ============
MLME_JOIN
=====================================

STATUS : OK

=========== MLME-Confirm ============

STATUS : Rx 2 timeout

How to perform peer to peer communcation using Adafruit Feather RP2040 with RFM95 LoRa Radio - 915MHz

How to connect Adafruit Feather RP2040 with RFM95 LoRa Radio - 915MHz boards link in a peer to peer connection for communication. Using Pico SDK library link for RP2040 microcontroller and your library lorawan-library-for-pico for RFM95 LoRa Radio.

I want to create a peer to peer connection in which a Adafruit Feather RP2040 with RFM95 Board can connect to other Adafruit Feather RP2040 with RFM95 without the need to connect to a LORAWAN Network transmitted by a LORAWAN Tower. Each individual Board in the peer to peer connect should be able to transmit and receive messages to any board in the peer to peer connection.

LoRa Initialisation failed

Hi,

I've been trying to use this library for making a test node for LoRa.
I am using RFM95W with Raspberry Pi Pico.
I've set up the connections as mentioned in the wiki and have changed the region to IN865 in 'config.h'. Also, I am using 3.3V power out from the Pico. However, I still received the LoRa Init failed message.

Upon some tinkering, I managed to get past the Initialization phase after which I'm stuck on Joining with the following loop repeating itself.

`

=========== CTXS RESTORED ===========

Size : 2208

DevEui : E6-60-38-28-23-5C-4B-35
JoinEui : 00-00-00-00-00-00-00-00
Pin : 00-00-00-00

success!
Joining LoRaWAN network ...

=========== MLME-Request ============
MLME_JOIN
=====================================

STATUS : OK

=========== MLME-Confirm ============

STATUS : Tx timeout

=========== MLME-Request ============
MLME_JOIN
=====================================

STATUS : OK

=========== MLME-Confirm ============

STATUS : Tx timeout

=========== MLME-Request ============
MLME_JOIN
=====================================

STATUS : OK

=========== MLME-Confirm ============

STATUS : Tx timeout

=========== MLME-Request ============
MLME_JOIN
=====================================

STATUS : OK

=========== MLME-Confirm ============

STATUS : Tx timeout`

Any help would be appreciated.

LoraWAN initialization fails in SX1276Read(REG_LR_VERSION)

I have built the otaa_temperature_led example for Raspberry Pi Pico

Build goes fine, but executing, in main.c, lorawan_init_otaa fails. I added some debug code to lorawan.c, and I see that the failure occurs in the comparison "SX1276Read(REG_LR_VERSION) != 0x12"

As far as I can see, SX1276Read(REG_LR_VERSION) returns 0

Physical setup is a Waveshare SX127x module for Raspberry Pi Pico, I don't think pictures are necessary

lorawan.c.txt
main.c.txt
config.h.txt
.

frame counter lost after power cycle?

Hi, I would like to ask for help for my problem:

I am running the library without problems but I am at the point I am looking to save battery energy. I managed to put my Pico in deep sleep mode but even in such a state it consumes about 1.8 mA which is way to much. So I was thinking to use an auxiliary mcu such as ATTiny85 to power off my Pico between sensor readings (TinyML stuff) and LoRaWAN sessions then going in deep sleep mode (around 0.0047 mA).

After a power cycle I am not going to join again the network but instead I am invoking only lorawan_init_otaa() then send my payload when ready. Can anybody confirm that thelorawan_init_otaa() is reseting the FCntUp to 0 or they are retrieving the last saved value (if saved)?

Thank you!

'gpio_set_irq_enabled_with_callback' from incompatible pointer type

Hello,

I purchased a Pico-LoRa-SX1262-868M and I'm trying to get it to run with the code-examples from the Waveshare website https://www.waveshare.com/wiki/Pico-LoRa-SX1262-868M which would be updated to be compatible with the Pico-LoRa-SX1262-868M module
I use the main.c example which is for the sx1262 radio module.

main.c.txt

Unfortunately it does not work for me.

While building I got the next warning ...

/home/pi/pico-lorawan/src/boards/rp2040/gpio-board.c: In function 'GpioMcuSetInterrupt':
/home/pi/pico-lorawan/src/boards/rp2040/gpio-board.c:68:73: warning: passing argument 4 of 'gpio_set_irq_enabled_with_callback' from incompatible pointer type [-Wincompatible-pointer-types]
gpio_set_irq_enabled_with_callback(obj->pin,GPIO_IRQ_EDGE_RISE,true,irqHandler);
^~~~~~~~~~
In file included from /home/pi/pico-lorawan/src/boards/rp2040/gpio-board.c:8:
/home/pi/pico/pico-sdk/src/rp2_common/hardware_gpio/include/hardware/gpio.h:384:103: note: expected 'gpio_irq_callback_t' {aka 'void ()(unsigned int, long unsigned int)'} but argument is of type 'void ()(void *)'
void gpio_set_irq_enabled_with_callback(uint gpio, uint32_t events, bool enabled, gpio_irq_callback_t callback);

It seems to be a conflict between the software delivered in the example-code
(/home/pi/pico-lorawan/src/boards/rp2040/gpio-board.c)
and pico-sdk
(/home/pi/pico/pico-sdk/src/rp2_common/hardware_gpio/include/hardware/)

Despite this issue I copied the uf2-file to the board but it will not connect to the network ...

Pico LoRaWAN - OTAA - Temperature + LED

Initilizating LoRaWAN ... success!
Joining LoRaWAN network ................................

I am not a code-engineer and doing this just for hobby but I would appreciate some help to solve this issue.

Thank you in advance,

Eric

P.S. Is there a example code in micropython or circuitpython which makes it easier to code for people like me ;-)

Would it be possible to create a platform release ?

Hi I was just wondering if it is at all possible to have a second candidate that is setup for platformio, as Cmake is messy, complicated and unreliable for noobs like myself who turn to raspberry pi as a simple alternative.
And now that the Pi-Pico is supported via Wiz-IO-Pico on platformio.
Would assume that it would be a trivial exercise for an experienced programmer to convert.
I have all but given up on Cmake as it only works sometimes and often finds the wrong paths.

Thank You

Build failure: Wrong version of LoraMac-node at commit e31d3c1

The latest commit e31d3c1 breaks the build since it refers symbols in a later release of Loramac-node.

This repo refers lib/LoRaMac-node @ 6ff4561, which does not build without compile errors.

Reproduce by doing a fresh git clone:
git clone --recurse-submodules https://github.com/sandeepmistry/pico-lorawan.git
or
git clone --recurse-submodules https://github.com/ArmDeveloperEcosystem/lorawan-library-for-pico.git

[build] ../src/boards/rp2040/eeprom-board.c: In function 'EepromMcuReadBuffer':
build] ../src/boards/rp2040/eeprom-board.c:31:12: error: 'LMN_STATUS_OK' undeclared (first use in this function)
[build] 31 | return LMN_STATUS_OK;
[build] | ^~~~~~~~~~~~~
[build] ../src/boards/rp2040/eeprom-board.c:31:12: note: each undeclared identifier is reported only once for each function it appears in
[build] ../src/boards/rp2040/eeprom-board.c: In function 'EepromMcuWriteBuffer':
[build] ../src/boards/rp2040/eeprom-board.c:38:12: error: 'LMN_STATUS_OK' undeclared (first use in this function)
[build] 38 | return LMN_STATUS_OK;

However this repo builds without compile errors with lib/LoRaMac-node @ 14a79d3 (release 4.5.2)

Support for adafruit_feather_rp2040_rfm9x

Adafruit recently developed and released a new RP2040 board with a LoRa module installed. It is different than the standard RP204 with an externally attached LoRa module. Is there an easy way to modify the definition of "-DPICO_BOARD=adafruit_feather_rp2040" to the newer board?

When I use the otaa_temperature_led example it fails to initialize the the lorawan.
I get this error;

Pico LoRaWAN - OTAA - Temperature + LED

Initilizating LoRaWAN ... failed!!!

I am pretty sure it is because of the design differences in the two boards.

REG_LR_VERSION Error

Hello everyone,

I am actually trying to connect my device to Chirpstack and TTN via ABP. To test this, I am using the hello_abp example sketch.
I get an error when the following code snippet gets executed:

// check version register
if (SX1276Read(REG_LR_VERSION) != 0x12) {
return -1;
}

In my case, the content of the register is 0x00 and an error gets returned. Is this piece of code necessary? Or can I just work my way around it by cutting it out? I already researched what the job of this register could be but I didn't find anything helpful.

Problems linking

Hi,
I'm trying to build a custom project using this project as a library. I followed the instructions in #11 and while everything compiles I'm having problems at the link stage.

...
[build] [ 13%] Linking CXX executable lora-sensor-pico.elf
[build] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: CMakeFiles/lora-sensor-pico.dir/src/main.cpp.obj: in function `main':
[build] /opt/share/playing/lora/pico/lora-sensor-pico/src/main.cpp:57: undefined reference to `lorawan_init_otaa(lorawan_sx1276_settings const*, eLoRaMacRegion, lorawan_otaa_settings const*)'
[build] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: /opt/share/playing/lora/pico/lora-sensor-pico/src/main.cpp:68: undefined reference to `lorawan_join()'
[build] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: /opt/share/playing/lora/pico/lora-sensor-pico/src/main.cpp:70: undefined reference to `lorawan_is_joined()'
[build] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: /opt/share/playing/lora/pico/lora-sensor-pico/src/main.cpp:71: undefined reference to `lorawan_process_timeout_ms(unsigned long)'
[build] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: /opt/share/playing/lora/pico/lora-sensor-pico/src/main.cpp:90: undefined reference to `lorawan_process_timeout_ms(unsigned long)'
[build] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: /opt/share/playing/lora/pico/lora-sensor-pico/src/main.cpp:92: undefined reference to `lorawan_receive(void*, unsigned char, unsigned char*)'
[build] collect2: error: ld returned 1 exit status
[build] make[3]: *** [CMakeFiles/lora-sensor-pico.dir/build.make:1902: lora-sensor-pico.elf] Error 1
[build] make[2]: *** [CMakeFiles/Makefile2:1653: CMakeFiles/lora-sensor-pico.dir/all] Error 2
[build] make[1]: *** [CMakeFiles/Makefile2:1660: CMakeFiles/lora-sensor-pico.dir/rule] Error 2
[build] make: *** [Makefile:186: lora-sensor-pico] Error 2
[build] Build finished with exit code 2

I've run make VERBOSE=1 and the g++ command has the object file for lorawan.c in the list of files to link and running objdump shows the symbols in the file so I'm at a bit of a loss.

All my code is checked in here: https://github.com/hardillb/lora-sensor-pico

Expects pico-sdk and pimaroni-pico checked out next to the project

Any suggestions welcome.

Raspberry Pi Pico with SX1276 does not join The Things Network - "Duty Cycle restricted"

Setup / Environment

  • Raspberry Pi Pico (as Single-Wire Debugger, also serving Power via USB)
  • Raspberry Pi Pico (as target)
  • SX1276 incl. Breakout board [3]
  • EU868 location, living in Germany
  • Own The Things Network Indoor Gateway (v3) at the location
  • Library version: 30d8a0f
  • Pico SDK Version: 1.2.0.
  • Build machine: Fedora 35 with cmake 3.22.1 and arm-none-eabi-gcc 11.1.0

Goal

Using the SX1276 with the lorawan-library-for-pico on a Raspberry Pi Pico.
I'd like to use the library's "hello_otaa" example. The device is expected to
use the OTAA mechanism and the send the "hello world!" message.

I would expect to see the device register at the gateway (gateway logs available
in TTN Gateway Dashboard). After that, I should see a new upstream message in the
Gateway log (and in the device's TTN log).

Issue

After setting the correct values in config.h, enabling LoRa debugging and uploading the example
to the Raspberry Pi Pico target, the following log is displayed on the serial console:

Pico LoRaWAN - Hello OTAA

Initilizating LoRaWAN ... 
###### =========== CTXS RESTORED =========== ######
Size        : 2208

DevEui      : E6-60-D4-A0-XX-XX-XX-XX
JoinEui     : 00-00-00-00-00-00-00-00
Pin         : 00-00-00-00

success!
Joining LoRaWAN network ... 
###### =========== MLME-Request ============ ######
######               MLME_JOIN               ######
###### ===================================== ######
STATUS      : Duty-cycle restricted
Next Tx in  : 3599891 [ms]

(XX-XX-XX-XX was redacted ;-) )

"Duty-cycle restricted" appears and I cannot observe any new LoRa payload messages or
"join" messages on the gateway. The device log in TTN Dashboard stays empty. No sign of
communication. TTN Dashboard says "never connected" about the Raspberry Pi Pico.

Even after wainting for an hour (=3599891 ms) nothing happens. I would have expected the
LoRaWAN stack to re-try the join process, but no more log output appears. Also no updates
on the TTN dashboard.

What I've tried

  • Triple-checked the wiring, also compared to [1] and [2]
  • Checked Device EUI and App EUI with the TTN gateway. Device EUI was retrieved via default_dev_eui example.
  • Checked frequency range of gateway and SX1276. Both are EU868.
  • Checked if my gateway works: It has apparently received some upstream messages by other devices of other LoRa users in the neighborhood. Also tried another public gateway (TTN Indoor Gateway) in the neighborhood
  • Tried another SX1276 breakout board / chipset. I have two of those. Same behavior with both.
  • Tried the exact steps at [2]. @jbinko seems to have gotten it working. The steps differ a bit from the "official" ones, e.g. he sets -DACTIVE_REGION=LORAMAC_REGION_EU868)
  • Tried using the Pico without debug interface (see [4]) but with usual uf2 file transfer. My debug setup does not seem to have influence.
  • Tried building it on an Ubuntu 20.04 machine with cmake 3.16.3 and arm-none-eabi-gcc 9.2.1 20191025
  • Tried Pico SDK 1.3.0

I'm pretty clueless why I can't get my setup working. Maybe I forgot something important,
maybe there were some undocumented changes or I can into a rare bug ;-)
How could I try to debug the issue / what could possible cause the trouble?

I'm aware that this is not a support forum, but there should be plenty of LoRa experts here,
so that's why I think this might be the most appropriate place to ask for some help.

References

Attachments

config.h:

/*
 * Copyright (c) 2021 Arm Limited and Contributors. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 * 
 */

// LoRaWAN region to use, full list of regions can be found at: 
//   http://stackforce.github.io/LoRaMac-doc/LoRaMac-doc-v4.5.1/group___l_o_r_a_m_a_c.html#ga3b9d54f0355b51e85df8b33fd1757eec
#define LORAWAN_REGION          LORAMAC_REGION_EU868

// LoRaWAN Device EUI (64-bit), NULL value will use Default Dev EUI
#define LORAWAN_DEVICE_EUI      "E660D4A0XXXXXXXX"

// LoRaWAN Application / Join EUI (64-bit)
#define LORAWAN_APP_EUI         "0000000000000000"

// LoRaWAN Application Key (128-bit)
#define LORAWAN_APP_KEY         "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

// LoRaWAN Channel Mask, NULL value will use the default channel mask 
// for the region
#define LORAWAN_CHANNEL_MASK    NULL

Changing between PA_BOOST and RFO pins

Hello,

I've compiled the library and the temperature demo, and when using the RFM95W, although from a LoRaWAN protocol perspective it is successful, I'm seeing extremely short range (just a meter to the LoRaWAN gateway is successful), and I believe it could be due to the PA_BOOST pin or RFO pin usage being different to what the LoRaWAN library expects.

How can I switch between the pins? Is there a config setting, or do I need to make a code change in (say) lorawan.c?
I'm still learning the source code, so I'm not familiar with precisely where or how to make the change, to confirm if this is the reason for the extremely short range.

Many thanks!

CLASS C

Hi,

I used "SX1262 LoRa Node Module for Raspberry Pi Pico" in ABP mode "Class A".
I used Dragino Lig16 Gateway for  this project.  
How to use SX1262 with CLASS C Mode?

Can you help me.

Thank you.

Sending wrong Device EUI and Join EUI

I've entered my Device EUI, Join EUI and App Key in config.h of the otaa_temperatur_led example but the data that the gateway receives contains a different Device EUI and Join EUI (which are both the same for some reason).

My config.h file:
Screenshot from 2021-07-28 11-34-34

Minicom output of the Raspberry Pico with RFM95W:
(This already shows the wrong Device EUI and Join EUI)
Screenshot from 2021-07-28 11-33-43

Live data from the gateway with the wrong Device EUI and Join EUI:
Screenshot from 2021-07-28 11-33-35

I am using The Things Network V3 with EU868 configuration.
I've also tried to change LoraWAN MAC version and Regional parameters version in the TTN console, but this has no impact since the minicom output of the pico already shows the wrong Device EUI and Join EUI.

Is there anything I can do to fix this?

Set Transmit Power EU868

Hello,
I am using this library with Chirpstack and a RFM95W transceiver. My code is based on the OTAA example code and I initialized it with the 868 region parameters macro.

Is it possible to manually change the transmit power of the module, or is it part of the 868 region settings? I searched all *.c and *.h files but did not find anything in particular.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.