This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PGA460-Q1: Number representation after BPF filtering

Part Number: PGA460-Q1
Other Parts Discussed in Thread: PGA460

I extract raw data from PGA460 via Direct Data Burst mode. When DP_MUX=3, the data are extracted from BPF filter. I cannot understand format of the numbers extracted.

On the upper subplot each byte is plotted as unsigned 8-bit integer. It looks like twos-complement, and I converted it to signed int number. Signal after reinterpretation is plotted on lower subplot.

You can see an artifact at indexes 87, 88. The bytes in these indexes are equal to 0x7B, that is considered as positive number 123. It seems, really there should be the number 123-256=-133. So, the conclusion is, the number representation is not two's complement. But what?

When I extracted raw data from rectifier (DP_MUX=2), there was no artifacts, so, it's not bug, but undocumented feature.

Another parameters:

SAMPLE_SEL=0

TH_P1_T1=0xFF

TH_P2_T1 = 0xFF

BPF_B1_MSB = 0x14

BPF_B1_LSB = 0xBF

BPF_A2_MSB = 0x8E

BPF_A2_LSB = 0x67

BPF_A3_MSB = 0xD6

BPF_A3_LSB = 0x81

The code containing the signal, two's complement decoder and plotter:

import numpy as np
import matplotlib.pyplot as plt

def packToBytes(pack):
    return np.array([int(x, 16) for x in pack.split(' ')])


def processBpfTwoComplement(samples, width):
    sampleValues = np.copy(samples)
    width = 8 if width == '8bit' else 12
    for i in np.ndindex(sampleValues.shape):
        val = int(sampleValues[i])
        if (val & (1 << (width - 1))) != 0:
            sampleValues[i] = val - (1 << width)
    return sampleValues


