# Understanding the relationship between LoRa chips, chirps, symbols and bits

I'm trying to understand the actual relationship between LoRa chips, "chirps", symbols and bits. I don't mean just the equations that relate the various rates, but actually how these things relate quantitatively.

The Semtech document AN1200.22 LoRa™ Modulation Basics contains some basic equations and definitions related to various rates. As far as I can understand, the chip rate CR is always going to be numerically equal to the selected bandwidth. So if the selected bandwidth = 125 kHz, the chip rate is 125,000 chips/second. The symbol BW is then used interchangeably with chip rate.

The spreading factor relates chips and symbols. $$\2^{SF} chips = 1 \ symbol\$$. So the symbol rate SR is related to the chip rate (as BW):

$$\SR = \frac{BW}{2^{SF}}\$$

In the implementation of the LoRa modulation, every 4 bits of data will be encoded as 5, 6, 7, or 8 total bits as a form of forward error correction, and these are selected by setting the coding rate CR = 1, 2, 3, 4. So the actual rate of user data bits must be reduced by the factor:

$$\BR_{user} = BR\frac{4}{4+CR}\$$.

This concludes what I think I understand so far. I don't know what chips or symbols actually are. For example, there is an extra SF term in the final relationship between bandwidth and raw bit rate, which I do not understand.

$$\BR = SF\frac{BW}{2^{SF}}\ = SF \cdot SR\$$

This says that one symbol is equivalent to SR bits, or between 6 and 12 bits in the LoRa available settings. Is that correct?

I have found here (also, watch after 13:00 in this video EDIT: video of the more recent and more in-depth talk) a definition of chirp rate as the first time derivative of frequency df/dt. That would give it units of $$\time^{-2}\$$ but the expression shown there is different. Perhaps this is the rate of complete sweeps (chirps), rather than the rate of change of frequency? above: screen shot from here.

Question: What is the relationship between chips and "chirps" - can the chips be visually distinguished in the spectrograms - can one see where each chip begins and ends? Also, are there indeed between 6 and 12 bits per symbol?

Below are some illustrations of spectrograms of LoRa signals. It looks like during each chirp, there is roughly on average one instantaneous shift in frequency per nominal chirp period, but I don't know if that holds in general. above: LoRa spectrogram from LinkLabs: "What is LoRa?". above: LoRa spectrogram from Decoding the LoRa IOT Protocol with an RTL-SDR. above: screen shot from Reversing LoRa (PDF). above: from Decoding LoRa - cropped from here.

• This is a related answer.
– uhoh
Jan 3, 2017 at 10:05
• have you seen Matt Knight's talk on the LoRa Phy at 33c3? media.ccc.de/v/33c3-7945-decoding_the_lora_phy – it's the "extended & improved version" of the talk he held at GRCon (both of which were pretty cool to see live) (you link to the slides from his "Reversing LoRa" talk at GRCon) Jan 3, 2017 at 12:11
• @MarcusMüller I'm watching it now - this is much more helpful than the old video - I'll edit my question to include new links - Thanks!! But I still don't understand how the chirp rate (df/dt) can have units of time${}^{-1}$ and not time${}^{-2}$.
– uhoh
Jan 3, 2017 at 12:44
• @Andreas any interest in LoRa? 1) Reversing LoRa (pdf), 2) Decoding the LoRa PHY (excellent video), 3) Linklabs: What is LoRa?, 4) Decoding LoRa
– uhoh
Feb 26, 2017 at 11:31
• @NickG thank you for the edit!
– uhoh
Feb 21, 2021 at 21:57

LoRa is a chirp-based spread-spectrum modulation. A symbol is a chirp.

To generate symbols/chirps, the modem modulates the phase of an oscillator. The number of times per second that the modem adjusts the phase is called the chip rate and defines the modulation bandwidth. Chip rate is a direct subdivision of the quartz frequency (32 MHz).

Example for 125 kHz LoRa:

125 kHz modulation bandwidth
= 125000 chips per second
= 8 µs per chip

modulation bandwidth < occupied spectral bandwidth < channel spacing (typ 200 kHz)


Basic chirps are simply a ramp from fmin to fmax (up-chirp) or fmax to fmin (down-chirp). Data-carrying chirps are chirps that are cyclically-shifted, and this cyclical shift carries the information.

The spreading factor defines two fundamental values:

• the number of chips contained in each symbol is $2^{SF}$
• the number of raw bits that can be encoded by that symbol is SF

The reason is that a symbol, with a length of N chips, can be cyclically shifted from 0 to N-1 positions. The "reference" position is given by the un-shifted symbols at the beginning of the LoRa frame. So this cyclical shift can carry log2(N) bits of information. If N is a power of two, the math works nicely.

Example for SF 7

A SF 7 symbol is 128 chips long
= 1.024 ms @125kHz modulation bandwidth
= 512 µs @250kHz modulation bandwidth
= 256 µs @500kHz modulation bandwidth

A 128-chip long symbol can by cyclically shifted from 0 to 127 positions, and that shift
carries 7 bits of raw information:
~ 6.8 kbps raw @125kHz modulation bandwidth
~ 13.7 kbps raw @250kHz modulation bandwidth
~ 27.3 kbps raw @500kHz modulation bandwidth


Due to noise, this modulation/demodulation process introduces errors, and that's why an error correction code is added. For a typical payload, 25% (CR1) or 50% (CR2) of redundancy is added before modulating chirps. In practice, the data sent by the user is also mixed to get better error correction properties.

Raw data-rate and error correction define the nominal data-rate. To get the effective maximum data-rate a device can transmit at, you have to take into account:

• legal duty-cycle limit, if applicable, of the band you emit in
• overhead of the LoRa preamble, header and CRC for each frame sent (significant influence when short frames are sent)
• overhead of your protocol for each frame (also very important for short frames)

Edit:

I have added (in red) the boundaries of chirps so that the effect of cyclical-shifts is easier to understand. Except for a few special symbols at the end of the preamble signaling a start of frame, all chirps in a LoRa frame are the exact same length. Frequency seems to "jump around" quite a bit, but there is no discontinuity in phase that would lead to copious amounts of unwanted harmonics all around the band. • When I look at the waveform I'd call it a simple, ramped frequency modulation rather than a phase modulation, and I'd say the bandwidth is essentially just $f_{max}-f_{min}$ (pretty close when I take the FT). In the waveforms I see irregularly spaced sudden, larger steps in frequencies. Can you address these highly distinctive LoRa-specific features directly please?
– uhoh
May 14, 2017 at 11:37
• The "irregularities" and "steps" are due to the cyclic-shift. A non shifted up-chirp starts at fmin, and ends up at fmax. A chirp cycle-shifted by 2^(SF-1) samples starts at (fmin+fmax)/2, ramps up to fmax at half the chirp length, then jump to fmin immediately, then ramps up to (fmin+fmax)/2 at the end of the chirp. May 14, 2017 at 12:10
• OK finally I'm getting there :) Thank you for the edit, it's so much clearer now, to me at least. It's what I call an "Aha! moment" for me. All this time I was looking at this with the frame starting at the $f_{min}$ and it made no sense. Great!
– uhoh
May 14, 2017 at 15:06
• I'm still stuck on the bits/symbol ~ SF. This looks like something obvious and well known to the signals-savvy, but I don't see why yet. Can you point me to some place I can read further? I just need an "aha!" type clue. Thanks! It seems LoRa has become a really nice learning experience for me.
– uhoh
Jun 7, 2017 at 5:04
• I spent the last 24h to get into LoRa and stumbled over this question. I was also stuck with chirp rate and how one can see different chips in a chirp and so on. I don't like both of the answers here since they don't address the part labeled Question: If I have time I'll write my own answer, up to that moment I would advise to read this patent. This answer is actually bits of information scrambled from this document. Thanks a lot though for the examples and especially for drawing the boundaries of the chirps this was really helpful! Sep 15, 2017 at 13:17

