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
619 stars 65 forks source link

Difficulties decoding meshtastic #91

Open miweber67 opened 2 months ago

miweber67 commented 2 months ago

First, thanks for the awesome work!

I've been trying to decode a local meshtastic network and having poor results (<5% of received frames have valid CRCs, even with SNR's exceeding +10dB). Headers always seem to have valid CRCs. I've tried an airspy mini and an rtlsdr on the front end with similar results. I've tried Fs between 1e6 and 6e6 and filtering/decimation to achieve os_factors from 4 to 24. The beginnings of the frames 'look' correct, e.g. the first four bytes are 0xff, which corresponds to a 'broadcast' destination address.

Local meshtastic nodes are using the 'long_moderate' preset, which corresponds to 125kHz with SF=11 and 4/8 coding. The preamble length is claimed to be 16, but manually counting the sweeps in gr_fosphor reveals somewhere between 16 and 18 upsweeps for the preamble. The network ID is '0x2B.' Payload lengths vary between 40 and 70 bytes, typically.

What is a good target number for the frame_sync's 'os_factor?' Is soft decoding expected to work better than not using it?

I'm not sure if I have a sub-optimal receiver configuration or if there is just some difficulty decoding the particular parameters meshtastic is using. Thanks for any thoughts you have. I can supply IQ recordings if that would help.

tapparelj commented 2 months ago

Hello @miweber67, there definitively is something off if you only receive a few correct frames at such a high SNR.

Some questions:

miweber67 commented 2 months ago

@tapparelj , thanks for the response! I can certainly do what you asked.

Please find attached the tag_debug log, console output from the session. 53 frames detected, 5 crc valid. CFO int mostly between -60 and 30. CFO frac varies.

Carrier frequency is 903.0625MHz. You'll see some frequency shifting blocks in the script, but these are only to support offset collection and channelization for inspecting different channels. The lora decode performance is the same without them. There's also a filter to get rid of adjacent channel interference. Removing the filter drops detections to 33 and valid CRCs to 4.

Also attached is the grc file, although I had to rename it .txt because github wouldn't accept it as .grc.

Thanks much for your help!

tag_debug.txt lora-rx-file.txt

EDIT: Here is the preamble and first part of a packet from meshtastic; I count 18 upchirps in the preamble? Is that right?

Screenshot 2024-04-29 202044

mskvortsov commented 2 months ago

Sorry for interfering, but I think it's not worth creating a separate issue since my observation might be related to this one.

I have two signals, both contain some meshtastic packets with the same channel settings corresponding to the LongFast preset: SF 11, BW 250KHz, preamble length 16, sync word 0x2b. Center frequency is 869.075 MHz, 1 Msps sampling rate.

sample2.griq.xz is decoded successfully with the sync word set to expected 0x2b (or [16, 88] in the full form). However, to decode sample1.griq.xz I need to set the sync word to [16, 2008].

Is it expected? Am I missing something?

tapparelj commented 2 months ago

Hello @miweber67, First to answer some questions:

I've checked connecting the transmitter to the receiver you configured and it seems to work as expected even at low SNR and with reference clock frequency offset. So I don't see anything strange. Would it be possible to have access to the sample you use that lead to a wrong decoding as well as the payload that is transmitted? (one or two frame would be enough) so that I can identify which part of the receiver seems to fail?

miweber67 commented 2 months ago

@tapparelj , thanks for your efforts! Here are two slices of the capture file with one bad packet each. These slices have been filtered and decimated by 3 to 500kSps, so you should be able to feed them straight in to frame_sync with os_factor 4.

903062500-0.5MSs-extract-filt-decim-1.c64.gz 903062500-0.5MSs-extract-filt-decim-2.c64.gz