LoRaWAN on Zephyr SX1276 & SX1262

Dear All.

I tried to test and evaluate LoRaWAN stack on Zephyr, without success. I will need more time to debug what is happening by the logic analyzer. Meantime I attached the configurations to confirm, if anybody tried the same.

SX1276MB1LAS  + nrf52832-DK:

&spi0 {
          compatible = "nordic,nrf-spi";
          status = "okay";
          mosi-pin = <23>;
          miso-pin = <24>;
          sck-pin = <25>;
          cs-gpios = <&gpio0 22 GPIO_ACTIVE_LOW>;
          miso-pull-up;

          lora0: sx1276@0 {
                    compatible = "semtech,sx1276";
                    reset-gpios = <&gpio0 3 GPIO_ACTIVE_LOW>;
                    dio-gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>,
                                <&gpio0 14 GPIO_ACTIVE_HIGH>,
                                <&gpio0 15 GPIO_ACTIVE_HIGH>,
                                <&gpio0 16 GPIO_ACTIVE_HIGH>,
                                <&gpio0 19 GPIO_ACTIVE_HIGH>,
                                <&gpio0 20 GPIO_ACTIVE_HIGH>;
                     //antenna-enable-gpios = <&gpio0 30 GPIO_ACTIVE_HIGH>;
                    power-amplifier-output = "pa-boost";
                    reg = <0>;
                    spi-max-frequency = <1000000>;
                    label = "SX1276";
           };
};

SX1262MB2CAS + nrf52832-DK:

&spi0 {
       compatible = "nordic,nrf-spi";
       status = "okay";
       miso-pin = <24>;
       mosi-pin = <23>;
       sck-pin = <25>;
       cs-gpios = <&gpio0 18 GPIO_ACTIVE_LOW>;
       miso-pull-up;

       lora0: sx1262@0 {
          compatible = "semtech,sx1262";
          reg = <0>;
          label = "sx1262";
          reset-gpios = <&gpio0 3 GPIO_ACTIVE_LOW>;
          antenna-enable-gpios = <&gpio0 19 GPIO_ACTIVE_LOW>;
          busy-gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>;
          dio1-gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;
          spi-max-frequency = <1000000>;
      };
};

# enable SPI
CONFIG_SPI=y
CONFIG_SPI_NRFX=y

# Enable the SX12XX radio driver for Lora
CONFIG_LORA=y
CONFIG_LORA_LOG_LEVEL_DBG=y
CONFIG_LORA_SX12XX=y
CONFIG_LORA_SX127X=y

# Enable the Lorawan stack
CONFIG_LORAWAN=y
CONFIG_LORAWAN_LOG_LEVEL_DBG=y
CONFIG_HAS_SEMTECH_LORAMAC=y
CONFIG_HAS_SEMTECH_SOFT_SE=y
CONFIG_HAS_SEMTECH_RADIO_DRIVERS=y
# Define the Lorawan region to be used
CONFIG_LORAMAC_REGION_AU915=y
#CONFIG_LORAMAC_REGION_US915=y
#CONFIG_LORAWAN_SYSTEM_MAX_RX_ERROR=90

seems that it is not transmitting anything...