# Definitions

So, what is a bit, symbol, chip, and chirp, and what do these mean?

## Bit

Bit is the smallest unit of information. Most of the time, we try to send these bits from the sender (TX) to the receiver (RX).

In order to send these bits to RX, they have to go through some kind of medium to reach their destination. It can be any metal, air, water, fiber optics, etc., any kind of medium you can imagine.
They each have advantages, drawbacks and their own quirks, but we mostly use them because we need to compensate other media's shortcoming.
Fiber optics are used because they are better at transmitting signal with a lot less attenuation compared to wireless transmission which uses air as medium, and a lot less costly compared to copper-based communication if we are speaking about long ranges.
Disadvantage of this medium is that you cannot transmit power over it, it would be pointless. You cannot reuse this power at the end, so if you want to power something while you are transmitting information, you will have to use copper.
Bit rate is the number of bits transmitted or processed per time unit.

$$Bit\ rate = R_b$$

## Symbol

If you want to transmit over these different type of media, you have to describe and transmit those bits of information in a way, that it would reach its destination.
A symbol represents one, or more bits of data, it can be a type of waveform, or a code.
Symbol rate is the number of symbol changes per time unit, it can be equal to or less than the bit rate. Symbol rate is also known as baud rate and modulation rate.

Here is an example what kind of line codes exist, and what kind of modulations.

$$Symbol\ rate = R_s$$

## Chip

Chip is the basic binary element of the sequence of data in the context of spread spectrum transmissions, and to avoid confusions, they named it differently from bit.

Spread spectrum is the idea of having your data spread through a bandwidth, this way the transmission will be more redundant, less prone to jamming. If you want to reach the same reliability without using spread spectrum, you will have to transmit in a narrow-band in relatively high power. This jams other transmissions, and goes against the whole point of telecommunication, that you transmit the information successfully, without bothering anyone else's transmission.
Chip rate is the number of chips transmitted or received per time unit, and it is much larger than the symbol rate, meaning that multiple chips can represent one symbol.

$$Chip\ rate = R_c$$

Symbol rate is lower than or equal to the bit rate, chip rate is higher than symbol rate and also higher than the bit rate.

In the Semtech AN1200.22 document on page 9-10 the following formulas are used:

$$R_b = SF \cdot \cfrac{BW}{2^{SF}}\qquad R_s = \cfrac{BW}{2^{SF}}\qquad R_c = R_s\cdot 2^{SF}$$

The first two equations can be joined, it will be: $$\R_b = SF\cdot R_s\$$, and if you substitute this to the third equation, you get: $$\R_c = \cfrac{R_b}{SF} \cdot 2^{SF}\$$.
You cannot have the spreading factor as zero, because you would divide with zero. The smallest number you can enter as the spreading factor is 1, and in the case of $$\100\ bps\$$, the chip rate would be $$\200\ cps\$$, so it holds true, that:

$$R_c > R_b > R_s$$

If you are interested in what other spread spectrum technologies exist that use the concept of chip, check out the access method Code Division Multiple Access.

## Chirp

A chirp is a signal in which the frequency increases (up-chirp) or decreases (down-chirp). In QPSK, BPSK and many types digital modulation, they used sinusoidal waves as symbols, but in CSS they use chirps, which are not varying voltage/power in time, but changing frequency in time.

-To be continued-
I need to revise the answer from the chip part, because calculating things from the two documents (1, 2) doesn't give the same result, and in the video its still not clear what do we take as a chip or a symbol in the CSS modulated signal.

## Resources

Chip

Modulation techniques

Bit, Symbol and Chip rate

Bit rate vs Baud rate

Multiplexing techniques

Modern digital modulation techniques