Towards an SDR implementation of LoRa: Reverse-engineering, demodulation strategies and assessment over Rayleigh channel Alexandre Marquet, Nicolas Montavont, Georgios Papadopoulos
To cite this version:
Alexandre Marquet, Nicolas Montavont, Georgios Papadopoulos. Towards an SDR implementation of LoRa: Reverse-engineering, demodulation strategies and assessment over Rayleigh channel. Computer Communications, Elsevier, In press, 10.1016/j.comcom.2020.02.034. hal-02485052
HAL Id: hal-02485052 https://hal.archives-ouvertes.fr/hal-02485052 Submitted on 19 Feb 2020
HAL is a multi-disciplinary open access L’archive ouverte pluridisciplinaire HAL, est archive for the deposit and dissemination of sci- destinée au dépôt et à la diffusion de documents entific research documents, whether they are pub- scientifiques de niveau recherche, publiés ou non, lished or not. The documents may come from émanant des établissements d’enseignement et de teaching and research institutions in France or recherche français ou étrangers, des laboratoires abroad, or from public or private research centers. publics ou privés. Towards an SDR Implementation of LoRa: Reverse-engineering, Demodulation Strategies and Assessment over Rayleigh Channel
Alexandre Marquet, Nicolas Montavont, Georgios Z. Papadopoulos IMT Atlantique, IRISA, UBL, F-35576 Cesson S´evign´e,France.
Abstract LoRa is a popular low-rate, Low-Power Wide Area Network (LPWAN) technology providing long range wireless access over unlicensed sub-GHz frequency bands to the Internet of Things (IoT). It has been used in many applications ranging from smart building to smart agriculture. LoRa is a patented modulation. However preliminary reverse-engineering efforts documented parts of it. In this article, we detail the different stages of LoRa transceivers: channel (de)coding, (de)whitening, (de)interleaving and (de)modulation with reverse-engineering in mind. Closed-form expressions for each of these stages are given, and different demodulation and decoding strategies are presented. This allows for a complete modelling of LoRa, which enables Software Defined Radio (SDR) implementations, as well as performance assessment under various channel conditions. These simulations show that LoRa systems have good properties for time and/or frequency selective channels (especially for the latter), thanks to the robustness of its underlying Chirp-Spread Spectrum (CSS) modulation.
Keywords: LoRa, Internet of Things (IoT), Chirp Spread Spectrum (CSS), reverse engineering, Low-Power Wide Area Networks (LPWAN), soft-value decoding, Rayleigh channel, Software Defined Radio (SDR), cognitive radio.
1. Introduction within a limited area, such as a few tens of meters. On the other side, there are technologies for long range transmis- The Internet of Things (IoT) is a general concept of sions, able to cover several kilometers of distance. These connecting “things” to a global network using standard- long range technologies are especially well fitted for smart- ized protocols and following the principles of the Internet. city applications, where a whole city can be covered using A thing, or an object, is usually a sensor and/or an ac- only a few antennas. LoRa is one of these technologies. It tuator that can gather specific data or control a system. has the advantage of operating within non-licensed bands, There a many applications in which connected objects are which facilitates its deployment. used, ranging from entertainment to home automation and LoRa is a long range, low data rate and low power tech- industrial applications. For example, for smart buildings, nology designed for constrained devices, based on a new objects can be used to perform metering (water, electric- modulation which is referred as Chirp Spread Spectrum ity, etc.), or light and temperature automatic control. In (CSS) [1]. On top of this physical layer, the LoRaWAN the Industry 4.0, the IoT can be used in closed-loop sys- protocol was developed to provide access to the medium. tems, in order to monitor and possibly control production In LoRaWAN, the network is organized in a star topology, chains. with a gateway at the center. The gateway is then con- While each application has specific requirements, we nected to a core network via traditional Internet links. The can still enumerate constraints that are common to most medium access is based on the ALOHA protocol, where scenarii, such as low energy consumption, low process- devices directly transmit their traffic to gateways, without ing capabilities and low memory usage. Thus, objects spectrum sensing nor dedicated time/frequency slots. use wireless communication standards dedicated to IoT. LoRa is however a closed physical layer, which prevents They usually are lossy by design, low data rate, and con- studying the technology, and developing various optimiza- sume less energy compared to standards of the classical tions likely to be proposed by the community. Disposing Internet. Several options are available, and the choice is of a proper description of the modulation chain could en- not straightforward. On the one side, there are technolo- able the research and development of better receivers to gies for short range radios, that allows for communications achieve better range or higher data rate. Furthermore the ISM band, used by many consumer devices ranging from Email addresses: [email protected] WiFi-enabled products to wireless doorbell and LoRa IoT (Alexandre Marquet), [email protected] devices, is an overcrowded physical resource. In this kind (Nicolas Montavont), [email protected] (Georgios Z. Papadopoulos) of environment, cognitive radio (i.e., smart radios, able
Preprint submitted to Computer Communications February 19, 2020 to cooperatively share the spectrum, and minimize energy makes it a reference for digital implementations using, for consumption) is a promising technology. Now, cognitive instance: SDR, Digital Signal Processor (DSP) or Field radios need to be able to (i) sense their environment (spec- Programmable Gate Array (FPGA). In more details, the trum, mainly), (ii) take decisions and (iii) reconfigure their main contributions of this article are: physical layer [2]. While taking decisions relies entirely on software, environment sensing and physical layer reconfig- • A detailed analysis of the LoRa physical layer, for- uration typically involve both software and hardware (the mally describing all the algorithms involved in LoRa radio). This drives a need for very flexible radios, that transmission chains. can be provided with Software Defined Radios (SDR). In- • Methods to reverse-engineer the key-parameters of deed, the SDR paradigm aims to perform as much sig- every algorithms used for LoRa communications. nal processing as possible in software. As a result, within the frequency band reachable by the analog front-end of • Assessment of different receiver chains for LoRa, un- an SDR, transmitting, receiving and sensing any signal is der various channel conditions (time selective, fre- only a matter of processing power and software, which are quency selective, Rayleigh). very flexible. As a result, a proper SDR implementation of a LoRa transceiver would help research and development • Comparison of CSS and M-FSK (M-arry Frequency of smart radios in the ISM band (either to sense LoRa Shift Keying) with various channels. transmissions, or to communicate using it). Performance assessment shows that CSS (and thus, LoRa) The LoRa physical layer is not described in a standard, is especially good, compared to M-FSK, when faced with and is not published anywhere outside the Semtech patent, frequency-selective channels without mobility. In every that only covers CSS modulation, interleaving (which is other scenarii (AWGN, time-selective, Rayleigh channel), close, but not identical to the one actually used in LoRa), it retains the performance of M-FSK. and preamble synchronization [1]. To the best of our The remainder of this article is organized as follows. knowledge, the most significant progress towards a com- In section 2, we first summarize the recent works regard- plete characterization of the LoRa physical layer was pub- ing LoRa reverse-engineering, performance assessment and lished by Knight et al. [3] and Robyns et al. [4]. Both SDR implementations. Section 3 formally details the LoRa provided open-source SDR implementations of LoRa re- architecture, gives methods to reverse-engineer individual ceivers. However, the demodulator adopted in [4] requires components of the transceiver, to implement them, and high Signal-to-Noise Ratios (SNR), while the implemen- then derives a discrete-time complex baseband equivalent tation of [3] does not work in LoRa implicit mode (no of CSS modulated signals. Then, section 4 gives closed- header), and is not maintained since 2017. In both cases, form expressions for various CSS demodulation strategies. the articles are really focused on implementation. Thus, Finally, simulations in section 5 allow to compare demod- they do not provide any radio-agnostic evaluation, using ulation strategies, as well as to assess CSS and LoRa per- either simulations or theoretical development. We believe formance over AWGN, time selective, frequency selective that only a rigorous modeling will allow research efforts to and Rayleigh fading channels. identify adequate use cases, strong and weak points of the LoRa modulation. Such a modeling will also pave the way for integration of CSS improvements proposed in the lit- 2. Related Work erature (e.g., collision mitigation [5, 6], spectral efficiency Most of the literature related to LoRa is actually fo- improvement [7]) into later revisions of LoRa, or into com- petitor systems. cused on upper layers (e.g., LoRaWAN), applications and In this article, we propose an analysis of the LoRa phys- security [8, 9]. A fair amount of the research effort is also ical layer and a proper decomposition of the modulation directed towards the CSS modulations (receiver improve- and demodulation steps, each described using closed-form ments, new modulations based on it, etc.). However, most input-output relationships. To the best of our knowledge, likely due to the lack of publicly available material, only a few studies have been conducted to describe and analyze, this is the first time that such a detailed description of LoRa transceivers architecture is presented opening, thus, from a theoretical point of view, the LoRa transmission possibilities for independent simulations and implementa- chain. Indeed, between CSS (as the underlying modula- tions, as well as propositions and evaluation of potential tion), and LoRaWAN, as the preferred Media Access Con- improvements (e.g, better channel coding, joint modula- trol (MAC) protocol, LoRa includes a number of physical tion and coding, etc.). We demonstrate the potential of layer techniques, namely: channel coding, whitening, and such modeling, through the proposition of several possi- interleaving, that have a strong impact on LoRa system ble demodulation chains for LoRa, and comparison of per- performance. It is worth analyzing and discussing the al- formance when M-FSK is used instead of CSS. Further- gorithms used in LoRa, in order to know its actual per- more, our description of the discrete-time complex base- formance and behaviour in details, as well as to propose band equivalent of CSS signals and, more generally, dis- evolutions or contenders to the technology. crete time descriptions of every algorithm of this article 2 Knight et al. [3] and Robyns et al. [10] wrote the only w two reports, to the best of our knowledge, which docu- Channel bc bw bi Bits to Interleaving ment a reverse engineering work on LoRa and provide open b coding symbols source implementations. However, Robyns et al. [10] pro- c vided a sub-optimal CSS demodulator which requires high SNR. The implementation of Knight et al. [3] uses an opti- CSS r(t) s(t) CSS Channel mal demodulator. However, as pointed out by [10] (based demodulator modulator on their experiments), Knight et al. wrongly assumed ˆc w that dewhitening should be performed prior to deinter- bˆi bˆw bˆc Channel leaving. Note that this does not prevent them to actually Symbols Deinterleaving ˆ decoding b receive and decode LoRa message, thanks to the linearity to bits of whitening and interleaving operations used in LoRa. It Figure 1: Architecture of a LoRa transceiver. does, however, make the retro-engineering process more difficult (for instance, in Knight et al. implementation, different whitening sequences are needed depending on the Channel coding introduces correlation between bits, spreading factor, which is not necessary when deinterleav- which is usually unwanted for designing the receiver. Re- ing is done prior to dewhitening). Other implementations ducing this correlation is the goal of the whitening al- exist, but are not properly documented and hard to set up gorithm, which computes an exclusive-OR of bc with a (e.g., [11]). whitening sequence w ∈ {0; 1}L/η, which possesses good Regarding the CSS modulation, Goursaud et al. gave statistical properties. This results in a sequence of whitened a continuous-time expression of CSS signals in [12]. Van- bits bw ∈ {0; 1}L/η. gelista et al. [13] derived the optimal receiver over Addi- Then, the interleaver scatters the coded sequence in tive White Gaussian Noise (AWGN), and Elshabrawy et time, in order to reduce the impact of impulsive noise al. [14] found out that CSS modulation is an instance of or- [18, Chap. 14.6]. The output of the interleaver is a de- thogonal signaling, and used this result to give closed-form terministic shuffle of the bits in bw, which is denoted as formulas of bit-error probability over AWGN and Rayleigh bi ∈ {0; 1}L/η. fading channels. More recently Ghanaatian et al. [15] stud- Next, groups of SF bits are made in order to produce ied the impact of Carrier Frequency Offset (CFO) and symbols taking their values in A = [0; 2SF − 1] ⊂ N, yield- Sampling Frequency Offset (SFO) on CSS signals, using ing a sequence of symbols c ∈ AL/(SF.η). Note that, in the analytical models and simulations over AWGN. They also context of CSS systems, SF is referred as the Spreading described methods for estimating CFO and SFO based on Factor: the higher the SF, the higher the dispersion of the the LoRa preamble, as well as compensation techniques information carried by each symbol in the time-frequency to cancel these impairments. Several improvements and plane (hence, at fixed bandwidth, a higher SF means a variations of CSS have been proposed, mostly focused on longer time on air). The correspondence between groups spectral efficiency improvements. Bomfin et al. proposed of SF bits and values in A follows a Gray mapping, so that to encode information in the phase of CSS symbols [16], adjacent symbol values encode binary values that only dif- which is similar to coplanar M-FSK proposed by Roth et fer by one bit. al. Kim et al. proposed to use both up- and down-chirps The transmission chain ends with the CSS modulator, to encode more information [17]. Vangelista et al. pro- that translates c into a physical signal s(t), which is ob- posed a technique to double the spectral efficiency of CSS, served as a corrupted signal r(t). at the price of a 3dB penalty in SNR [7]. The receiver basically revert every steps done in the transmitter. Individual components of the receiver either produce estimates, denoted with a hat (for example, bˆc is 3. System Architecture and Reverse-engineering an estimate of bc), or bitwise Log-Likelihood Ratios (LLR), c c This section details all the algorithms involved when denoted with an L (for example, L(b ) is the LLR of b ). transmitting and receiving data over LoRa, as originally Let b ∈ {0; 1} be a bit, then its LLR L (b) is defined as: described in [10] (see Fig. 1). We also provide instruc- L (b) = ln ( {b = 0}) − ln ( {b = 1}) , (1) tions on how to reverse-engineer key parameters for these P P algorithms. where ln(x) stands for the natural logarithm of x ∈ R+, The message consists in L bits, and is modeled as a and P {A = a} ∈ [0; 1] denotes the probability that a ran- binary vector of independent and identically distributed dom variable A takes the value a. Note that the LLR of b bits: b ∈ {0; 1}L. can be converted back to bit-probability using: Channel code is introduced to improve reliability to noise. This step introduces redundancy, and yields a (longer) e−xL(b) P {b = x} = , ∀x ∈ {0; 1}. (2) binary sequence denoted bc ∈ {0; 1}L/η, with 0 < η < 1 1 + e−L(b) the coding efficiency. In the following subsections, more information on how 3 each step actually works is given, along with the meth- multiplications use logical AND. Given that the code is ods used to reverse-engineer their parameters (if needed). systematic, we have: Subsection 3.1 covers channel coding and decoding, and P explains how the codes used in LoRa can be retrieved. G = , (4) Two methods of decoding are proposed: hard-value and I4 soft-value decoding, with the later being able to correct where I is the (4×4) identity matrix, and P is a (CR×4) more errors, at the price of a higher computational com- 4 binary matrix to be found. plexity. Next, subsection 3.2 gives input-output relation- ships for the whitening block, whose goal is to transform 3.1.2. Reverse-engineering the output binary sequence of the encoder into a sequence Given the small size of P, its value can be easily brute- whose values are less correlated. On the receiver side, de- forced by testing every possible matrix P against a re- whitening algorithms for hard and soft-values are given, to ceived sequence bˆc. Note that this strategy needs working accommodate the two possible decoding strategies. Here implementations of the dewhitening and the deinterleav- also, a method to discover the whitening sequences used ing, and assumes an error-free transmission. in the LoRa modulation is presented. Just before mod- ulation, the whitened bit-sequence is interleaved in order 3.1.3. Hard decoding to reduce the impact of impulsive noise and fadings. The interleaving process, previously described in a graphical With G completely determined, hard-value maximum way by [10], is given in subsection 3.3. The input-output likelihood decoding can be efficiently achieved using a syn- relationships for interleaving and deinterleaving are also drome decoder [18, Chap. 7.5]. formally given, using equations. Similarly to the dewhiten- ing process, the deinterleaving process, in the receiver, 3.1.4. Soft decoding is slightly different depending on the use of hard or soft It is well known that soft-decision decoding (that is, bit values (which, ultimately, define the kind of decoding taking into account confidence about bit values) can give strategy used). Finally, continuous-time and discrete-time substantial processing gain, up to 2dB [18, Chap. 5.2]. signal models for CSS are given in subsection 3.4. Dif- As the LoRa block code acts on blocks of only 4 bits (16 ferent demodulation strategies will be presented later, in possible codewords), extensive search can be implemented section 4. to achieve maximum-likelihood decoding: n o ˆ ˆc ¯ 3.1. Channel coding and decoding bk = argmax P bk = Gb . (5) b¯∈{0;1}4 The goal of any channel code is to make transmissions more robust to noise, introduced by communication chan- Assuming that elements of bˆc are independent, we get: nels, using redundancy. In LoRa, the amount of redun- n o dancy is controlled by the “coding rate” parameter [19], ˆ 3+CR ˆc ¯ bk = argmax Πl=0 P b (4+CR)k+l = Gb l , (6) denoted as CR ∈ [1; 4] in the following. In [3] and [10], b¯∈{0;1}4 authors have determined that LoRa uses systematic block where [Gb] denote the l-th element of vector Gb. Us- codes. It produces codewords of (4+CR) bits, using input l ing formula (2) to convert LLRs to probabilities, discard- blocks of 4 bits, giving a code efficiency η = 4/(CR + 4). ¯ This subsection is divided into four parts. First, we ing the denominator as a constant with respect to b, and describe the coding process. Then, we give a method to translating into logarithmic domain, equation (6) reduces reverse-engineer the key-parameter of the code: its gener- to: ator matrix. The last two parts describe hard-value and 3+CR ˆ X ¯ c soft-value decoding strategies, with the former being less bk = argmin Gb l L b(4+CR)k+l . (7) ¯ 4 performant, but also less computationally demanding than b∈{0;1} l=0 the latter. Note that implementation of (7) is computationally more involved compared to a syndrome decoder, as operations 3.1.1. Coding with floating-point numbers require either more time or Let us denote b the kth block of 4 bits in b, and bc the k k more energy than operations over binary values. associated codeword, containing CR + 4 bits. Then, the coding process can be described by the following equation: 3.2. Whitening and dewhitening c By design, a channel encoder adds redundancy bits, b = Gbk, (3) k which introduces correlation between bits of the coded se- where G is the binary generator matrix. Note that (3) quence. This correlation may cause issues with other al- and following equations in this part use arithmetics over gorithms in the transmission chain, as they may assume GF(2), which means that additions use exclusive-OR and Independent and Identically Distributed (IID) input se- quences. Thus, the goal of the whitening operation is to 4 transform the coded sequence, such that individual bits in 3.3. Interleaving and deinterleaving the whitened sequence are weakly correlated. LoRa is an instance of Bit-Interleaved Coded Modu- This subsection is arranged into four parts. The first lations (BICM), known to be able to provide robust per- one describes the whitening algorithm. Then we provide a formance under both fading and AWGN channels. With method to reverse-engineer the whitening sequences used this kind of modulation, interleaving is used to scatter the in the LoRa modulation. Finally, the last two parts de- individual bits of each codeword in time, providing better scribe hard-value (acting on bits) and soft-value (acting on immunity to noise bursts (or, equivalently, fadings) [18, LLR) dewhitening. The latter being required if soft-value Chap. 14.6]. The LoRa interleaver belongs to the family decoding is used (see subsection 3.1). of diagonal interleavers. Such interleavers act on blocks of data represented as a matrix. The name comes from 3.2.1. Whitening the principle of operations: values present on a line of the The whitening operation adds (in GF (2)) a known input matrix end up being scattered on a diagonal of the pseudo-random sequence to the output of the channel en- output matrix. c coder (coded bits b ). The input-output relationship is This subsection is divided into three parts. The in- thus given by: w c terleaving algorithm is given in the first one. Then dein- b = w + b . (8) terleaving, which basically consists in re-arranging the re- If the whitening sequence w is carefully chosen, very cor- ceived bits back to their initial positions, is described for related input sequences (such as the all-one sequence) will hard (bits) and soft-values (LLR). Similar to dewhitening, result in a pseudo-ransom sequence. The worst case sce- a soft-deinterleaver is necessary to enable soft decoding nario happens when bc = w. In order to reduce the prob- (see subsection 3.1). ability of this scenario, long whitening sequences should be used. 3.3.1. Interleaving The interleaver used in LoRa have successfully been 3.2.2. Reverse-engineering retro-engineered in [10], and is described bellow. It acts The whitening sequence can be easily recovered by ex- on a block of SF whitened codewords (with size CR + 4 ploiting the linearity of the channel code. Indeed, accord- bits), and outputs a block of (CR + 4) × SF interleaved ing to (3), the codeword associated to the all-zeros block bits, ready to be mapped to CR + 4 symbols. We denote is the all-zeros codeword. So, when sending b = 0L×1, B the k-th block of SF whitened codewords, defined as: the whitened sequence reduces to the whitening sequence: w w w b = w. In this case, assuming that we have a work- bk . . . bk+(CR+4)−1 ing implementation of the deinterleaver, and an error-free B = . . , (9) transmission, the whitening sequence can be retrieved as . ··· . bw . . . bw w = bˆw. k+(SF−1)(CR+4) k+SF(CR+4)−1 Note that having error-free transmissions is hard to with bw the k-th element of bw. From there, denoting obtain, which explains why open-source implementations k [B] the element of B at line index i and column index found different whitening sequences [10, 3, 11]. i,j j, the k-th block of interleaved bits IB is defined element- 3.2.3. Hard dewhitening wise by: Thanks to the property that a + a = 0 ∀a ∈ GF (2), whitening and dewhitening are similar operations. The [IB]i,j = [B]SF−1−((j−i) mod SF), (CR+4)−1−i only difference being that the later takes a whitened se- ∀i ∈ [0; (CR + 4) − 1], j ∈ [0; SF − 1]. (10) quence (estimates of the whitened sequence bˆw, in the case of LoRa) and outputs the original sequence (estimates of Finally, each line of IB contains SF interleaved bits to be the coded sequence bˆc, here). mapped to symbols later on:
3.2.4. Soft dewhitening i i b . . . b = δl.IB By definition of (1), one can notice that the sign of k+l.SF k+(l+1).SF−1 an LLR refers to the value of the estimated bit, while its ∀l ∈ [0; (CR + 4) − 1], (11) absolute value refers to the confidence level of that es- timation. This means that dewhitening is performed by where δl is a line vector of size (CR + 4) whose l-th entry reversing the sign of LLR at indexes where the bit values has value 1, and every other entry has value 0. This process of the whitening sequence equals to one. can be decomposed in several elementary operations, as In practice, on many hardware platform, reversing the explained in Fig. 2. sign of a floating-point number is done by flipping the first bit of its binary representation, which means that imple- 3.3.2. Hard deinterleaving menting soft dewhitening has a limited impact compared The deinterleaving process is formally described as fol- to hard dewhitening, in terms of complexity. lows. The k-th matrix of estimated interleaved bits IBˆ is 5 Input: B 01110010 11111111 Let us denote B the bandwidth of the signal, and T the time to transmit a symbol, then log (B.T ) = SF is the 11101000 10001011 2 10100011 01110100 180 rotation spreading factor. As for Direct Sequence Spread Spectrum ° 00000000 00000000 (DSSS) systems, SF characterizes the increase in band- 00101110 11000101 11010001 00010111 width occupation for a fixed value of T . As seen in the 11111111 01001110 previous subsections, in the case of the LoRa modulation, Downward circular shift by SF also gives the number of bits carried by a single symbol, 1100100 SF 11000111 column index. meaning that a symbol can take M = B.T = 2 values. 1101010 11010001 0010100 00100100 0101010 Transposition 1 01011100 0001110 10101111 1011110 01011111 )
1000111 t 00000010 ( 0 1100110 s Output: IB R{s(t)} Figure 2: Decomposition of the interleaving process. Example with I{s(t)} SF = 7 and CR = 4. −1 −T/2 T/2 Time constructed as follows: B )
t 2 ˆi ˆi ( b k ... b k+SF−1 s ˆ . . IB = . ··· . . (12) ˆi ˆi 0 b k+(CR+4−1)SF ... b k+(CR+4)SF−1 c. B From there, the k-th block of SF whitened codewords Bˆ is M Frequency of B defined element-wise by: − 2 −T/2 T/2 h i h i Bˆ = IBˆ Time i,j (CR+4)−1−j, [SF−1−i+(CR+4)−1−j] mod SF Figure 3: Transmission of one chirp corresponding to symbol c = 50, ∀i ∈ [0; SF − 1], j ∈ [0; (CR + 4) − 1]. (13) with M=128. R{·} and I{·} denote the real part, and the imaginary part, respectively. Where each line of Bˆ is an estimated whitened codeword: Using these notations, we define the expression of the ˆw ˆw ˆ complex baseband equivalent of the base chirp, that is the b k+l.(CR+4) ... b k+(l+1).(CR+4)−1 = δl.B chirp that encodes the symbol 0. This base chirp g0(t) has ∀l ∈ [0; SF − 1]. (14) a frequency that linearly grows from −B/2 at t = −T/2 to B/2 at t = T/2 (as to span the whole available bandwidth This deinterleaving process corresponds to the same steps B during the time of a symbol T ): as in Fig. 2, but in reverse. jπ B t2 g0(t) = e T ΠT (t), ∀t ∈ R, (15) 3.3.3. Soft deinterleaving Soft deinterleaving is done exactly as hard deinteleav- where ΠT (t) is the rectangular window of size T :ΠT (t) = ing, the only difference being that IBˆ is constructed using 1 for all t ∈ [−T/2; T/2[, and ΠT (t) = 0 otherwise. In LLR L bi instead of estimated bits bˆi. order to modulate a symbol c ∈ A, the initial frequency Soft deinterleaving can be done with the same com- of g0(t) is shifted by c.B/M = c/T Hz, and extra steps plexity as hard deinterleaving, using copy-free implemen- are taken to make sure that the chirp is wrapped between tations. [−B/2; B/2] as illustrated in Fig. 3:
j2π( B t+ c )t −j2πlBt 3.4. Chirp spread spectrum modulation gc(t) = ΠT (t).e 2T T .e , CSS uses linear chirps (see Fig. 3) to spread informa- B c B B ∀t ∈ , l ∈ s.t. t + ∈ lB − ; lB + . (16) tion carried by each symbol in the time-frequency plane. R Z T T 2 2 This allows good resilience to time (as implied, for in- stance, by Doppler shifts) and frequency selective channels Finally, the modulated signal consists in multiple symbols (as implied, for example, by multipath signal propagation) sent sequentially, with a time spacing of T seconds:
[20]. It is an index-based modulation, which uses the initial L/(SF.η) frequency shift of the chirp carrying a symbol to encode X s(t) = gcn (t − nT ), ∀t ∈ R, (17) its value (see Fig. 3) [12]. n=0 6 where cn ∈ A denotes the n-th element of c. of soft information decoding, techniques for computing bit To obtain a discrete-time expression for s(t), we sam- LLR from coherent and non-coherent demodulators will ple at the Shannon-Nyquist rate: Fe = 1/Te = B. Con- be given. These strategies will be assessed later on, in sequently, using the relation B.T = M, we also have T = Section 5. M.Te and Te/T = 1/M. This gives the following discrete- In order to do that, this section will be divided in four time expression for s(t): subsections. The first three sections will cover quadra- ture demodulation (4.1), coherent demodulation (4.2), and L/(SF.η) X non-coherent demodulation (4.3). Then, subsection 4.4 s[k] = s(kTe) = gcn (kTe − nT ) (18) will detail how to extract soft information from coherent n=0 and non-coherent demodulators. L/(SF.η) X In order to present the three demodulation strategies = gcn ((k − nM)Te) (19) of this part, we consider an AWGN channel: n=0 L/(SF.η) r[k] = s[k] + z[k], ∀k ∈ , (28) X Z = gcn [k − nM], ∀k ∈ Z. (20) n=0 where z[k] is a zero-mean, complex-circular white Gaus- sian noise. Let us now derive the discrete-time expression of a modu- The three following demodulators use the same dechirp- lated chirp: ing operation, described as:
B c k2 j2π( 2T kTe+ T )kTe −j2πlBkTe g [k] = g (kT ) = Π (kT ).e .e −jπ M c c e T e rd[k] = r[k]e , ∀k ∈ Z, (29) B c B B ∀k, l ∈ s.t. kT + ∈ lB − ; lB + . (21) Z T e T 2 2 where rd[k] is the dechirped observed signal. This opera- tion does not change the statistical properties of the noise, where ΠT (kTe) = Π T (k) = ΠM (k) = ΠM [k], and thus this system model, involving rd[k] instead of r[k] is Te equivalent to M-FSK over AWGN. e−j2πlBkTe = e−j2πlk = 1 ∀l, k ∈ Z. Thus, the expression of g (t) is simpler in the discrete-time domain: c 4.1. Quadrature demodulation B c j2π( kTe+ )kTe gc[k] = ΠM [k].e 2T T (22) Quadrature demodulation is a technique that is usu- T BT ally applied to analog Frequency Modulated (FM) signals j2π e ( e k+c)k = ΠM [k].e T 2 (23) in order to extract frequency variations. It was retained j2π 1 ( 1 k+c)k = ΠM [k].e M 2 (24) by Robyns et al. [10] in their SDR implementation, be- 2 cause of its low-complexity. Its use in M-FSK demodu- jπ k j2π c k = ΠM [k].e M e M , ∀k ∈ Z, c ∈ A. (25) lation comes from the fact that these modulations can be seen as frequency modulated M-arry Amplitude Shift Key- Now, incorporating (25) in (20), we obtain: ing (ASK) modulations. Thus, it is actually a two-stage
L/(SF.η) demodulation process. The first stage performs quadra- 2 X jπ (k−nM) ture detection of the frequency variation in r [k], and the s[k] = Π [k − nM].e M (26) d M second performs M-ASK demodulation on this frequency n=0 j2π cn (k−nM) variation. .e M Quadrature detection reads as follows: L/(SF.η) 2 jπ k X j2π cn k ∗ = e M ΠM [k − nM].e M , ∀k ∈ Z. (27) Q{rd[k]} = arg {rd[k]rd[k − 1]} , ∀k ∈ Z, (30) | {z } Chirp n=0 | {z } where (·)∗ denotes the complex conjugation. As frequency M-FSK is the derivative of the phase, this detector corresponds to This shows that CSS signals are basically chirped versions the digital derivative of the phase of the received signal. of M-arry Frequency Shift Keying (M-FSK) signals. After quadrature detection, the signal is analogous to an M-ASK modulated signal:
4. Chirp Spread Spectrum Demodulation L/(SF.η) 2π X Q{r [k]} = Π [k − nM]c + z0[k], ∀k ∈ , The aim of this section is to rigorously define three de- d M M n Z n=0 modulations strategies for CSS-modulated signals: quadra- (31) ture (as used in [7]), coherent and non-coherent receivers. but corrupted by a noise z0[k] that has no guarantee to be An analysis of their expected behaviours over AWGN, from Gaussian nor white. a theoretical standpoint, will also be given. Also, be- Nevertheless, symbols c can be demodulated with cause the previous section highlighted the potential gains
7 matched filtering: conditions, especially as M grows bigger: 1 F {r [k − nM]}[c0] (37) ˆc = (Π ∗ r )[n] (32) M d n M d 0 0 2π = FM {s[k − nM]}[c ] + FM {z[k]}[c ] L/(SF.η) +∞ L/(SF.η) X X 0 = ΠM [k − nM]ΠM [k − n M]cn0 (33) X 0 j2π cn k 0 = FM {ΠM [k − (n − n )M].e M }[c ] (38) n0=0 k=−∞ n0=0 0 + (ΠM ∗ z )[n] 0 + FM {z[k]}[c ] 0 = M.cn + (ΠM ∗ z )[n], (34) 0 = M.δ 0 δ 0 + F {z[k]}[c ], (39) n−n cn−cn M where ΠM [k] is the matched filter of itself as it is real and where δn = 1 if n = 0 and zero otherwise. As we can see, symmetrical. Hard decisions can be taken from ˆcn, by the correlator output corresponding to the symbol that comparing its amplitude to M − 1 thresholds. was sent has its amplitude augmented by M, as opposed This technique is suboptimal due to the fact that (i) to the other correlators. This means that this modula- quadrature detection is not an optimal frequency detec- tion, along with coherent demodulation gets more robust tor in presence of AWGN, and (ii) ASK demodulation is to noise as M increases. However, as B.T = M, this comes performed using matched filtering (which is a maximum at the expense of either an increased bandwidth or a de- likelihood detector in presence of AWGN) even though the creased symbol rate. noise z0[k] is not AWGN [18, Chap. 4.4]. However, trans- posing the demodulation problem from M-FSK to M-ASK 4.3. Non-coherent receiver allows for the use of standard and well studied techniques While effective, the coherent receiver is very sensitive for various channel impairments, such as clock drift, CFO to channel impairments other than white noise. In partic- and channel selectivity. ular, due to the real part in (36), any channel impairment that translates to a phase shift in (37), results in a loss of 4.2. Coherent receiver reliability. Coherent receivers are used when the channel induces Non-coherent detection is a computationally efficient no phase impairments, or when such phase impairments way to tackle this issue, as it only replaces the real part are considered perfectly estimated and corrected. Over operator by the magnitude operator in (36): perfect AWGN channels, it allows for maximum likelihood ˆcn = argmax |FM {rd[k + nM]}[c]| . (40) detection. Its use is mandatory for demodulating deriva- c∈A tive of CSS that use the phase to encode symbols (see, e.g, [16]). However, this comes at the expense of a reduced noise A maximum likelihood demodulation strategy for M- immunity. FSK in presence of AWGN is to find the symbol c ∈ A 2π c k 4.4. Soft-decisions for coherent and non-coherent receivers whose associated signal e M correlates the best with the In order to leverage the potential gains of soft-decision observed signal rd[k] [18, Chap. 4.4]. This is expressed as follows: decoding (see subsection 3.1), the demodulator must be altered, as to compute LLR for each bit of a codeword: ( +∞ ) X −2π c k i ˆcn = argmax R ΠM [k]e M rd[k + nM] . i P bn = 0|rd(t) c∈A L bn = ln i . (41) k=−∞ P {bn = 1|rd(t)} (35) Under the assumption that transmitted symbols are IID, One can observe that the term in the real part is actually i the M point Discrete Fourier Transform (DFT), denoted assuming that bn is carried by the l-th bit of the n-th symbol, and using Bayes rule, we get: as FM {·}[·], of the received signal: P P {rd(t)|cn = c} ˆc = argmax R {F {r [k + nM]}[c]} , (36) L bi = ln c∈A s.t. bl(c)=0 , (42) n M d n P {r (t)|c = c} c∈A c∈A s.t. bl(c)=1 P d n which can be efficiently implemented using the Fast Fourier where bl (c) denotes the value of the l-th bit mapped to Transform (FFT) algorithm [21]. symbol c. On an AWGN channel, likelihoods 2 R{FM {r [k+nM]}[c]}/σ Expanding the correlation term in (36) allows to under- P {rd(t)|cn = c} are proportional to e d , stand why M-FSK modulations are effective in low SNR where σ2 denotes noise power [22]. Thus, LLR for coherent detection are finally expressed as: