I wanted to ask what are the equations used to generate the PN9 and PN23 sequence of the ADC test patterns.

In the manual, it is said that the first values are:

PN9: 0x0092 -- 0x125B, 0x3C9A, 0x2660, 0x0c65, 0x0697

PN23: 0x3AFF -- 0x3FD7, 0x0002, 0x26E0, 0x0A3D, 0x1CA6

But I am unable to generate those using the typical LFSR shifted by one and X-ored. I believe there is a more complex equation behind, right?

Parents
• Ok, I finally figured out with the help of two colleagues. The issue was that there was a bug in my vendors' firmware which was causing the ADC data to be inverted. On top of that, there are several things that are not mentioned in the manual. Here a reminder of all tricks:

For PN9:

- pow(2,9) -1 = 511 is the period

- Start with 0x92 as seed in a 9-bit register. It does not matter if you assume big endian or little endian, it is a palindrome.

- Get the XOR 9 and 5, call it e.g. newBit

- Create a new 9-bit register, which is the like the previous register shifting all bits to the left, and then bit0 = newBit.

- Calculate again newBit, etc.

- Finish the sequence whenever you reach the PN9 period, which is 511. You will have thus created 511 9-bit registers.

- Then, self-duplicate this array of registers, namely as many times so that it is aligned with 14. (so that we can then divide the array in groups of 14). newArraySize = least_common_multiple(511, 14) = 1022 ; nCopies = newArraySize/originalArraySize = 2; so that 1022/14 = 73 exact groups or data output words.

- Now, form the real 73 output words using groups of fourteen trans-consectuve bits, namely the highest bit (bit 8) of every consecutive 9-bit register that you in your extrapolated array.

- For example, you will obtain 0x125b, 0x3c9a by grouping the first 28 highest bits in two output words.

- Finally, configure your ADC to not invert the data (register 0x561) and to not use binary mode, but the default two's complement. Otherwise you would have to flip the last bit of your output words.

Similar for PN23:

- pow(2,23) -1 = 8388607 is the period

- Get XOR 23 and 18 as newBit

- Create a 23-bit register, etc. as before

- newArraySize = lcm(8388607, 14) = 8388607*14, nCopies = 14

- etc.

Attached is a spreadsheet illustrating the calculation.

PNsequence.ods.zip

• Great work Ferdymercury. Thanks for sharing your results on EngineerZone.