Showing posts with label RapidM. Show all posts
Showing posts with label RapidM. Show all posts

15 February 2026

S-4481/S-4539 clear-text messages sent using RapidM modem (BRE1TA tests?)

The purpose of this post is to report test transmissions heard on 6963.0 kHz USB and logged during the first week of February by both Kosmod (who sent them to me for analysis) and ANgazu (whose signal was reported by KA0KA and published on the radiofrecuencias.es forum [1]). I don’t claim much credit in this post, other than confirming previous analyses and contributing further insights.
Transmissions continued for several days without interruption, almost entirely using the STANAG-4539 (MS-110B App.C) waveform. One of Kosmod’s recordings was particularly notable, as the STANAG-4539 signal was preceded by a STANAG-4481 transmission at 75 Bd/850 Hz (Figure 1). The mode switch lasted roughly 640 ms.

Fig. 1 - STANAG-4481/STANAG-4539 switch

According to STANAG-4539, each data frame contains a 256-symbol data block followed by a 31-symbol mini-probe of known data, for a total of 287 symbols per frame (119.57 ms @ 2400 symbols/s). Every 72 frames, a 72-symbol subset of the initial preamble is reinserted to aid late acquisition (1) (Figure 2).

Fig. 2 - STANAG-4539 framing

The data rate is 9600 bps, and the modulation used to achieve it is QAM-64. According to STANAG-4539, §4.2.2.1.6, “This [QAM-64] constellation is a variation on the standard 8 × 8 square constellation, which achieves a better peak-to-average ratio without sacrificing the very good pseudo-Gray code properties of the square constellation” (Figure 3).

Fig. 3 - STANAG-4539 constellations

In both cases (STANAG 4481 and STANAG 4539), the modulations are asynchronous and employ an 8N1 framing format, as shown in Figure 4.

Fig. 4 - STANAG-4481 and STANAG-4539 demodulated bitstreams

The transmitted messages are 8-bit ASCII clear text and consist of repeated instances of the same sentence, differing only in the message sequence number:
[binary header][message sequence number][text] 
The portions of the demodulated bitstreams presented below were obtained from two different recordings (header is omitted):

[STANAG-4481]
...
000013 Rapid Mobile HF & V/UHF Data Modem internally generated test message.
000014 Rapid Mobile HF & V/UHF Data Modem internally generated test message.
000015 Rapid Mobile HF & V/UHF Data Modem internally generated test message.
000016 Rapid Mobile HF & V/UHF Data Modem internally generated test message.
...


[STANAG-4539]
...
004820 Rapid Mobile HF & V/UHF Data Modem internally generated test message.
004821 Rapid Mobile HF & V/UHF Data Modem internally generated test message.
004822 Rapid Mobile HF & V/UHF Data Modem internally generated test message.
...

The message sequence numbering is likely continuous across the transition from STANAG-4481 to STANAG-4539 (Figure 2); however, this assessment cannot be confirmed due to unreliable demodulation of the initial segment of STANAG-4539.

Despite the modem-generated test traffic, the end-to-end efficiency η from payload to physical layer transmission can be evaluated for this STANAG-4539 waveform. As shown, the 9600 bps input uses asynchronous framing with 1 start bit and 1 stop bit, meaning each byte is transmitted as 10 bits of which only 8 carry payload; the symbol rate of 2400 Bd employing QAM-64 modulation (6 bits per symbol) results in a gross channel bit rate of 14400 bps. So:

- net useful payload = 9600 × (8/10) = 7680 bps
- transport efficiency relative to 14400 bps rate:
η = 7680/14400 ≈ 0.533  i.e., an effective efficiency of approximately 53.3%

overhead breakdown:
20% from serial framing (start/stop bits)
~26.7% due to physical-layer mechanisms such as FEC, preambles, and synchronization (S-4539) (2)

It's evident that a RapidM (Rapid Mobile) modem is being used that is capable of producing its own test traffic without needing an external server or another device to send data. This feature is often known as loopback testing, built-in test signal generation, or self-test mode.
Unfortunately, there is no publicly documented statement that a specific RapidM modem model generates its own test message, manufacturers often keep detailed test features in restricted datasheets. However, RM2, RM5, RM8, and RM10 RapidM modems all support STANAG -4539 and STANAG- 4481. RM2/RM5 are narrowband tactical modems (up to 9600  bps) with built-in test/loopback capabilities. RM8 is a strategic/naval narrowband modem supporting 9600–19200  bps and 2G/3G ALE, also capable of self-generated test traffic. RM10 adds wideband HF (3–24 kHz) while retaining narrowband 4539/4481 support [2].

