ChirpChat: FT mode: added bits interleaving

This commit is contained in:
f4exb 2024-04-07 11:43:45 +02:00
parent a6c1dc56c4
commit 872bc8f13f
7 changed files with 48 additions and 18 deletions

View File

@ -54,10 +54,7 @@ void ChirpChatDemodDecoderFT::decodeSymbols(
return;
}
// float *lls = new float[mags.size()*nbSymbolBits]; // bits log likelihoods (>0 for 0, <0 for 1)
// std::fill(lls, lls+mags.size()*nbSymbolBits, 0.0);
FT8::FT8Params params;
// FT8::FT8::soft_decode_mags(params, mags, nbSymbolBits, lls);
int r174[174];
std::string comments;
payloadParityStatus = (int) ChirpChatDemodSettings::ParityOK;
@ -170,7 +167,21 @@ int ChirpChatDemodDecoderFT::decodeWithShift(
float *lls = new float[mags.size()*nbSymbolBits]; // bits log likelihoods (>0 for 0, <0 for 1)
std::fill(lls, lls+mags.size()*nbSymbolBits, 0.0);
FT8::FT8::soft_decode_mags(params, mags, nbSymbolBits, lls);
return FT8::FT8::decode(lls, r174, params, 0, comments);
deinterleave174(lls);
int ret = FT8::FT8::decode(lls, r174, params, 0, comments);
delete[] lls;
return ret;
}
void ChirpChatDemodDecoderFT::deinterleave174(float ll174[])
{
// 174 = 2*3*29
float t174[174];
std::copy(ll174, ll174+174, t174);
for (int i = 0; i < 174; i++) {
ll174[i] = t174[(i%6)*29 + (i%29)];
}
}
#endif // HAS_FT8

View File

@ -57,6 +57,7 @@ private:
std::string& comments,
int shift = 0
);
static void deinterleave174(float ll174[]);
};

View File

@ -953,16 +953,6 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="headerCRCStatus">
<property name="toolTip">
<string>Header CRC status</string>
</property>
<property name="text">
<string> HC </string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="headerHammingStatus">
<property name="toolTip">
@ -973,6 +963,16 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="headerCRCStatus">
<property name="toolTip">
<string>Header CRC status</string>
</property>
<property name="text">
<string> HC </string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="payloadFECStatus">
<property name="toolTip">

View File

@ -11,7 +11,7 @@ LoRa is a property of Semtech and the details of the protocol are not made publi
- To get an idea of what is LoRa: [here](https://www.link-labs.com/blog/what-is-lora)
- A detailed inspection of LoRa modulation and protocol: [here](https://static1.squarespace.com/static/54cecce7e4b054df1848b5f9/t/57489e6e07eaa0105215dc6c/1464376943218/Reversing-Lora-Knight.pdf)
&#9888; Only spread factors of 11 and 12 are working in LoRa mode thus with the distance enhancement active (DE=2)
&#9888; Only spread factors of 11 and 12 are working in LoRa mode with the distance enhancement active (DE=2)
Transmissions from the RN2483 module (SF=11 and SF=12 with DE=2) could be successfully received. It has not been tested with Semtech SX127x hardware. This LoRa decoder is designed for experimentation. For production grade applications it is recommended to use dedicated hardware instead.
@ -110,7 +110,9 @@ This is the Spread Factor parameter of the ChirpChat signal. This is the log2 of
The LoRa standard specifies 0 (no DE) or 2 (DE active). The ChirpChat DE range is extended to all values between 0 and 4 bits.
This is the log2 of the number of FFT bins used for one symbol. Extending the number of FFT bins per symbol decreases the probability to detect the wrong symbol as an adjacent bin. It can also overcome frequency drift on long messages.
The LoRa standard also specifies that the LowDataRateOptimizatio flag (thus DE=2 vs DE=0 here) should be set when the symbol time defined as BW / 2^SF exceeds 16 ms (See section 4.1.1.6 of the SX127x datasheet). In practice this happens for SF=11 and SF=12 and large enough bandwidths (you can do the maths).
Here this value is the log2 of the number of FFT bins used for one symbol. Extending the number of FFT bins per symbol decreases the probability to detect the wrong symbol as an adjacent bin. It can also overcome frequency or samlping time drift on long messages particularly for small bandwidths.
In practice it is difficult to make correct decodes if only one FFT bin is used to code one symbol (DE=0) therefore it is recommended to use a DE factor of 2 or more. With medium SNR DE=1 can still achieve good results.

View File

@ -74,6 +74,8 @@ void ChirpChatModEncoderFT::encodeMsg(
int iBit;
int symbol = 0;
interleave174(a174);
for (int i = 0; i < allBits; i++)
{
iBit = nbSymbolBits - (i % nbSymbolBits) - 1; // MSB first
@ -230,4 +232,15 @@ void ChirpChatModEncoderFT::encodeMsgFinish(const QString& myCall, const QString
FT8::FT8::encode(a174, a77);
}
void ChirpChatModEncoderFT::interleave174(int a174[])
{
// 174 = 2*3*29
int t174[174];
std::copy(a174, a174+174, t174);
for (int i = 0; i < 174; i++) {
a174[i] = t174[(i%6)*29 + (i%29)];
}
}
#endif // HAS_FT8

View File

@ -43,6 +43,7 @@ private:
static void encodeMsgReply(const QString& myCall, const QString& urCall, const QString& myLocator, int a174[]);
static void encodeMsgReport(const QString& myCall, const QString& urCall, const QString& myReport, int reply, int a174[]);
static void encodeMsgFinish(const QString& myCall, const QString& urCall, const QString& shorthand, int a174[]);
static void interleave174(int a174[]);
};
#endif // PLUGINS_CHANNELTX_MODCHIRPCHAT_CHIRPCHATMODENCODEFT_H_

View File

@ -74,13 +74,15 @@ The ChirpChat signal is oversampled by four therefore it needs a baseband of at
<h3>5: Spread Factor</h3>
This is the Spread Factor parameter of the ChirpChat signal. This is the log2 of the possible frequency shifts used over the bandwidth (3). The number of symbols is 2<sup>SF-DE</sup> where SF is the spread factor and DE the Distance Enhancement factor (8). To
This is the Spread Factor parameter of the ChirpChat signal. This is the log2 of the possible frequency shifts used over the bandwidth (3). The number of symbols is 2<sup>SF-DE</sup> where SF is the spread factor and DE the Distance Enhancement factor (6).
<h3>6: Distance Enhancement factor</h3>
The LoRa standard specifies 0 (no DE) or 2 (DE active). The ChirpChat range is extended to all values between 0 and 4 bits.
This is the log2 of the number of frequency shifts separating two consecutive shifts that represent a symbol. On the receiving side this decreases the probability to detect the wrong symbol as an adjacent FFT bin. It can also overcome frequency drift on long messages.
The LoRa standard also specifies that the LowDataRateOptimization flag (thus DE=2 vs DE=0 here) should be set when the symbol time defined as BW / 2^SF exceeds 16 ms (See section 4.1.1.6 of the SX127x datasheet). In practice this happens for SF=11 and SF=12 and large enough bandwidths (you can do the maths).
Here this value is the log2 of the number of frequency shifts separating two consecutive shifts that represent a symbol. On the receiving side this decreases the probability to detect the wrong symbol as an adjacent FFT bin. It can also overcome frequency or sampling time drift on long messages particularly for small bandwidths.
In practice it is difficult on the Rx side to make correct decodes if only one FFT bin is used to code one symbol (DE=0). It is therefore recommended to use a factor of 1 or more.