Lora send example on nRF52DK NRF52840 development board

Hello. I am trying to set up a basic Lora send example on my nRF52DK NRF52840 development board:https://www.nordicsemi.com/Products/Development-hardware/nrf52840-dk
The issue that I am getting:

[00:00:00.453,094] [1B][0m<inf> sx127x: SX127x version 0x12 found[1B][0m
*** Booting Zephyr OS build v3.3.99-ncs1 ***
[00:00:01.111,328] [1B][1;31m<err> sx12xx_common: Packet transmission failed![1B][0m
[00:00:01.111,816] [1B][1;31m<err> lora_send: LoRa send failed[1B][0m

You can access my example project that I used here: https://github.com/krupis/nrf52_lora

It is basically the same as original zephyr LoRa Send Sample that you can find in zephyr/samples/drivers/lora/send. I have just added a board overly and configured SPI lora device (semtech, sx1276) there.

My board overlay looks as following:

&spi1 {
	compatible = "nordic,nrf-spi";
	status = "okay";
	cs-gpios = <&gpio1 6 (GPIO_ACTIVE_LOW)>;
	pinctrl-0 = <&spi1_default>;
	pinctrl-1 = <&spi1_sleep>;
	pinctrl-names = "default", "sleep";
	lora0: sx1276@0 {
		compatible = "semtech,sx1276";
		reg = <0>;
		reset-gpios = <&gpio1 7 GPIO_ACTIVE_LOW>;
		dio-gpios = <&gpio1 5 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>,
					<&gpio1 4 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>,
					<&gpio1 3 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>;
		power-amplifier-output = "pa-boost";
		spi-max-frequency = <125000>;
	};
};

/ {
     aliases {
             lora0 = &lora0;
     };
};

I have made the following hardware connections between the nRF52DK and the LoRa module:

Additionally, I have connected Salae Logic analyzer to SPI pins to monitor and debug the signal.

https://www.saleae.com/downloads/

I have saved captured SPI waveforms and attached it to wetransfer link. You can download the file and import to Salae to see the full waveforms:

https://we.tl/t-mOOzuf1Wdj

I can see that it is trying to send "helloworld" message:

but after about 0.6seconds, I see the following on the SPI lines:

I have been stuck at this point for a few weeks now without much progress. I would very much appreciate any help! Thanks in advance

  • Update:

    I think the issue was with my dio-gpios

    I initially had the following in board overlay:

    &spi1 {
    	compatible = "nordic,nrf-spi";
    	status = "okay";
    	cs-gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
    	pinctrl-0 = <&spi1_default>;
    	pinctrl-1 = <&spi1_sleep>;
    	pinctrl-names = "default", "sleep";
    	lora0: sx1276@0 {
    		compatible = "semtech,sx1276";
    		reg = <0>;
    		reset-gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
    		dio-gpios = <&gpio0 24 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>,
    					<&gpio0 22 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>,
    					<&gpio0 17 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>;
    		power-amplifier-output = "pa-boost";
    		spi-max-frequency = <125000>;
    	};
    };
    
    / {
         aliases {
                 lora0 = &lora0;
         };
    };
    

    and now I have replaced it with:
    &spi1 {
    	compatible = "nordic,nrf-spi";
    	status = "okay";
    	cs-gpios = <&gpio1 6 (GPIO_ACTIVE_LOW)>;
    	pinctrl-0 = <&spi1_default>;
    	pinctrl-1 = <&spi1_sleep>;
    	pinctrl-names = "default", "sleep";
    	lora0: sx1276@0 {
    		compatible = "semtech,sx1276";
    		reg = <0>;
    		reset-gpios = <&gpio1 7 GPIO_ACTIVE_LOW>;
    		dio-gpios = <&gpio1 5 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>;
    		power-amplifier-output = "pa-boost";
    		spi-max-frequency = <125000>;
    	};
    };
    
    / {
         aliases {
                 lora0 = &lora0;
         };
    };
    
    As you can see form above, I have changed the dio-gpios and I have made a HW connection betweion DIO0 on LoRa modem and nRF52DK. Now I am able to send the data:
    [00:00:00.564,636] [1B][0m<inf> sx127x: SX127x version 0x12 found[1B][0m
    *** Booting Zephyr OS build v3.3.99-ncs1 ***
    [00:00:00.934,387] [1B][0m<inf> lora_send: Data sent![1B][0m
    [00:00:02.229,797] [1B][0m<inf> lora_send: Data sent![1B][0m
    [00:00:03.524,810] [1B][0m<inf> lora_send: Data sent![1B][0m
    [00:00:04.819,824] [1B][0m<inf> lora_send: Data sent![1B][0m
    [00:00:06.114,837] [1B][0m<inf> lora_send: Data sent![1B][0m
    [00:00:07.409,851] [1B][0m<inf> lora_send: Data sent![1B][0m
    [00:00:08.704,864] [1B][0m<inf> lora_send: Data sent![1B][0m
    [00:00:09.999,877] [1B][0m<inf> lora_send: Data sent![1B][0m
    [00:00:11.294,891] [1B][0m<inf> lora_send: Data sent![1B][0m
    [00:00:12.589,904] [1B][0m<inf> lora_send: Data sent![1B][0m
    [00:00:13.884,918] [1B][0m<inf> lora_send: Data sent![1B][0m
    [00:00:15.179,931] [1B][0m<inf> lora_send: Data sent![1B][0m
    [00:00:16.474,945] [1B][0m<inf> lora_send: Data sent![1B][0m
    [00:00:17.769,958] [1B][0m<inf> lora_send: Data sent![1B][0m
    [00:00:19.064,971] [1B][0m<inf> lora_send: Data sent![1B][0m
    [00:00:20.359,985] [1B][0m<inf> lora_send: Data sent![1B][0m
    I think the my issue was that I did not connect the DIO0 pin initially, and the example is probably using this pin for DIO0 TX complete callback. Is there any documentation about the sample LoRa project that I can find with explanations on how it works?
    I also want to know what DIO's I need to use for this particular sample project. I have already figured out that I need to use DIO0 for TX complete callback, maybe there are other DIO's that are configured by this project by default? Is it documented somewhere or the only way to figure this out is to dig deep into the source code?
     
  • Hi,

    The LORA sample is part of Zephyr but not made by Nordic, so unfortunately we are not able to say much about it. I suggest you ask Semtech questions related to how to use the LoRa radio.

Related