00> [00:00:00.271,942] <dbg> sx126x.sx126x_lora_init: Initializing sx1262
00> [00:00:00.272,033] <dbg> sx126x.SX126xReset: Resetting radio
00> [00:00:00.302,398] <dbg> sx126x.SX126xIoIrqInit: Configuring DIO IRQ callback
00> [00:00:00.302,520] <dbg> sx126x.SX126xWakeup: Sending GET_STATUS
00> [00:00:00.302,703] <dbg> sx126x.SX126xWakeup: Waiting for device...
00> [00:00:00.302,703] <dbg> sx126x.SX126xWakeup: Device ready
00> [00:00:00.302,734] <dbg> sx126x.SX126xWriteCommand: Issuing opcode 0x80 w. 1 bytes of data
00> [00:00:00.302,947] <dbg> sx126x.SX126xSetOperatingMode: SetOperatingMode: STDBY_RC (1)
00> [00:00:00.302,947] <dbg> sx126x.SX126xIoTcxoInit: No TCXO configured
00> [00:00:00.302,978] <dbg> sx126x.SX126xIoRfSwitchInit: Configuring DIO2
00> [00:00:00.302,978] <dbg> sx126x.SX126xWriteCommand: Issuing opcode 0x9d w. 1 bytes of data
00> [00:00:00.303,192] <dbg> sx126x.SX126xSetOperatingMode: SetOperatingMode: STDBY_RC (1)
00> [00:00:00.303,19
00> [00:00:05.719,268] <dbg> sx126x.SX126xWriteCommand: Issuing opcode 0x80 w. 1 bytes of data
00> [00:00:05.719,390] <dbg> sx126x.SX126xWakeup: Sending GET_STATUS
00> [00:00:05.719,543] <dbg> sx126x.SX126xWakeup: Waiting for device...
00> [00:00:05.720,703] <dbg> sx126x.SX126xWakeup: Device ready
00> [00:00:05.720,703] <dbg> sx126x.SX126xAntSwOn: Enabling antenna switch
00> [00:00:05.720,916] <dbg> sx126x.SX126xSetOperatingMode: SetOperatingMode: STDBY_RC (1)
00> [00:00:05.720,947] <dbg> sx126x.SX126xWriteCommand: Issuing opcode 0x86 w. 4 bytes of data
00> [00:00:05.722,351] <dbg> sx126x.SX126xWriteCommand: Issuing opcode 0x9f w. 1 bytes of data
00> [00:00:05.722,564] <dbg> sx126x.SX126xWriteCommand: Issuing opcode 0x80 w. 1 bytes of data
00> [00:00:05.722,778] <dbg> sx126x.SX126xSetOperatingMode: SetOperatingMode: STDBY_RC (1)
00> [00:00:05.722,808] <dbg> sx126x.SX126xWriteCommand: Issuing opcode 0x8a w. 1 bytes of data
00> [00:00:05.723,052] <dbg> sx126x.SX126xWriteCommand: Issuing opcode 0x8b w. 4 bytes of data
00> [00:00:05.724,426] <dbg> sx1[00:00:05.725,402] <dbg> sx126x.SX126xWriteRegisters: Writing 1 registers @ 0x736: 0x9 , ...
00> [00:00:05.725,646] <dbg> sx126x.SX126xWriteCommand: Issuing opcode 0x8c w. 6 bytes of data
00> [00:00:05.725,891] <dbg> sx126x.SX126xWriteCommand: Issuing opcode 0x8 w. 8 bytes of data
00> [00:00:05.726,165] <dbg> sx126x.SX126xSetOperatingMode: SetOperatingMode: RX (5)
00> [00:00:05.726,196] <dbg> sx126x.SX126xWriteRegisters: Writing 1 registers @ 0x8ac: 0x94 , ...
00> [00:00:05.726,440] <dbg> sx126x.SX126xWriteCommand: Issuing opcode 0x82 w. 3 bytes of data
00> [00:00:05.775,939] <dbg> sx126x.sx126x_dio1_irq_work_handler: Processing DIO1 interrupt
00> [00:00:05.776,000] <dbg> sx126x.SX126xReadCommand: Issuing opcode 0x12 (data size: 2)
00> [00:00:05.776,214] <dbg> sx126x.SX126xReadCommand: -> status: 0xa6
00> [00:00:05.776,245] <dbg> sx126x.SX126xWriteCommand: Issuing opcode 0x2 w. 2 bytes of data
00> [00:00:05.776,458] <dbg> sx126x.SX126xSetOperatingMode: SetOperatingMode: STDBY_RC (1)
00> [00:00:05.776,489] <dbg> sx126x.SX126xAntSwOff: Disabling antenna switch
00> [00:00:05.776,489] <dbg> sx126x.SX126xWriteCommand: Issuing opcode 0x84 w. 1 bytes of data
00> [00:00:05.776,702] <dbg> sx126x.SX126xSetOperatingMode: SetOperatingMode: SLEEP (0)
00> [00:00:06.739,990] <dbg> sx126x.SX126xWriteCommand: Issuing opcode 0x80 w. 1 bytes of data
00> [00:00:06.740,051] <dbg> sx126x.SX126xWakeup: Sending GET_STATUS
00> [00:00:06.740,173] <dbg> sx126x.SX126xWakeup: Waiting for device...
00> [00:00:06.741,363] <dbg> sx126x.SX126xWakeup: Device ready
00> [00:00:06.741,394] <dbg> sx126x.SX126xAntSwOn: Enabling antenna switch
00> [00:00:06.741,607] <dbg> sx126x.SX126xSetOperatingMode: SetO0m
00> [00:00:06.743,011] <dbg> sx126x.SX126xWriteCommand: Issuing opcode 0x9f w. 1 bytes of data
00> [00:00:06.743,255] <dbg> sx126x.SX126xWriteCommand: Issuing opcode 0x80 w. 1 bytes of data
00> [00:00:06.743,469] <dbg> sx126x.SX126xSetOperatingMode: SetOperatingMode: STDBY_RC (1)
00> [00:00:06.743,469] <dbg> sx126x.SX126xWriteCommand: Issuing opcode 0x8a w. 1 bytes of data
00> [00:00:06.743,682] <dbg> sx126x.SX126xWriteCommand: Issuing opcode 0x8b w. 4 bytes of data
00> [00:00:06.745,086] <dbg> sx126x.SX126xWriteCommand: Issuing opcode 0x8c w. 6 bytes of data
00> [00:00:06.745,360m
00> [00:00:06.745,574] <dbg> sx126x.SX126xWriteRegisters: Writing 1 registers @ 0x706: 0x28 , ...
00> [00:00:06.745,819] <dbg> sx126x.SX126xReadRegisters: Reading 1 registers @ 0x736
00> [00:00:06.746,032] <dbg> sx126x: register_value
00> 0d |.
00> [00:00:06.746,063] <dbg> sx126x.SX126xWriteRegisters: Writing 1 registers @ 0x736: 0x9 , ...
00> [00:00:06.746,307] <dbg> sx126x.SX126xWriteCommand: Issuing opcode 0x8c w. 6 bytes of data
00> [00:00:06.746,551] <dbg> sx126x.SX126xWriteCommand: Issuing opcode 0x8 w. 8 bytes of data
00> [00:00:06.746,917] <dbg> sx126x.SX126xSetOperatingMode: SetOperatingMode: RX (5)
00> [00:00:06.746,948] <dbg> sx126x.SX126xWriteRegisters: Writing 1 registers @ 0x8ac: 0x94 , ...
00> [00:00:06.747,161] <dbg> sx126x.SX126xWriteCommand: Issuing opcode 0x82 w. 3 bytes of data
00> [00:00:06.829,437] <dbg> sx126x.sx126x_dio1_irq_work_handler: Processing DIO1 interrupt
00> [00:00:06.829,528] <dbg> sx126x.SX126xReadCommand: Issuing opcode 0x12 (data size: 2)
00> [00:00:06.829,742] <dbg> sx126x.SX126xReadCommand: -> status: 0xa6
00> [00:00:06.829,772] <dbg> sx126x.SX126xWriteCommand: Issuing opcode 0x2 w. 2 bytes of data
00> [00:00:06.830,017] <dbg> sx126x.SX126xSetOperatingMode: SetOperatingMode: STDBY_RC (1)
00> [00:00:06.830,017] <dbg> sx126x.SX126xAntSwOff: Disabling antenna switch
00> [00:00:06.830,047] <dbg> sx126x.SX126xWriteCommand: Issuing opcode 0x84 w. 1 bytes of data
00> [00:00:06.830,261] <dbg> sx126x.SX126xSetOperatingMode: SetOperatingMode: SLEEP (0)
00> [00:00:06.832,458] <dbg> lorawan.MlmeConfirm: Received MlmeConfirm (for MlmeRequest 1)
00> [00:00:06.832,489] <err> lorawan: MlmeConfirm failed : Rx 2 timeout
00> [00:00:06.835,357] <err> lorawan_class_a: lorawan_join_network failed: -116

Thanks in advance...

Parents
  • Were you able to get your LoRaWAN app to work?

    I am trying the get the lorawan sample to work on the nRF52840DK with an SX1262 shield attached.  I've confirmed the hardware with the simple Tx and Rx point-to-point demos.  But I've not had much success with the lorawan sample.  I see my Join Request at the gateway and the gateway sends back a successful Join Accept.  But the the lorawan app never receives any packet and then times out.

  • yes, I tested the latest release 2.1.0 and it is working

  • Hello. I know its been a while but I am to get the SX1276MB1LAS to experiment with LoRa. Do you have a sample project that you use for basic transmit/receive?

  • We created a simple point-to-point test using the samples in the SDK for inpsiration:  zephyr\samples\drivers\lora\receive, and the corresponding ...\send.

    For a LoRaWAN test, we used the example in GitHub at:  https://github.com/Lora-net/SWSD001/tree/master/apps/examples/lorawan

  • Thanks for the response. I have tried the drivers/lora/receive and drivers/lora/send sample projects without any luck yet.

    I have connected NRF52DK to the LoRa SX1278 module as described below:

    In my .overlay file, I have the following:

    	&spi1 {
    		status = "okay";
    		cs-gpios = <&gpio0 28 GPIO_ACTIVE_LOW>;
    		lora: sx1276@0 {
    			compatible = "semtech,sx1276";
    			reg = <0>;
    			reset-gpios = <&gpio0 4 GPIO_ACTIVE_LOW>;
    			dio-gpios = <&gpio0 3 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>;
    			power-amplifier-output = "pa-boost";
    			spi-max-frequency = <125000>;
    		};
    	};
    

    Since the sample project does not come with an board overlay example, I had to come up with my own so its possible I have made some mistake there.

    Some things that are not fully clear to me :

    1. Do I MUST use DIO's or for this simple example I only need SPI pins? Sice I had to declare atleast one DIO in order for the overlay to be valid, I have declared DIO0 as GPIO3

    2. What is power-amplifier-output property and what does "pa-boost" mean?

    3. VDD voltage on the NRF52DK is not actually 3.3V but about 3.0V. Is that an issue?

    The serial logs:

    19:41: [00:00:00.465,972] [1B][0m<inf> sx127x: SX127x version 0x00 found[1B][0m
    *** Booting Zephyr OS build v3.3.99-ncs1 ***
    [00:00:01.079,467] [1B][1;31m<err> sx12xx_common: Packet transmission failed![1B][0m
    [00:00:01.079,956] [1B][1;31m<err> lora_send: LoRa send failed[1B][0m

    Since I cant spot any obvious mistake, I think the next step would be to connect signal analyzer to SPI pins and check how does the communication look like...

  • I am not familiar with the SX1278 module you are using. You might have to find its schematic to see exactly which pins might be needed. For example, You probably need to add "dio2-tx-enable;" to drive the RF switch on the module. This tells the sx1278 to use its own DIO2 output (not to be confused with the DIO1-3 on the host interface) to control the RF switch.

    For your board overlay, you might find some useful info from the example overlays at:
        zephyr\boards\shields\semtech_sx1262mb2das
        zephyr\boards\shields\semtech_sx1272mb2das

    I believe the send/receive samples only use DIO1 for the interrupt input. The source that sets up the reset, busy, and dio1 GPIOs is in zephyr\drivers\lora\sx126x_standalone.c, lines 16-21.  I have not found any use of DIO0, DIO2, or DIO3. I also do not believe the "power-amplifier-output" line is needed by this driver.
    Good luck!

  • do you solve the problem? i have the same issue

Reply Children
No Data
Related