signal = "02 05 07 09 09 05 fe f8 f3 f1 f0 f2 f8 fe 02 04 04 03 03 05 0a 0f 13 14 14 12 0d 06 fd f7 f4 f5 f7 fa fd fe fb f6 f3 f1 f2 f5 fd 05 0b 0f 0f 0b 07 05 04 05 07 0e 19 22 25 20 15 05 f1 de cf c5 be b9 b7 b9 bf c8 d6 f2 1c 41 5d 6e 76 75 6d 5f 4e 36 14 ea c0 9e 87 7b 7b 82 96 bb ec 1b 42 5e 70 73 67 51 37 1a fa e0 cf c4 c0 c3 d0 e3 f9 0d 1f 2a 28 1d 0d fb e9 d9 d2 d6 e1 f1 05 1c 2f 3a 40 42 3c 2c 19 02 e7 cc b4 a7 a2 a6 b7 d3 f8 1c 39 4e 5b 5d 54 43 2d 12 f5 da c4 b1 a5 a3 ae c3 dc fb 1d 39 4c 53 53 4a 38 22 0b f7 e4 d4 d4 cb c7 c6 ca d5 e5 f7 08 18 26 2c 29 23 1e 14 09 00 fc fa f8 f7 f8 f7 f1 ed ec ee ee f0 f4 fa fd ff 03 08 0d 10 14 1b 21 21 1d 16 0b fd f1 e8 e2 df e0 e6 f0 f7 ff 08 10 14 14 13 12 0e 06 fd f5 ed e7 e7 eb f0 f7 01 0d 18 1d 20 20 1d 13 06 fa ec de d5 d1 d4 da e6 f8 0c 1f 2d 39 3f 3c 31 21 0d f7 e2 d0 c3 bb bb c3 d2 e6 fc 15 2d 3f 49 4c 49 3c 28 10 f7 de c8 ba b2 b0 b7 c7 dc f4 0c 23 38 47 4f 4e 46 36 20 08 ef d8 c8 bf ba bb c3 d1 e3 f7 0c 20 31 31 3e 44 46 40 34 22 0c f6 e0 ce c1 bb ba be c9 da ee 02 16 29 39 43 46 44 3b 2a 15 fe e9 d5 c6 c0 c0 c3 cd dd f1 06 19 2a 37 3f 42 3e 34 23 0f fa e6 d6 c8 c1 c2 c6 cf dd f1 06 18 27 34 3d 3f 3a 2e 1f 0b f6 e3 d3 c7 c1 c2 ca d6 e6 fa 11 25 34 3d 42 42 39 29 18 05 f1 dd ce c5 c0 c0 c7 d5 e6 fa 0e 22 31 39 3c 3b 34 26 14 01 ef de d0 c9 c5 c4 c9 d7 e9 fb 0d 1f 2f 38 3b 3b 36 2a 19 07 f6 e6 d7 cd c8 c7 ca d4 e5 f7 09 19 29 34 39 38 33 2a 1b 1b 08 f7 e9 dc d2 cd cc ce d4 e0 f0 00 0e 1b 27 2d 2e 2c 27 1e 11 02 f5 ea e0 db db dd df e7 f2 ff 08 11 1a 22 23 22 22 1f 15 08 fb f1 e7 df dc dd e0 e4 ed f9 05 0e 15 1b 1e 1d 1a 16 10 06 fc f4 ef eb e8 e8 e9 eb ef f8 02 09 0e 13 1a 1e 1d 19 15 0d 03 f8 f1 eb e6 e4 e6 e9 ed f3 fb 04 0a 0f 13 18 1a 17 13 0f 07 fc f2 ec e7 e4 e4 e8 ee f4 fc 06 0d 12 16 19 1b 1a 16 10 09 ff f5 ef eb e6 e3 e4 e9 f0 f8 02 0b 12 16 1a 1e 1d 18 10 07 fd f3 eb e6 e2 e2 e0 e2 e7 ef f7 ff 09 11 16 19 18 18 16 11 0b 05 ff f9 f5 f3 f1 f0 ee ef f2 f7 fd 04 0b 10 12 12 11 10 0d 0a 06 01 fc f7 f3 ef ed ec eb ee f4 fc 04 0a 0f 11 11 10 0d 0a 06 02 fd f9 f6 f4 f3 f3 f4 f8 fe 03 09 0d 0f 0d 0c 0c 09 05 02 ff fb f8 f6 f2 ee ee f2 f6 fa 00 07 0c 0f 12 12 0f 0b 06 01 fc f5 f1 ef ef ed ef f3 f8 fe 05 0b 10 12 15 17 15 11 0c 05 fe f7 f1 ee ec ea ea ee f6 fc 02 08 0e 10 12 14 14 11 0b 05 ff f9 f1 ec e8 e5 e6 e9 e9 f0 f9 01 07 0f 14 14 15 17 15 10 09 03 fe f8 f2 ef f0 f1 f0 f2 f8 fe 02 07 0b 0e 0c 0d 0f 0d 09 04 01 fd f8 f5 f4 f6 f6 f4 f5 f9 fc fe 01 05 07 07 09 0b 0b 07 04 03 00 fc f9 fa fc fd fe ff 02 01 01 02 03 05 07 0a 0b 08 02 ff fd f8 f3 f1 f1 f4 f7 fa ff 03 04 04 05 05 06 09 0c 0c 09 04 01 fe f8 f5 f5 f8 f8 f9 fb ff 01 00 00 01 04 08 0d 11 10 0c 06 01 fc f6 f2 f3 f6 f7 f9 fc fe fd fb fc fd fd ff 04 06 05 01 00 03 03 04 07 0b 0e 0e 0b 07 01 fa fa f6 f6 f7 f8 f8 fa f9 f5 f1 f2 f4 f6 fb 03 0b 10 11 0e 0c 0c 0b 0b 0d 0d 0c 09 05 fc f1 eb e9 eb ee f1 f7 fd ff ff fe fe fe 01 05 09 0c 0c 0c 0c 08 04 03 05 08 09 09 08 06 00 fa f6 f4 f5 f9 fb fb fa f8 f5 f3 f2 f4 fa 01 08 0c 0e 0d 0c 09 07 06 06 09 0a 09 04 fe f8 f3 f1 ef f0 f5 fa fc fe ff ff 00 01 03 05 0b 12 14 12 0d 07 02 fd f9 f8 f9 fa f8 f6 f5 f4 f3 f5 f9 fd 02 06 09 09 07 06 06 06 07 06 07 07 05 01 fc f8 f6 f6 f7 f8 f9 fb fd fd fd fa fa fc ff ff 02 06 09 0a 08 08 09 0a 0b 0c 0e 0e 0a 05 fe f6 ef eb ec ef f1 f4 f7 fa fa fa fa fc 00 05 0a 0f 10 0f 10 0e 0b 07 06 07 07 05 02 ff fb f7 f5 f5 f7 f7 f9 fc fc fa f7 f7 f9 fc ff 03 08 0a 0a 07 07 08 08 08 09 0b 0b 08 04 fd f5 f1 f1 f2 f3 f6 fa fe fe fc fc fb fc 00 05 0a 0d 0f 0f 0d 09 05 03 03 03 02 01 ff fc f8 f5 f2 f1 f2 f4 f7 fa fd fe ff 00 01 03 05 08 0c 0d 0d 0d 0b 08 05 03 00 fd fb f9 f8 f7 f4 f3 f3 f5 f7 fa fd 00 04 06 08 0a 0d 0e 0e 0e 0c 0a 08 05 01 fd fa f8 f7 f7 f6 f4 f3 f3 f3 f3 f6 f9 fc 01 05 09 0c 0d 0e 0f 0e 0d 0c 0b 09 07 04 01 fe fb f8 f8 fa fa f9 f6 f5 f4 f3 f3 f5 fa 00 05 09 0c 0d 0d 0d 0a 09 08 06 06 04 02 fe f9 f6 f5 f5 f5 f7 f9 fa fa fa fb fd ff 04 07 0a 0b 0d 0e 0d 0a 07 05 03 02 01 ff fd fa f7 f4 f1 f1 f3 f6 f9 fc ff 01 02 02 02 04 09 0c 0d 0d 0c 09 04 ff fb f8 f8 f8 f6 f6 f7 f8 f9 fa fb fd 00 05 07 08 0b 0d 0d 0b 09 07 05 04 02 00 fd fb fa f9 f6 f2 f0 f0 f1 f1 f2 f4 f7 fb 00 05 08 0a 0b 0d 0e 0e 0d 0d 0c 0a 07 03 00 fc f8 f6 f6 f9 fa fa f9 f8 f7 f7 f8 f9 fc 00 07 0c 0e 0e 0d 0c 0a 08 06 04 03 02 00 fd f9 f6 f6 f6 f6 f6 f7 f9 fa fa f9 f9 fc 00 05 0a 0d 0f 11 10 0d 09 08 07 05 02 00 fe fb f8 f6 f5 f4 f4 f6 f9 fa fb fc fe ff fe 00 04 05 03 04 08 0a 09 0a 0a 09 08 05 02 fe f9 f6 f6 f7 f5 f4 f6 f9 f9 fa fb fe 02 05 08 0b 0d 0f 0f 0e 0a 06 03 02 01 fd fa f9 f8 f5 f0 ef f0 f3 f6 f9 fc ff 01 04 05 06 07 0b 0e 0e 0f 0e 0c 0b 09 05 00 fc fb fa f9 f9 f8 f6 f4 f4 f3 f3 f5 fa 00 05 07 0a 0c 0e 0d 0b 0b 0a 08 06 04 02 ff fb f8 f6 f6 f5 f5 f6 f6 f6 f7 fa fc fd 00 06 0b 0d 0e 10 10 0d 0a 09 07 05 03 01 fe f9 f5 f5 f6 f6 f5 f7 f9 fa fa fa fb fd ff 03 07 08 07 08 08 08 06 05 06 07 06 04 02 ff fc f8 f7 f6 f5 f7 f9 fb fc fc fc fe ff 00 03 07 09 0b 0c 0b 0b 0a 07 05 04 02 00 fd fb f8 f6 f5 f3 f2 f3 f4 f6 f8 f9 fb ff 02 05 07 08 0b 0e 0e 0e 0d 0c 0a 08 05 01 fc f9 f7 f7 f5 f3 f2 f3 f4 f6 f7 f9 fb fe 00 04 07 08 09 0b 0d 0c 0b 0a 09 09 07 04 01 fc f7 f4 f4 f5 f5 f4 f6 f7 f7 f7 f9 fc 00 03 08 0c 0e 0f 10 10 0e 0b 09 08 07 04 ff fc f9 f6 f4 f2 f1 f1 f2 f5 f8 fa fc ff 03 06 08 09 09 09 0a 0a 09 09 07 06 04 01 fe fb f9 f9 f9 f8 f8 f9 f9 fa fc fc fd ff 03 05 07 07 08 09 09 08 08 08 08 07 05 02 ff f9 f5 f3 f1 ef ef f2 f5 f7 f8 fb 00 02 05 09 0e 12 13 12 0f 0c 07 03 ff fc f9 f7 f6 f3 f1 f0 f2 f5 f8 fc 02 06 09 0a 0b 0d 0c 0a 09 09 07 05 03 01 ff fc f8 f6 f6 f6 f3 f2 f4 f5 f6 f7 fa fe 01 05 09 0c 0c 0d 10 11 0f 0c 0a 09 06 02 fe fc f9 f7 f7 f7 f5 f5 f5 f5 f5 f5 f7 fb ff 03 06 09 0b 0a 09 0a 09 0a 0a 09 09 07 03 ff fa f6 f3 f3 f4 f6 f7 f9 fb fd fc fc ff 02 05 09 0b 0c 0e 0e 0c 0a 08 06 04 02 00 fc f9 f7 f5 f3 f2 f2 f4 f6 f8 fa fc fe 01 03 06 08 0a 0d 0d 0c 0a 07 05 03 00 fd fc fb fa f8 f5 f5 f6 f8 fb fe 00 02 04 05 07 0a 0d 0d 0c 09 05 02 fe fa f8 f7 f6 f4 f4 f4 f5 f6 f7 fa fd ff ff 02 05 08 08 06 07 0a 0c 0d 0e 0d 0c 0a 05 fe fa f6 f4 f6 f7 f7 f8 f9 f9 f8 f7 f8 fa fe 03 07 0a 0b 09 08 08 08 08 0a 0c 0c 09 05 00 fa f4 f0 f0 f3 f6 f9 fb fc fb fa f8 f8 fb ff 05 0c 0e 0d 0b 0b 0a 07 05 07 0a 09 07 03 ff fa f4 f1 f2 f3 f5 fa fd fe fc fb fc fc fd 00 06 0a 0a 09 08 07 05 04 04 05 06 06 05 02 fd f8 f6 f7 f8 f7 f9 fb fb fa f8 f8 fa fe 02 07 0c 0d 0d 0c 09 05 03 03 04 04 04 03 01 fd f8 f4 f2 f2 f3 f4 f5 f8 f9 fa fb fd 00 04 08 0c 0e 11 11 10 10 0c 08 05 04 03 01 ff fd fa f7 f7 f4 f1 f1 f2 f5 f7 f9 fb 00 03 05 07 08 0b 0e 0f 0e 0c 0a 07 04 01 fe fb fa fa fa f8 f7 f8 f8 f7 f7 f9 fb fd ff 03 05 07 08 08 09 0b 0d 10 11 0f 0b 08 03 fb f4 f1 ef ef f1 f3 f5 f5 f6 f8 f8 f9 fc 02 09 0c 0d 0e 0e 0d 0a 08 07 05 05 06 04 00 fb f6 f4 f4 f5 f6 f9 fc fd fc fc fc fd ff 02 06 09 0a 0b 0b 08 06 04 03 02 02 01 01 ff fb f7 f7 f5 f3 f3 f6 f8 fa fc fe ff 01 03 06 09 0c 0e 0e 0d 0b 07 04 03 01 ff ff ff fd f9 f6 f4 f2 f1 f2 f6 f6 f9 fd ff 03 06 06 05 04 05 07 09 0b 0b 09 08 06 02 fe fa f9 f9 fb fb fa fa fa f7 f5 f5 f6 f9 fe 04 09 0b 0d 0d 0c 0c 0b 0d 0e 0d 0b 07 02 fc f5 f0 ef f1 f2 f5 f8 f8 f8 f9 f9 f9 fb ff 04 09 0c 0a 09 09 08 07 08 0a 0b 0c 0b 08 01 f9 f4 f1 f0 f3 f8 fc ff ff fe fd fa f7 f9 fe 03 07 0a 0b 09 06 05 05 05 06 07 09 07 03 fd f7 f3 f1 f1 f3 f7 fa fd ff ff fd fb fd 01 04 08 0b 0e 10 0f 0c 09 08 06 05 04 02 fd f8 f5 f3 ef ed ef f2 f4 f7 f9 fc fe 00 02 05 08 0c 10 12 11 11 0e 0b 07 03 00 fe fd fb f9 f9 f7 f4 f3 f2 f4 f6 f8 fb 00 05 07 08 0a 0c 0e 0f 0f 0e 0c 08 03 ff fc f9 f7 f6 f5 f4 f5 f6 f6 f6 f7 f9 fb fe 00 04 07 09 0a 0b 0d 0e 0e 0e 0b 09 06 02 fd f9 f6 f5 f7 f7 f8 f9 fa f9 f8 f9 fb fe 02 07 0a 0a 09 09 08 06 04 03 04 05 04 02 fe fa f7 f3 f2 f2 f4 f7 fb fd ff 01 01 01 02 05 0b 10 13 12 0f 0a 05 00 fb f8 f7 f9 fa f9 f7 f5 f5 f6 f6 f7 fa 00 04 07 08 0a 0b 0b 0b 0a 08 06 04 02 fd f9 f7 f6 f5 f4 f4 f6 f9 fb fd fe fe 00 03 05 06 09 09 0e 11 11 0e 0a 08 05 03 00 fd fb f9 f7 f7 f4 f0 ee ef f1 f3 f6 fb 00 04 06 09 0c 0e 10 0f 0f 0e 0c 09 07 04 ff fd fb f9 f7 f6 f6 f6 f5 f3 f5 f8 fb fe 02 08 0c 0c 0c 0d 0d 0a 08 07 04 02 01 00 fc f8 f5 f5 f7 f6 f6 f7 f8 f8 f8 f8 fa fe 01 08 0d 0f 0e 0f 0f 0b 06 03 02 01 00 ff ff fd fa f8 f6 f4 f3 f6 fb fe ff ff 01 03 02 00 02 08 0a 0a 0b 0b 09 05 02 ff fa f7 f7 f8 f5 f3 f4 f7 f9 f9 fb ff 03 05 07 08 0a 0b 0b 0c 0b 09 07 08 07 03 ff fd fa f7 f3 f0 f1 f1 f1 f1 f3 f6 f9 fb ff 03 06 07 07 08 09 09 0a 0c 0d 0c 0a 08 07 03 fd fa f8 f7 f7 f8 f6 f5 f3 f3 f5 f5 f7 fc 03 09 0d 0e 0e 0e 0e 0b 0a 0a 09 07 05 03 fe f8 f4 f2 f2 f2 f4 f8 f9 f8 f8 f9 fb fc 00 05 09 0b 0d 10 10 0d 09 09 09 06 04 02 00 fb f7 f5 f5 f6 f5 f6 f8 f9 f9 f9 fa fc fd 01 06 0a 09 0a 0c 0b 08 05 05 05 04 03 02 fe fa f7 f5 f4 f2 f3 f6 fa fd fe 00 02 03 04 08 0e 11 12 11 0e 09 04 00 fc f7 f6 f7 f6 f4 f2 f0 f1 f3 f4 f7 fd 03 07 09 09 09 09 09 09 09 09 0a 0b 0b 09 06 01 fb f7 f6 f6 f8 fa f9 f9 f7 f6 f5 f5 f7 fc 02 08 0e 10 0e 0c 0c 0a 08 08 09 0a 09 07 02 fb f6 f2 f0 f2 f3 f3 f5 f8 f7 f5 f6 f9 fe 02 08 0e 10 0f 0f 0d 0b 09 07 07 08 08 05 01 fd f9 f7 f6 f7 f8 f8 f8 f7 f6 f5 f5 f6 fa 00 07 0c 0e 0e 0c 0b 07 03 02 04 03 02 00 fe fb f7 f6 f5 f6 f7 fa fd ff fd fc fd fe 00 04 09 0c 0d 0e 0e 0c 09 05 02 01 00 ff fd fc fa f6 f2 f1 f1 f0 f3 f8 fb fd 00 03 05 04 06 0a 0d 0f 0e 0d 0c 08 03 00 fe fb f7 f8 f8 f9 f6 f3 f3 f5 f5 f6 f8 fc 01 05 08 0a 0a 0a 0c 0c 0d 0c 0a 0b 0a 05 ff fa f6 f3 f1 f0 f0 f2 f3 f4 f7 fa fb ff 04 09 0b 0d 0e 0e 0c 0a 0b 0b 0a 08 07 06 03 fe fa f8 f6 f5 f6 f7 f7 f6 f5 f5 f5 f7 fb 02 08 0b 0b 0b 0d 0b 08 06 05 04 03 04 03 00 fc f9 f9 f8 f8 f9 fa fc fb fa f9 fa fb fd 00 05 08 0a 0b 0d 0c 0a 09 08 05 03 03 02 fe f8 f4 f3 f2 f1 f3 f5 f7 fa fb fc fd ff 01 05 08 08 0a 0e 0f 0e 0b 0a 07 05 02 ff fc f9 f8 f6 f2 f2 f4 f8 fa fb fc fe 00 01 01 02 03 07 0c 0f 11 10 0e 0a 06 02 fc f8 f6 f4 f5 f3 f0 f1 f3 f4 f4 f7 fb ff 05 09 0a 0a 0a 0c 0d 0d 0e 0f 10 0e 0a 06 01 fd f9 f5 f5 f6 f7 f6 f5 f3 f3 f3 f5 f7 fb 02 08 0c 0d 0b 0a 0a 08 06 06 07 09 09 05 00 f9 f6 f4 f3 f5 f7 fa fc fc fb fa fb fe 01 05 0a 0d 0f 10 0e 09 03 01 01 00 00 01 01 ff fc f9 f6 f4 f3 f3 f4 f7 f9 fb fc fd fe 01 05 08 09 0b 0e 0e 0c 09 07 05 03 03 00 fd fb fa fa f9 f6 f4 f6 f7 f8 f9 fb fe 00 02 04 06 09 0d 0e 0e 0c 09 06 03 00 fc f9 f9 f8 f8 f5 f1 f2 f3 f3 f4 f7 fb fe 01 04 07 08 08 0a 0e 0f 0f 10 11 0e 09 05 02 fd f8 f5 f6 f8 f7 f5 f5 f6 f4 f3 f5 f9 fc 00 05 08 0a 08 08 0a 09 09 0a 0c 0b 09 06 01 fc f7 f3 f3 f5 f5 f5 f8 fa f9 f9 fc 00 03 07 0d 11 12 11 0d 09 05 02 00 00 00 ff ff fe fc f7 f1 ee ee ee f1 f7 fb ff 02 05 06 06 09 0d 0f 10 10 0f 0c 07 03 fe fb f7 f5 f4 f3 f3 f3 f4 f8 fb fd 00 06 09 0a 0c 0f 0f 0d 09 07 05 01 fd fb fa f9 f5 f1 ef f0 f1 f4 f8 fc ff 03 07 08 06 06 09 0c 0c 0c 0b 0c 0d 0a 06 03 00 fd f9 f8 f9 fa f8 f6 f6 f4 f1 f2 f6 fb ff 03 09 0d 0c 09 08 09 08 07 08 0a 0b 08 05 02 fb f5 f3 f3 f6 f6 f6 f8 f8 f7 f5 f7 fc ff 04 09 10 11 0f 0e 0d 0b 08 07 08 08 06 04 01 fb f5 f2 f4 f6 f7 f8 f9 f8 f5 f2 f2 f5 f9 00 08 0f 11 10 0f 0c 07 04 03 04 05 05 03 00 fd f8 f5 f5 f6 f7 fa fc fd fb f9 f9 fb fc 00 06 0c 0f 0f 0f 0d 09 04 01 01 02 02 00 ff fc f7 f4 f2 f0 ef f1 f6 fa fb fb fd 00 03 05 07 0c 12 14 13 11 0e 09 04 01 fd f9 f9 f7 f8 f6 f1 ef f0 f2 f3 f6 fa ff 04 06 08 08 07 07 09 0c 0d 0c 0b 0a 09 02 fc f8 f5 f4 f4 f5 f6 f7 f7 f7 f9 fa fa fd 02 05 08 0b 0d 0e 0e 0c 0d 0d 0c 0a 09 07 03 fc f8 f5 f2 f2 f4 f5 f5 f5 f6 f8 f9 f9 fb 01 07 08 09 0a 0b 09 07 07 08 08 08 07 06 02 ff fc fa f8 f5 f5 f7 f8 f7 f7 f8 fa fc fe 03 09 0c 0c 0c 0c 09 07 07 08 06 04 02 00 fc f6 f3 f3 f3 f1 f2 f6 f9 f9 fa fc fc fd 01 07 0b 0b 0c 0e 0e 0b 08 07 08 06 05 03 01 fe fa f7 f7 f5 f1 f1 f2 f4 f4 f3 f4 f8 fd 00 04 0a 0e 0d 0d 0e 0c 09 05 04 04 01 00 ff fe fb f8 f8 f9 f7 f4 f4 f6 f7 f7 f9 fd 02 06 08 0c 0e 0f 10 11 11 0e 0a 08 06 01 fb f7 f6 f5 f3 f2 f2 f3 f4 f4 f6 f7 f8 fc 01 04 07 0a 0c 0e 0e 0c 0c 0c 09 06 04 02 ff fb f8 f8 f8 f6 f7 fa fc fb fb fc fd fd fe 01 04 06 06 07 09 0b 0a 0a 09 08 05 02 ff fb f6 f4 f3 f1 f1 f3 f6 f9 fa fc fe 01 04 06 08 0c 0f 0f 0e 0d 0a 06 03 01 ff fc fa f9 f7 f3 f1 f3 f4 f5 f6 fb ff 02 04 07 08 08 0a 0c 0c 0c 0c 0a 08 06 03 ff fb f9 f8 f5 f3 f2 f3 f2 f2 f4 f8 f9 fc 02 08 0d 0e 0f 10 12 10 0d 0c 0a 08 05 03 00 fc f9 f7 00"

