tapparelj / gr-lora_sdr

This is the fully-functional GNU Radio software-defined radio (SDR) implementation of a LoRa transceiver with all the necessary receiver components to operate correctly even at very low SNRs. This work has been conducted at the Telecommunication Circuits Laboratory, EPFL.
https://www.epfl.ch/labs/tcl/
GNU General Public License v3.0
631 stars 65 forks source link

SDR With sigfox STM32L0 Discovery kit LoRa as node. #37

Closed Stianje closed 1 year ago

Stianje commented 1 year ago

Hello, I hope this post finds you well. I am currently working with an SDR and a STM node for testing purposes. I have been receiving packages through the RX chain, but have noticed that they are being flagged as "Header checksum invalid!". I have been trying to troubleshoot this issue by receiving the packages before the header check, and they are encrypted following the LoRaWAN documentation. I have successfully decrypted the package, but it does not seem to match the expected output. I was wondering if the RX chain in this repository follows the LoRaWAN documentation? Any insight or guidance would be greatly appreciated.

tapparelj commented 1 year ago

Hello @Stianje, This repository only implements the LoRa physical layer, not the LoRaWAN MAC layer. If you send messages from a device following the LoRaWAN specifications, you should be able to detect the frame, decode the explicit header correctly and recover the payload, however the payload will contain a MAC header (prepend by LoRaWAN) and still be encrypted. I'm surprised the header checksum test fails as it let me think the configuration you did is mostly correct as the preamble gets detected. If I remember correctly, LoRaWAN devices use the sync word 0x34. Did you set it up in the frame sync block? Can you double check the spreading factor and the bandwidth you use at both the transmitter and receiver?

Stianje commented 1 year ago

Thanks for the quick response, I have been testing for a bit and have not been able to resolve the issue with the header checksum. I am trying to use the SDR as a gateway and have it publish the data. I have the sync word setting in the Frame sync block is set to "0x3444". I am using the STM32 ICube end_node code for the node. As a beginner in this topic, I am having trouble locating the spreading factor and bandwidth settings in the STM code, but I believe they should be set to default values of SF7 and BW125k.

GNU Radio Companion: Screenshot from 2023-01-26 13-32-32

Running w/ waterfall: Screenshot from 2023-01-26 13-34-43

I would greatly appreciate any additional information or guidance you can provide on this issue.

tapparelj commented 1 year ago

I see a few things here:

Let me know if the issue changes

Stianje commented 1 year ago

Ok, thanks again for taking the time. I changed as you said.

This is the updated GNU: Screenshot from 2023-01-26 14-10-19

Updated results with frame sync block sync word 0x34: Screenshot from 2023-01-26 14-19-59 I do not get any output on this...

In the cmwx1zzabz_0xx.list STM32 file: image

tapparelj commented 1 year ago

sorry, can you set the os_factor to 16 not 8 (of course 2MHz/125kHz is not 8, my bad)

Stianje commented 1 year ago

No problem, Still not any output...

Updated result: Screenshot from 2023-01-26 14-39-26

tapparelj commented 1 year ago

I am a bit surprised by the look of the waterfall, as nothing in it looks like a LoRa frame, but more like some FHSS modulation. If you don't mind, could you use something like cubicSDR to have a good waterfall view of the spectrum?. (In order to check if what you transmit )

tapparelj commented 1 year ago

as an example this is the signal received for sf7 and sf12 Screenshot from 2023-01-26 14-52-55 Screenshot from 2023-01-26 14-57-32

Stianje commented 1 year ago

I encountered some difficulties during the installation of CubicSDR. However, after some troubleshooting, I discovered that the problem seemed to stem from the spreading factor (sf) value in the STM code. It turns out that the default value for sf in the code is not SF7 as I initially assumed, but rather SF12. Once I made this correction, I noticed improvement. I will continue to work on this issue, but I wanted to share this information in case it helps others who may be facing the same problem. Based on my current understanding, does this solution seem correct to you?

Progress: Screenshot from 2023-01-26 16-53-27

A packet decoded: Screenshot from 2023-01-26 17-02-00

tapparelj commented 1 year ago

Yes, the header is found and the checksum is correct. In addition if the CRC is valid, it means that you received the entire payload correctly. Then you have to decode the payload yourself as it's encoded by the MAC layer, which is not implemented in this repository for now.

Stianje commented 1 year ago

Thank you for your hard work and guidance. We were able to successfully resolve this. I'm closing this issue now.