project8 / psyllid

Data acquisition package for the ROACH2 system
Other
0 stars 1 forks source link

Byte ordering in ROACH packet payloads #22

Closed nsoblath closed 7 years ago

nsoblath commented 7 years ago

This was originally discussed in project8/katydid#80, so head over there to get the background.

We will make Psyllid fix the byte ordering in each 8-byte word of the payloads (both frequency and time packets). I'll use this macro to do the swap:

#define payload_swap(x)   \
    ( ( (x & 0xffff000000000000ull) >> 48 ) |  \
      ( (x & 0x0000ffff00000000ull) >> 16 ) |  \
      ( (x & 0x00000000ffff0000ull) << 16 ) |  \
      ( (x & 0x000000000000ffffull) << 48 )  )

This function will be called in the function byteswap_inplace(), which is called in both packet_receiver_socket and packet_receiver_fpa, as well as grab_packet. So the byte order will be correct for all processing in Pysllid, and when the data is written to disk.

nsoblath commented 7 years ago

I've run a test on zeppelin looking at ROACH channel "a," which has a CF of approximately 820 MHz. The injected tone is at 800 MHz. The attached spectrum shows the peak at exactly the expected place.

test_12-30-16_eth1_fs

With that, the problem appears to be resolved.