samples = packToBytes(signal)[:200]
sampleTime = np.arange(samples.size)

samplesDecoded = processBpfTwoComplement(samples, '8bit')

fig1 = plt.figure()
ax1 = fig1.add_subplot(211)
ax1.plot(sampleTime, samples, label='Samples')


ax2 = fig1.add_subplot(212)
ax2.plot(sampleTime, samplesDecoded, label='Samples')

  • Hello Xibei,

    Thanks for posting to the sensors forum! 

    This value should be a twos complement value as expected. Just to confirm I collected from the BPF using the direct data burst. I exported the raw data into an excel sheet and calculated the 2's complement of the raw data and got the expected results. I have attached my excel sheet here for reference.

    PGA460 direct data burst raw data.xlsx

    I am not sure why you are seeing strange behavior on your end. Have you verified your conversion is correct? To generate a -123 your hex value would be 0x85, 0x7B will generate a positive 123. The graphs you provided were these done using real data or a test signal? 

    Best,

    Isaac

  • Hello Isaac!

    I sure that conversion is correct. The actual sample value is 0x7B, decoded value is a positive 123, while nearest neighbors are negative, that provides an artifact. The graphs I provided were done in Listen Only mode when another transducer is burst.

    I examined the series your provided and found same multiple artifacts located from 250 to 320 uS. The upper subplot is unsigned byte interpretation (red line is at 128), the lower subplot is 2s-complement interpretation.

    We can see that on upper plot series crosses red line from top and from bottom. When this crossing happens, there are an artifacts appear on lower plot.

    Before 250 uS we can see nice wave of 87.6 kHz, as well as after 320 uS. On time interval from 250 to 320 uS frequency grows by up to 4 times, and it seems to be out of BPF band. So, I suppose your series are also affected.

    The code for plotting:

    import numpy as np
    import matplotlib.pyplot as plt
    
    def processBpfTwoComplement(samples, width):
        sampleValues = samples.copy()
        width = 8 if width == '8bit' else 12
        for i in np.ndindex(sampleValues.shape):
            val = int(sampleValues[i])
            if (val & (1 << (width - 1))) != 0:
                sampleValues[i] = val - (1 << width)
        return sampleValues
    
    samples = np.array([0, 254, 255, 255, 64, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 252, 251, 255, 4, 12, 13, 10, 5, 244, 237, 231, 233, 247, 1, 12, 29, 32, 26, 18, 250, 239, 224, 223, 232, 242, 9, 20, 27, 30, 26, 9, 254, 236, 231, 235, 241, 3, 10, 12, 10, 7, 255, 251, 249, 254, 7, 11, 13, 12, 7, 246, 238, 231, 232, 243, 252, 21, 31, 38, 34, 25, 255, 237, 211, 207, 218, 231, 11, 32, 48, 59, 53, 22, 255, 209, 194, 191, 202, 243, 14, 41, 74, 76, 51, 28, 224, 198, 172, 176, 213, 241, 17, 73, 88, 80, 60, 255, 219, 168, 160, 164, 207, 241, 58, 84, 100, 88, 34, 252, 180, 158, 150, 175, 204, 29, 66, 108, 108, 67, 32, 206, 172, 150, 150, 172, 245, 34, 101, 115, 98, 69, 242, 199, 165, 137, 146, 205, 249, 79, 107, 118, 100, 28, 237, 193, 137, 132, 170, 207, 44, 84, 126, 122, 69, 26, 233, 153, 132, 142, 170, 255, 48, 118, 130, 103, 68, 23, 184, 149, 126, 140, 210, 2, 93, 121, 126, 103, 67, 227, 181, 125, 123, 170, 211, 54, 96, 135, 128, 104, 21, 225, 143, 123, 137, 169, 5, 56, 98, 138, 130, 68, 20, 177, 141, 119, 136, 211, 5, 57, 129, 139, 107, 68, 225, 176, 119, 117, 166, 210, 5, 101, 130, 133, 108, 19, 221, 137, 118, 144, 181, 227, 65, 97, 113, 99, 36, 252, 182, 164, 171, 192, 221, 30, 58, 83, 74, 32, 3, 207, 190, 187, 204, 227, 24, 46, 69, 64, 25, 0, 211, 197, 193, 207, 230, 25, 46, 67, 64, 27, 1, 209, 194, 191, 205, 228, 25, 47, 69, 67, 32, 4, 209, 192, 186, 197, 218, 20, 46, 75, 75, 44, 14, 212, 191, 177, 186, 204, 8, 39, 80, 85, 62, 35, 223, 195, 167, 171, 186, 243, 23, 79, 92, 81, 59, 245, 210, 164, 159, 167, 217, 0, 69, 91, 96, 79, 13, 230, 169, 155, 155, 192, 228, 51, 82, 106, 97, 42, 0, 182, 158, 148, 171, 200, 25, 63, 109, 110, 71, 34, 205, 171, 143, 151, 173, 246, 35, 101, 115, 97, 68, 238, 196, 142, 138, 149, 211, 0, 83, 109, 115, 95, 18, 227, 155, 138, 137, 180, 220, 56, 92, 122, 113, 51, 5, 175, 147, 134, 157, 189, 23, 67, 120, 123, 83, 42, 204, 166, 141, 139, 162, 241, 33, 107, 124, 108, 77, 242, 196, 159, 129, 139, 202, 248, 83, 113, 125, 106, 29, 235, 189, 131, 127, 168, 206, 47, 89, 131, 126, 68, 21, 181, 147, 129, 143, 173, 8, 56, 122, 131, 99, 59, 216, 173, 127, 129, 148, 226, 20, 103, 126, 118, 90, 255, 206, 137, 126, 132, 189, 236, 75, 110, 130, 114, 40, 245, 158, 133, 124, 159, 196, 38, 83, 131, 130, 79, 33, 190, 152, 129, 135, 163, 250, 45, 119, 134, 109, 74, 232, 184, 126, 122, 136, 206, 255, 93, 123, 130, 107, 22, 226, 143, 124, 122, 169, 211, 56, 98, 137, 129, 66, 16, 174, 140, 122, 141, 173, 10, 61, 128, 137, 102, 61, 214, 169, 137, 123, 143, 221, 14, 104, 129, 127, 100, 8, 212, 144, 223, 15, 103, 129, 127, 101, 7, 212, 136, 121, 125, 180, 224, 62, 102, 137, 127, 58, 7, 168, 137, 122, 146, 180, 15, 62, 127, 136, 99, 57, 211, 168, 137, 127, 147, 225, 17, 103, 127, 124, 94, 0, 207, 166, 126, 132, 189, 231, 70, 106, 131, 118, 41, 248, 200, 137, 127, 160, 196, 30, 75, 127, 129, 80, 34, 241, 158, 135, 140, 165, 248, 41, 114, 128, 105, 69, 22, 186, 153, 132, 146, 213, 3, 90, 117, 121, 98, 59, 220, 178, 133, 134, 182, 225, 63, 99, 126, 114, 87, 253, 207, 142, 132, 160, 196, 34, 75, 122, 121, 104, 29, 237, 159, 139, 145, 171, 2, 48, 112, 123, 117, 60, 15, 182, 151, 135, 152, 228, 19, 96, 116, 121, 83, 45, 209, 171, 135, 140, 198, 243, 74, 104, 119, 102, 73, 240, 196, 139, 134, 173, 214, 48, 85, 109, 113, 92, 16, 226, 154, 137, 152, 184, 17, 60, 114, 119, 108, 48, 4, 175, 147, 138, 160, 241, 30, 99, 115, 115, 72, 35, 204, 167, 136, 144, 208, 253, 78, 104, 116, 93, 63, 233, 192, 141, 138, 180, 221, 53, 88, 110, 108, 86, 10, 220, 152, 138, 157, 191, 23, 64, 96, 116, 103, 41, 254, 172, 146, 142, 165, 247, 35, 74, 115, 113, 67, 27, 195, 162, 138, 150, 218, 7, 85, 108, 116, 87, 54, 222, 183, 140, 141, 188, 231, 62, 94, 113, 105, 80, 252, 208, 147, 138, 165, 200, 33, 73, 118, 117, 100, 29, 239, 162, 141, 147, 173, 1, 46, 110, 120, 115, 60, 15, 184, 153, 137, 153, 224, 15, 94, 115, 121, 86, 48, 212, 173, 135, 140, 193, 238, 70, 102, 119, 105, 75, 243, 199, 142, 136, 171, 209, 43, 81, 108, 115, 95, 18, 229, 157, 140, 156, 185, 13, 54, 87, 114, 103, 43, 2, 182, 158, 153, 173, 241, 25, 60, 100, 99, 59, 25, 210, 183, 164, 174, 224, 0, 58, 76, 82, 61, 36, 235, 210, 183, 186, 219, 244, 38, 56, 65, 54, 36, 246, 225, 201, 201, 223, 242, 25, 39, 47, 41, 29, 250, 233, 213, 212, 229, 245, 22, 35, 43, 37, 26, 249, 233, 213, 213, 231, 247, 25, 37, 44, 37, 25, 247, 231, 211, 209, 227, 243, 24, 39, 52, 48, 36, 0, 236, 206, 200, 213, 229, 14, 34, 58, 58, 35, 15, 249, 209, 197, 198, 211, 253, 22, 59, 67, 55, 37, 14, 221, 202, 188, 194, 230, 255, 45, 61, 67, 56, 38, 245, 221, 189, 186, 207, 228, 23, 47, 72, 71, 60, 17, 247, 201, 187, 189, 203, 249, 20, 61, 71, 71, 44, 21, 225, 204, 184, 188, 222, 247, 42, 60, 72, 63, 47, 254, 229, 191, 184, 198, 218, 12, 36, 68, 71, 64, 28, 4, 212, 195, 188, 198, 238, 7, 51, 64, 63, 51, 31, 239, 217, 190, 189, 213, 234, 26, 46, 66, 63, 52, 11, 244, 205, 195, 200, 213, 255, 21, 54, 61, 60, 35, 15, 228, 211, 196, 200, 229, 250, 34, 49, 57, 50, 36, 254, 235, 207, 203, 214, 228, 9, 26, 40, 51, 46, 20, 2, 224, 213, 208, 215, 244, 5, 35, 43, 46, 34, 21, 246, 232, 215, 214, 228, 241, 15, 27, 37, 39, 33, 9, 250, 226, 220, 221, 229, 253, 9, 21, 33, 34, 23, 13, 246, 236, 225, 226, 237, 247, 2, 20, 26, 26, 22, 6, 252, 236, 232, 232, 237, 252, 4, 12, 23, 24, 19, 12, 253, 245, 235, 234, 240, 246, 5, 11, 16, 19, 18, 8, 2, 246, 241, 238, 240, 249, 255, 5, 15, 17, 16, 12, 1, 250, 241, 239, 241, 244, 249, 4, 10, 17, 17, 12, 7, 251, 245, 238, 239, 241, 251, 2, 13, 17, 18, 15, 4, 253, 242, 238, 238, 242, 247, 4, 10, 18, 19, 13, 7, 249, 243, 237, 237, 241, 253, 3, 15, 19, 18, 14, 1, 250, 238, 236, 236, 243, 250, 9, 15, 21, 20, 10, 3, 244, 239, 237, 239, 244, 2, 9, 18, 20, 15, 10, 251, 244, 238, 235, 238, 250, 2, 15, 19, 19, 15, 2, 251, 244, 237, 237, 245, 251, 8, 14, 19, 17, 7, 1, 244, 239, 237, 241, 247, 4, 10, 18, 18, 12, 6, 250, 244, 240, 240, 243, 254, 4, 15, 17, 15, 10, 253, 247, 242, 239, 240, 249, 0, 11, 15, 16, 13, 3, 254, 244, 242, 241, 246, 251, 6, 11, 15, 15, 7, 2, 246, 243, 241, 243, 247, 2, 7, 14, 15, 11, 6, 252, 248, 243, 244, 245, 253, 2, 10, 13, 11, 8, 255, 250, 244, 243, 244, 251, 255, 8, 11, 12, 10, 3, 255, 247, 245, 245, 249, 252, 5, 8, 11, 10, 4, 0, 249, 246, 245, 248, 251, 2, 6, 11, 11, 8, 4, 252, 249, 246, 245, 248, 255, 3, 9, 11, 8, 6, 254, 250, 247, 245, 246, 252, 0, 7, 10, 10, 9, 2, 255, 248, 246, 246, 250, 253, 4, 7, 9, 8, 4, 1, 251, 249, 248, 249, 251, 1, 4, 8, 8, 6, 3, 254, 252, 250, 250, 251, 255, 1, 4, 4, 3, 2, 255, 254, 253, 253, 253, 255, 0, 2, 3, 2, 2, 0, 255, 254, 254, 254, 0, 0, 2, 2, 0, 0, 254, 254, 254, 255, 0, 1, 2, 3, 3, 1, 0, 254, 253, 253, 254, 1, 3, 4, 4, 3, 0, 254, 251, 251, 252, 254, 2, 3, 5, 6, 6, 2, 0, 251, 249, 1, 6, 7, 7, 5, 255, 252, 248, 248, 250, 252, 3, 5, 8, 9, 8, 3, 0, 249, 247, 247, 249, 0, 3, 7, 10, 10, 5, 1, 250, 247, 246, 247, 253, 1, 8, 10, 11, 8, 5, 253, 249, 245, 246, 251, 254, 6, 9, 10, 8, 5, 254, 250, 246, 246, 249, 253, 4, 7, 10, 9, 7, 1, 253, 247, 246, 249, 252, 3, 7, 10, 9, 8, 1, 254, 247, 245, 247, 249, 2, 6, 12, 12, 11, 5, 0, 247, 245, 244, 246, 254, 3, 11, 13, 13, 7, 3, 249, 245, 242, 244, 252, 1, 10, 13, 15, 11, 7, 252, 248, 242, 242, 248, 252, 7, 11, 14, 12, 8, 255, 250, 243, 243, 246, 250, 5, 9, 14, 13, 11, 3, 253, 245, 243, 244, 247, 1, 5, 12, 13, 12, 5, 0, 247, 244, 243, 246, 255, 4, 12, 13, 11, 8, 3, 249, 245, 242, 244, 251, 1, 10, 13, 13, 10, 6, 252, 247, 241, 242, 247, 252, 8, 12, 15, 14, 11, 1, 252, 243, 241, 244, 248, 3, 8, 14, 14, 9, 4, 254, 245, 242, 242, 245, 255, 4, 13, 15, 13, 9, 5, 250, 246, 242, 243, 250, 255, 8, 11, 12, 10, 7, 253, 249, 244, 244, 248, 252, 5, 9, 12, 12, 6, 2, 253, 246, 245, 247, 249, 1, 5, 10, 10, 6, 3, 0, 249, 247, 247, 249, 0, 3, 9, 10, 9, 6, 255, 252, 249, 246, 247, 252, 255, 5, 7, 7, 6, 1, 254, 251, 248, 249, 252, 254, 4, 6, 7, 7, 4, 2, 255, 250, 250, 251, 252, 0, 2, 5, 5, 3, 2, 0, 253, 252, 252, 253, 0, 1, 3, 3, 3, 3, 2, 255, 254, 253, 253, 254, 255, 1, 1, 1, 0, 0, 0, 0, 0, 0, 255, 255, 0, 1, 2, 1, 1, 1, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 1, 1, 1, 1, 1, 255, 255, 254, 255, 0, 1, 2, 2, 2, 2, 1, 255, 254, 252, 252, 253, 254, 1, 2, 4, 5, 4, 3, 1, 253, 252, 251, 251, 254, 0, 4, 5, 6, 5, 4, 255, 252, 248, 248, 250, 252, 2, 5, 8, 8, 7, 3, 0, 251, 249, 249, 251, 255, 1, 6, 7, 7, 5, 2, 252, 250, 248, 249, 253, 0, 5, 6, 7, 6, 4, 0, 254, 250, 250, 252, 254, 2, 4, 5, 5, 4, 0, 254, 251, 251, 252, 254, 1, 3, 5, 5, 4, 2, 0, 254, 253, 252, 253, 255, 1, 4, 4, 2, 1, 255, 252, 251, 252, 253, 0, 2, 4, 4, 3, 2, 1, 255, 254, 253, 254, 255, 0, 2, 3, 2, 1, 254, 253, 252, 253, 254, 1, 2, 4, 4, 3, 2, 255, 254, 253, 253, 253, 0, 2, 4, 5, 3, 1, 253, 251, 250, 251, 252, 1, 3, 6, 7, 5, 3, 254, 251, 250, 250, 251, 255, 1, 6, 6, 5, 4, 254, 251, 249, 248, 249, 254, 2, 7, 9, 8, 6, 0, 253, 249, 248, 249, 252, 255, 5, 7, 9, 7, 1, 254, 248, 247, 247, 250, 253, 4, 7, 10, 9, 4, 1, 251, 248, 247, 248, 250, 1, 4, 9, 9, 6, 3, 251, 248, 246, 247, 249, 0, 4, 9, 10, 8, 5, 255, 252, 247, 247, 248, 252, 0, 7, 9, 9, 7, 0, 252, 246, 245, 246, 251, 255, 6, 9, 10, 8, 3, 255, 249, 248, 249, 250, 253, 3, 6, 8, 8, 3, 0, 250, 248, 248, 250, 252, 2, 5, 8, 8, 5, 2, 253, 250, 248, 249, 251, 1, 4, 8, 8, 4, 1, 251, 248, 247, 249, 254, 2, 5, 9, 9, 6, 3, 253, 250, 248, 248, 252, 255, 3, 8, 9, 7, 4, 253, 250, 246, 246, 251, 254, 2, 8, 9, 9, 7, 1, 254, 249, 248, 249, 251, 254, 4, 7, 7, 6, 1, 254, 250, 249, 250, 252, 1, 3, 6, 7, 7, 4, 1, 252, 250, 249, 250, 255, 1, 4, 7, 6, 2, 0, 251, 250, 250, 252, 0, 3, 5, 7, 7, 4, 2, 253, 251, 249, 250, 254, 0, 5, 7, 7, 5, 2, 253, 250, 248, 248, 252, 255, 5, 7, 8, 7, 6, 0, 253, 249, 248, 249, 252, 2, 5, 8, 7, 6, 1, 255, 250, 249, 250, 252, 0, 3, 6, 6, 6, 3, 2, 253, 252, 251, 251, 255, 1, 4, 5, 5, 2, 0, 253, 251, 252, 253, 0, 1, 4, 4, 4, 3, 1, 254, 253, 252, 253, 255, 1, 4, 5, 4, 2, 0, 252, 251, 251, 252, 254, 0, 4, 5, 5, 5, 3, 255, 253, 251, 251, 253, 255, 4, 5, 5, 4, 2, 254, 252, 250, 251, 254, 0, 4, 5, 5, 4, 1, 255, 253, 251, 251, 253, 255, 3, 5, 5, 3, 255, 253, 250, 250, 251, 254, 0, 4, 5, 5, 4, 1, 255, 251, 251, 251, 253, 255, 4, 6, 7, 5, 1, 254, 249, 248, 249, 252, 254, 4, 6, 7, 7, 4, 1, 253, 251, 250, 250, 251, 1, 3, 7, 7, 4, 2, 252, 250, 249, 250, 252, 0, 2, 6, 6, 5, 3, 255, 253, 251, 250, 251, 254, 1, 5, 6, 5, 3, 255, 252, 250, 249, 250, 255, 1, 6, 7, 6, 5, 0, 254, 251, 249, 250, 253, 0, 5, 7, 7, 5, 0, 254, 251, 248, 249, 252, 255, 4, 6, 8, 7, 3, 0, 254, 249, 248, 249, 252, 2, 5, 8, 8, 4, 1, 251, 249, 248, 249, 251, 8, 7, 3, 0, 253, 249, 249, 251, 253, 3, 5, 7, 6, 2, 255, 253, 249, 249, 251, 253, 3, 6, 9, 8, 5, 2, 255, 249, 248, 248, 250, 0, 4, 9, 9, 6, 3, 255, 250, 248, 248, 250, 255, 3, 8, 9, 8, 6, 0, 252, 250, 247, 247, 253, 0, 7, 8, 8, 6, 255, 252, 248, 248, 248, 252, 255, 5, 7, 8, 7, 2, 255, 250, 249, 248, 251, 254, 4, 6, 7, 6, 2, 255, 250, 249, 249, 251, 254, 3, 6, 8, 8, 4, 2, 252, 250, 248, 249, 251, 2, 4, 7, 7, 4, 1, 251, 249, 248, 249, 251, 1, 4, 9, 9, 8, 5, 255, 252, 247, 247, 248, 253, 1, 7, 9, 7, 5, 255, 252, 248, 247, 248, 252, 255, 5, 8, 9, 7, 2, 255, 250, 249, 249, 251, 254, 3, 5, 6, 5, 2, 0, 252, 250, 250, 251, 253, 2, 5, 7, 7, 5, 2, 252, 250, 249, 250, 254, 0, 3, 6, 6, 4, 2, 253, 251, 249, 250, 254, 0, 3, 6, 7, 6, 4, 0, 253, 249, 249, 252, 254, 0, 4, 6, 5, 4, 0, 254, 251, 250, 251, 253, 255, 3, 5, 6, 5, 2, 0, 253, 252, 252, 253, 254, 0, 1, 2, 2, 1, 1, 255, 254, 254, 254, 255, 0, 1, 2, 3, 3, 2, 0, 0, 254, 254, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 1, 1, 2, 2, 1, 0, 0, 255, 255, 255, 255, 1, 1, 1, 1, 1, 255, 254, 253, 254, 254, 255, 2, 2, 3, 3, 3, 0, 255, 253, 253, 254, 255, 2, 3, 4, 4, 1, 255, 253, 251, 251, 252, 254, 2, 4, 6, 5, 3, 1, 255, 251, 250, 251, 252, 1, 4, 7, 7, 4, 1, 254, 249, 248, 249, 251, 1, 4, 8, 8, 6, 3, 1, 251, 249, 249, 250, 255, 3, 7, 8, 6, 4, 1, 251, 249, 248, 249, 254, 1, 6, 8, 8, 6, 1, 254, 251, 248, 249, 252, 255, 5, 7, 8, 6, 1, 254, 251, 247, 247, 251, 254, 4, 7, 9, 8, 4, 1, 253, 248, 247, 249, 252, 2, 5, 9, 9, 5, 2, 251, 248, 246, 247, 249, 0, 4, 10, 11, 9, 6, 254, 251, 246, 246, 247, 253, 1, 8, 9, 8, 6, 255, 252, 247, 246, 246, 251, 255, 6, 9, 10, 9, 3, 255, 248, 247, 246, 249, 252, 4, 7, 10, 9, 4, 1, 249, 247, 246, 248, 251, 2, 6, 10, 11, 7, 4, 252, 249, 0, 163, 255, 255, 255, 255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 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, 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, 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, 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, 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, 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, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
    
    samplesDecoded = processBpfTwoComplement(samples, '8bit')
    
    x = np.arange(samples.size)
    
    fig = plt.figure()
    ax1 = fig.add_subplot(211)
    ax1.plot(x[210:350], samples[210:350])
    ax1.axhline(y=128, color='r', linestyle='--')
    
    ax2 = fig.add_subplot(212, sharex = ax1)
    ax2.plot(x[210:350], samplesDecoded[210:350])
    

  • Hello Xibei,

    Thanks for the info. Since the BPF is the first stage if the DSP it is most likely not enough to get rid of the additional artifacts you are referring to on this signal. If you look at the block diagram for the PGA460 there are still additional processing that the signal goes through to eliminate this additional noise you are calling artifacts.

    Best,

    Isaac

  • Hello Isaac!

    I not agree. The phenomenon we are seeing doesn't look like noise.

    Let's consider a half wave sampled at indexes from 249 to 254 in the series you provided. The unsigned byte values are [48, 118, 130, 103, 68, 23]. When we plot these values as unsigned int, we can see nice half wave.

    The decoded two's complement values are [48, 118, -126, 103, 68, 23]. The value -126 doesn't look like noised value, but artifact. It's too huge to be noise. When we plot these values, there will not be half-wave! It seems this value meant to be equal to 130.

    You said BPF is the first stage of signal processing. The next stage is rectifier. What really will be output of rectifier in this case: [48, 118, 130, 103, 68, 23] or [48, 118, 126, 103, 68, 23]? I feel 126 would be wrong output. Yes, an artifact will be removed, but the output of rectifier will be screwed up.

    I think the real data can be restored using first derivative analysis. 0th value keeps unchanged, the all anothers is processed as follows.

    Assuming the all samples are unsigned bytes, we calculate two variants of difference. The first is simple difference between i-th and (i-1)-th sample, the second is i-th sample minus (i-1)-th sample minus 256. Now we select those difference whose absolute is less. The restored i-th sample will be sum of (i-1)-th sample and the difference selected. The code for restore is below.

    def restore(samples, width):
        width = 8 if width == '8bit' else 12
        restored = np.copy(samples)
        for i in range(1, restored.size):
            diff1 = samples[i] - restored[i-1]
            diff2 = samples[i] - (1 << width) - restored[i-1]
            absDiffList = [np.abs(diff1), np.abs(diff2)]
            diff = [diff1, diff2][absDiffList.index(min(absDiffList))]
            restored[i] = restored[i - 1] + diff
        return restored

    You can compare blue and orange curve on lower subplot. We have got nice wave with maximum peak values -139 and 139.

  • Hello Xibei,

    Thanks for the info. I see what you mean here, I was misunderstanding what you meant by artifacts. It is possible that using signed 2's complement is not the correct conversion of the data. But without zooming in the data seems to make sense with a signed twos compliment implementation. Can you show the entire data set with your implementation in orange below?

    I am checking with the digital design team to see what kind of data is being output by the different stages to ensure that we are calculating it appropriately. I will get back to you once they provide more info.

    Best,

    Isaac

  • Hello Isaac!

    I have added new column "Restored" in excel sheet you provided. This column implements an algorithm I offered. Twos complement and restored series are plotted on same figure.

    PGA460 direct data burst raw data.xlsx

  • Hello Xibei,

    Thanks for the info! I am still waiting to hear back from the digital design team. It might be some time because the designer familiar with this design is out of office.

    Best,

    Isaac