Regarding the transmitting antenna’s location, both Kosmod and ANgazu performed direction finding using the TDoA (Time Difference of Arrival) algorithm, and both results pointed to an area near Casteau-Mons in Belgium, very close to NATO’s SHAPE headquarters (3)[3].

Fig. 5 - Direction Finding results

Direction Finding results may further substantiate ANgazu’s hypothesis that the signals could represent test transmissions associated with the NATO BRE1TA (BRASS Enhancement 1 Technical Architecture) program. BRE1TA constitutes a major architectural evolution of the NATO BRASS (Broadcast and Ship-to-Shore) HF communications system, designed to integrate advanced narrowband and wideband HF waveforms, higher spectral efficiency, improved link robustness, and IP-based data services. 

Several hours of monitoring on 6063 kHz USB over the past few days yielded only occasional short STANAG-4285 300 bps long-interleaver transmissions encrypted with KG-84. Reception was further limited by sporadic fading during the morning sessions.

https://disk.yandex.com/d/CXaz6URgUh-3zg

(1) In Change Notice 1 of MIL-STD-110C (January 2012), the United States Department of Defense removed a sentence stating that a “reinserted preamble facilitates acquisition (or re-acquisition) of an ongoing broadcast transmission.”  The reason was that the sentence referred to a feature that had become obsolete. Keeping it in the standard could have caused confusion by implying support for a legacy broadcast capability that was no longer part of the modem design. 

2) The relationship between the nominal user data rate of 9600 bit/s and the over-the-air symbol rate of 2400 baud for the STANAG-4539 QAM-64 waveform is as follows:
- the waveform employs a symbol rate of 2400 symbols per second with 64-QAM modulation, corresponding to 6 bits per symbol. This results in a gross channel bit rate of 14400 bit/s;
- the application of forward error correction (FEC) with coding rate R = 3/4 to a user data rate of 9600 bit/s produces a coded bit rate of 12800 bit/s;
- the remaining capacity of 1600 bit/s (14400-12800), representing the difference between the gross channel bit rate and the coded bit rate, is allocated to waveform overhead. This overhead includes, but is not limited to, miniprobes and periodic preamble reinsertion required to support synchronization and channel estimation functions. 

Figure below shows an example; the 1-second interval is chosen for ease of presentation.

over-the-air symbols/bits in a 1 second interval (STANAG-4539)

(3) The Supreme Headquarters Allied Powers Europe (SHAPE) is the headquarters of NATO's Allied Operations Command (ACO), located in Casteau, near Mons, Belgium. It is responsible for the planning and execution of all NATO military operations worldwide.

[1] https://www.radiofrecuencias.es/viewtopic.php?p=12527#p12527
[2] https://www.rapidm.com/
[3] https://shape.nato.int/

13 March 2023

RapidM proprietary WB-LDL & WB-RDL waveforms (2)

Thanks to a nice catch by my friend ANgazu from radiofrecuencias.es, who I thanks, it's now possible to add two other waveforms (#9, #11) to the Table II of the previous post [1]. The waveforms belong to the "120 ms frames" family, respectively 30 KHz bandwidth 24000 Bd (WF #9, Figure 1) and 42 KHz bandwidth 33600 Bd (WF #11, Figure 2).

Fig. 1 - 30KHz/24000Bd waveform

Fig. 2 - 42KHz/33600Bd

https://disk.yandex.com/d/o8htpYuX7xSXuw

[1] https://i56578-swl.blogspot.com/2022/12/wale-wideband-traffic-probably-rapidm.html

 

 

9 December 2022

WALE & wideband traffic, probably RapidM proprietary WB-LDL & WB-RDL waveforms

My friend ANgazu and I are almost done going through nearly 30GB of recordings of broadband transmissions that took place in the portfion of 6.9-7 MHz band during October and November, monitoring was also possible thanks to SM5TAH/Mats who made available its broadband SDR receiver (Airspy HF+, SDR-IQ). As already discussed in previous posts, we think they were trial transmissions aimed at fixing the performance of modified waveforms with respect to the relative reference standards (118-110D App.D and 188-141D App.G) especially with regard to the fourth-generation ALE. Some of these tests were most likely conducted by Harris, as they more specifically concerned the 3GWB ALE (WBALE) and WHARQ broadband waveforms, although we did not find news or information about.

We also found 188-141D 4G-ALE (WALE) waveforms that use a modified/improved initial preamble that are probably traceable to trials by RapidM [1]: also in this case no direct confirmation other than a presentation given at an HFIA Industries meeting on March 2020. The traffic waveforms following those WALE handshakes are totally "new" (or at least never meet before for me) and defintely not 188-110D App.G compliant. Obviously, since these waveforms are used in the WALE trials they are developed, along with the related modem, by the same manufacturer.

bandwidths. We could detect waveforms spreading from 3 Khz to 48 Khz, their allocation within a wideband channel is negotiated during the WALE link setup stage and follows the specifications required by 188-141D (1). The examples in Figures 1a,1b show the wideband channel allocations of some of the monitored waveforms.

Fig. 1a

Fig. 1b

paradigma. The first consideration to make is that the traffic segments look like a ARQ system, but after the last data transfers the responder' ACKs are missing (Figure 2), maybe they are forward/reverse traffic links or the latest ACK is not required/mandatory by the system. Also notice that, although the wideband channel has been negotiated, the called station uses a different channel for its sendings, this channel is anyway "within" the one of the caller. Probably the responder announces it's own 16-bit sub-channel vector in the WALE confirm PDU.

Fig. 2

modulation. All the waveforms utilize eight-ary phase-shift keying (PSK8) constellation, the symbol mapping is the same used in 188-110D (Figure 3). As usual, the modulation rate varies according to the bandwidth.

Fig. 3

waveforms. According the used framing (ACF of 25.4 and 120 ms), we identified 2 families of waveforms, each consisting of 9 waveforms differing in bandwidth (3-24 and 48 KHz) and modulation rate (2400-19200 and 38400 Baud): unfortunately, the waveforms of the intermediate badwidths 30,36,42,.. KHz have not been found and therefore (hopefully at the moment) are missing.

25.4 ms framing. The frame structure consists of a "Tx Frame" consisting of a synchronization preamble followed by N "data packets" of fixed duration of 25.41 ms (except the 7200 Bd waveform), where N depends on the chosen waveform. Each data packet consists of alternating data (Unknown) and probe (Known) symbols. The frame structure is shown in Figure 4.

Fig. 4

A transmission consists of 1 or 3 Tx Frames separated by a "dead time" or a "guard interval", only the the first Tx Frame is preceeded by a TLC sequence (Figure 5).

Fig. 5

Main features of this family waveforms (so far seen) are sumarized in Table I.

Table I

The 25.4 ms periodicity of the data packets and their number N within each Tx frame can be seen in Figures 6 and 7 respectively.

Fig. 6

Fig. 7

However, I'm facing an odd problem about the length of the (known symbols) probes; let's see for example the 2400 Bd data packet: as from Figure 8, the 9.996 ms probe makes a length of 24 PSK8 symbols but after its demodulation the bitstream shows 75-bit lenght patterns, ie 25 PSK8 symbols! 

Fig. 8

The discrepancy is probably due to the SA PSK demodulator. Indeed, it must be noticed that either the preamble sequences and the probes are characterized by the lack of the sub-carrier in their harmonic spectrum (Figure 9): this feature has already been found in the modified/enhanced WALE preambles discussed in the previous post.

Fig. 9

 

120 ms framing. The frame structure consists of a TLC & synchronization preamble followed by fixed length 120 ms data packets, each data packet consisting of alternating data (Unknown) and probe (Known) symbols. The most interesting aspect is that the initial TLC & preamble sections consist of the same Tx Frame of the correspondent 25.4 ms family waveforms (Figure 10): it could be said that both waveforms (25.4 ms and 120 ms) present the same "front-end" to the receiving modem.

Fig. 10

The complete frame structure is shown in Figure 11.

Fig. 11

Figure 12 shows the 120ms period of some waveforms, unfortunately not all the samples have a good quality.

Fig. 12

The main features of this family waveforms (so far seen) are sumarized in Table II. It's interesting to see what came up when comparing the values of Table II with the correspondent values of the Waveform Number 7 of 188-110D App.D: as you see, most of the framings (ie the number of the PSK8 symbols) match the ones of the correspondent 188-110D waveforms. 

Table II

Although in some cases the durations are the same, the mini-probes sequence is different so there is no compatibilty between the observed waveforms and 188-110D. Figure 13 shows two frames of the 12 KHz 9600 Bd waveforms.

Fig. 13

RapidM Since these traffic waveforms are used together with the modified WALE waveforms seen in the previous post, it is logical to assume that they too are developed by the same manufacturer, ie - in our opinion - by Rapid Mobile (RapidM) [1]. A positive feedback comes from reading the technical documentation of their RM10 modem [2] "In addition, the RapidM proprietary wideband HF packet data modems known as WB-RDL is offered in the RM10 as a software option.  The WB-RDL waveforms and protocols are integrated with the WALE/4G ALE controller for link setup and dynamic forward/reverse traffic channel bandwidth negotiation. The combination of WALE/4G ALE with the WB-RDL provide data communication in challenged channel (e.g., SNR < 0 dB, high-latitude, high interference) conditions". More precisely, the documentation talks about the future WB-LDL & WB-RDL packet waveforms used with WALE: the acronyms could mean WideBand Low latency DataLink and WideBand Robust DataLink, that is the two families we have singled out (25.4 & 120 ms waveforms).

Fig. 12

We have quite a lot of assumptions and conjectures about it but at the moment we prefer to wait for "news" from RapidM on their official website (new RM12 wideband modem?) and monitor the HF bands for (hopefully) such new trials.

https://disk.yandex.com/d/CrBy3GAUjyaLdA 

(1) the wideband channels are described in WALE PDUs using 16-bit “sub-channel” vectors, each bit element of a sub-channel vector refers to a sub-channel within an assigned wideband channel and describes 1.5 kHz sub-channels, range of 24 kHz, or 3 KHz sub-channels, range up to 48 KHz

[1] https://i56578-swl.blogspot.com/2022/11/an-enhanced-design-for-deep-fast-wale.html
[2] https://www.rapidm.com/product/rm10-wideband-software-defined-modem/

23 November 2022

an enhanced design for Deep & Fast WALE preambles (RapidM RM12 HF modem?)

This post briefly summarizes the analysis of the Deep & Fast WALE waveforms seen so far, discussing in particular the acquisition preambles whose formation does not comply with the reference standard 188-141D (Appendix G, WALE or 4G-ALE). Some indications suggest that the monitored transmissions could be trials of a specific WALE implementation by Rapid Mobile adopted in their newest RM12 HF modem, but at present it's only a my guess.

1. Preamble
The preamble is used for rapid initial synchronization and provides time and frequency alignment. Both the Deep WALE and Fast WALE preambles use 4-ary orthogonal Walsh modulation by mapping each di-bit of the preamble sequence to "normal" or "exceptional" sets of 4-element Walsh repeated sequences.

 Walsh Sequences for WALE Preambles (MIL 188-141D, Table G-VIII)

Each 32-element is then scrambled by performing a modulo 8 addition between the PSK8 symbol sequence below and the corresponding Walsh element
{7,1,1,3,7,3,1,5,5,1,1,6,7,1,5,4,1,7,1,6,3,6,1,0,4,1,0,7,5,5,2,6}

2. Deep WALE
Deep WALE uses a 240 ms preamble consisting of 18 orthogonal Walsh modulated channel symbols. The first 14 fixed di-bits {0,1,2,1,0,0,2,3,1,3,3,1,2,0} are fixed, the final four di-bits are protocol-dependent and mapped using the "exceptional" 32-element Walsh sequences set. Each 32-element is then scrambled in accordance with 1. for a resulting sequence  of 576 PSK8 symbols.

Fig. 1 - Deep WALE preamble

I coded a C++ Deep WALE modulator in order to get a (synthesized) 188-141D compliant bitstream and then compare it to the bitstreams got by demodulating the (real) over-the-air Deep WALE calls extracted from a monitoring file. Since I was only interested on the preamble formation, to simplify the code I used a random generator in place of the 192 coded and interleaved PDU bits;  the "modulator" is limited to the PSK8 symbol mapping  (1).

Fig. 2
 

Sumarizing what seen in the previous posts, durations and symbols "into the game" are shown in Table I below:

Table I - comparison between real (on-air) and sythesized Deep WALE PDUs

As expected from the time-based analysis, the comparison of the bitstreams confirms that the real signals differ from the standard ones in the way their preamble is formed: specifically the real preambles have a longer duration (350 ms, 840 PSK8 symbols) and do not have sequence repeats (autocorrelation = 0). Conversely, the inevitable repetitions of the scrambling sequence during the formation of the synthesized preamble cause a 96-bit/32-symbols ACF (on the right of figure 3).

Fig. 3- on-air (left) and sythesized (right) DeepWALE bitstreams

The symbols of the real & synt preambles are shown below in figure 4:

Fig. 4

3. Fast WALE
As per 188-141D, Fast WALE uses a 120 ms preamble consisting of 9 orthogonal Walsh modulated channel symbols. The first 5 di-bits {3,3,1,2,0} are fixed, the final four di-bits are protocol-dependent and mapped using the exceptional set. Conversely to Deep modulation, the final two di-bits are unused and are set to 0. Each 32-element Walsh sequence of the preamble is scrambled in accordance with 1. for a resulting sequencetotal of 288 PSK8 symbols. By the way, the duration of the preamble is the same of the following coded and interleaved data frame and it's the half of the Deep WALE preamble.

Fig. 5 - Fast WALE preamble

A second C++ "sketch" was coded to produce a (synthesized) 188-141D compliant bitstream to be compared with the ones coming from the demodulation of the real signals. As in the previous code, a random generator is used in place of the coded and interleaved data bits.
From the analysis of the recordings I was able to detect at least four types(!) of Fast WALE framing which differ in the length of the preambles (figure 6) while keeping the duration - and therefore the symbols - of the data portion unchanged (120 ms, 288 PSK8 symbols) .

Fig. 6 - different Fast WALE framings

Table II - comparison between real (on-air) and sythesized Fast WALE PDUs

As in Deep modulation, the on-air preambles have no sequence repeats even when their duration matches the standard 240 ms; in the other cases, duration and therefore the number of symbols, are less than the ones specified in the standard. Figures 7,8 depict such differences, notice the 32 known symbols probes in both the bitstreams and the 96-bit/32-symbols ACF of the synthesized preamble.

Fig. 7 - on-air and sythesized Fast WALE bitstreams

Fig. 8
 
4. "RapidM RM12 modem" supposition
Unless there are other protocol "options" that I'm not aware of, the differences between the analyzed preambles and those described by 188-141D are due to a specific (proprietary?) implementation. In this regard, my friend ANgazu found an interesting document by Rapid Mobile - literally entitled "Considerations for Synchronization Enhancements for 4G/WALE" - where two proposed improvements to the WALE synchronization preambles are illustrated. Specifically, the second proposal presented by RapidM (slide 18, "WALE Enhanced Preamble") perfectly fits with durations and symbols of the on-air signals:


As said, according 188-141D every Walsh Symbol repeats the same scrambling sequence
{7,1,1,3,7,3,1,5,5,1,1,6,7,1,5,4,1,7,1,6,3,6,1,0,4,1,0,7,5,5,2,6} 
and such repetitions have detrimental effect on synchronization acquisition performance: avoiding such on-air repetitions during the preamble removes false peaks in acquisition correlations. RapidM "Enhanced Preamble" proposal just consists of the replacement of the scrambled sequences with CAZAC sequences (2) consisting of 168 PSK8 symbols for Fast WALE and 840 PSK8 symbols for Deep WALE (the other proposal concerns a 448-symbol extended scrambling sequence).
By the way, figure 9 shows the measured autocorrelations for on-air and synthesized preambles of both Deep & Fast WALE PDUs.

Fig. 9 - autocorrelations

The RapidM slides, which also announce the upcoming RM12 48kHz Wideband Modem, were presented at the HFIA meeting of March 2020: since the first WALE signals I could analyze date back January 2021, timings are consistent.

If my guesses are right, the analyzed transmissions could just be trials by RapidM, also because - at the time of writing - the RM12 modem is not yet in their catalog [1]. However, I haven't found any confirmation yet and furthermore there are some other aspects, such as the lack of the 1800 Hz carrier in the preamble sectors or the CAZAC sequences formation, which need further investigation. Probably the lack of the carrier during the preamble modulation (figure 10) is due to the "tone excision" feature, since the suppression of the 1800 Hz tone improves the waveform resilience and performance in the presence of channel interference [2]: that's another (RapidM?) enhancement to the WALE preamble.

Fig. 10 - the lack of the carrier in a Deep WALE PDU preamble

https://disk.yandex.com/d/CQum1JvCqMzEFQ

[1] https://www.rapidm.com/
[2] https://www.rapidm.com/standard/stanag-4539/ 

(1) C++ code for Deep WALE PDU formation (Arduino Mega-2560)

char buffer[60];
int preamble[18] = {0,1,2,1,0,0,2,3,1,3,3,1,2,0,0,0,0,0};
int pScramble[32] = {7,1,1,3,7,3,1,5,5,1,1,6,7,1,5,4,1,7,1,6,3,6,1,0,4,1,0,7,5,5,2,6};

int preambNorWalsh[4][32] = {
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4},
{0,0,4,4,0,0,4,4,0,0,4,4,0,0,4,4,0,0,4,4,0,0,4,4,0,0,4,4,0,0,4,4},
{0,4,4,0,0,4,4,0,0,4,4,0,0,4,4,0,0,4,4,0,0,4,4,0,0,4,4,0,0,4,4,0}
};

int preambExcWalsh[4][32] = {
{0,0,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,0,4,0,0,4,0,4,0,4,0,4,4,0,4,0,4,0,4,0,0,4,0,4},
{0,0,4,4,4,4,0,0,4,4,0,0,0,0,4,4,0,0,4,4,4,4,0,0,4,4,0,0,0,0,4,4,0,0,4,4,4,4,0,0,4,4,0,0,0,0,4,4,0,0,4,4,4,4,0,0,4,4,0,0,0,0,4,4},
{0,4,4,0,4,0,0,4,4,0,0,4,0,4,4,0,0,4,4,0,4,0,0,4,4,0,0,4,0,4,4,0,0,4,4,0,4,0,0,4,4,0,0,4,0,4,4,0,0,4,4,0,4,0,0,4,4,0,0,4,0,4,4,0}
};

int shiftRegister[159] = {
0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1,
1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0,
1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1,
0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1,
1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1,
1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0,
1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0,
1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1
};

void setup() {
  Serial.begin(9600);
}

void printBin(byte tribit) {
  for(int i=2; i>=0; i--){
    Serial.print(bitRead(tribit,i),BIN);
  }
  Serial.print(" ");
}

int getQuadbit(void) {
   return (random(16));   
}

int getTribit(void) {
  int bitout, bittap, bitin;
  int i,j;
  for(j=0; j<16; j++) {
    bitout = shiftRegister[158];
    bittap = shiftRegister[31];
      for(i=158;i>=1;i--){
        shiftRegister[i]=shiftRegister[i-1];
      }
    bitin = bitout^bittap;
    shiftRegister[0]=bitin;
  }
  return (shiftRegister[2]<<2)+(shiftRegister[1]<<1)+shiftRegister[0];
}

int doScramble (int a,int b) {
  if (a+b < 8) {
    return (a+b);
  }
  else {
    return (a+b-8);  
  }
}

void loop() {
  int scramblingSym;
  int tribit;
  int psk8;

  // preamble
  for (int i =0;i <14;i++){
    int y =preamble[i];
    for (scramblingSym=0;scramblingSym <32;scramblingSym++) {
      psk8 =doScramble(preambNorWalsh[y][scramblingSym],pScramble[scramblingSym]);
      Serial.println(psk8); //check        
    }
  }  
  for (int i =14;i <18;i++){
    int y =preamble[i];
    for (scramblingSym=0;scramblingSym <32;scramblingSym++) {
      psk8 =doScramble(preambExcWalsh[y][scramblingSym],pScramble[scramblingSym]);
      Serial.println(psk8); //check        
    }
  }  
    
  // PDU
  for (int quadBitSet =0;quadBitSet <48;quadBitSet++){
    int pduSymbol =getQuadbit();
    for (scramblingSym=0;scramblingSym <64;scramblingSym++) {
      tribit =getTribit();
      //printBin(getTribit()); //check    
      psk8 =doScramble(pduWalsh[pduSymbol][scramblingSym],tribit);
      Serial.println(psk8); //check    
      //sprintf(buffer, "Walsh modulated PDU symbol:%i  scrambling symbol:%i  PSK8:%i",pduWalsh[pduSymbol][scramblingSym],tribit,psk8);
      //Serial.println(buffer);        
    }
  }
  for( ; ; );
}



(2) Constant Amplitude Zero AutoCorrelation waveform (CAZAC) is a periodic complex-valued signal with modulus one and out-of-phase periodic (cyclic) autocorrelations equal to zero. CAZAC sequences find application in wireless communication systems for synchronization of mobile phones with base stations. Zadoff–Chu sequences are well-known CAZAC sequences with special properties. 
https://en.wikipedia.org/wiki/Constant_amplitude_zero_autocorrelation_waveform