Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

decoding not operational with new setup #92

Open
tomeichlersmith opened this issue Feb 19, 2025 · 3 comments · May be fixed by #96
Open

decoding not operational with new setup #92

tomeichlersmith opened this issue Feb 19, 2025 · 3 comments · May be fixed by #96
Labels
bug Something isn't working

Comments

@tomeichlersmith
Copy link
Member

pfdecoder silently ignores all of the data packets since they have a different header word 0xbeef2025.

Additionally, the HGCROCv3b output data packets are a slightly different schema than the v2 data packets pfdecoder and the other decoding classes were used to. We will want to update that as well.

@tomeichlersmith tomeichlersmith added the bug Something isn't working label Feb 19, 2025
@tomeichlersmith
Copy link
Member Author

The output of the HGCROC is pretty well understood (the HGCROC Manual Working Document is copied to pflib's documentation website: https://ldmx-software.github.io/pflib/HGCROC3b_Working_Document_v1.1.pdf) and that is where I am starting. Relative to the decoding that was in v2 pflib, the HGCROC has been changed from v2 to v3 which is the main alteration to the HGCROC's output data format.

Moreover, we will want to decode the intermediate HGCROC data format because the more complicated ECON output format will need to be emulated #94 in order to avoid having to juggle different custom formats between test benches and the real detector.

@tomeichlersmith
Copy link
Member Author

I've played a little with the infrastructure around unpacking/decoding and I think I've landed on something that will be helpful.

I want to avoid duplicating the code as much as possible since getting things correct is so finnicky. With this in mind, the decoding should work both "from file" (when reading a binary file written by the current pedestal running) and "in memory" (in the future, we decode the data while doing pedestal runs).

I've copied some stream-like "readers" that can unify reading words from a binary file and from a in-memory buffer of data. I also think using std::span will be helpful in the case where we already have a std::vector of data and we want to pass a "slice" of that data around (e.g. when giving the 40 words corresponding to a specific link into the link structure for decoding). std::span does this slicing without copying the data which is nice for our read-only purposes.

@tomeichlersmith
Copy link
Member Author

Alrightie, this is the hexdump of the first event from a functional (not good) pedestal run done by Jeremy a few weeks ago. I got his printout with hexdump -v -n 432 -e '1/4 "%08x" "\n"' and then manually added my comments alongside.

A few notes

  • The common mode words from the DAQ links do not start with twelve zeros. They both have a single one in the same place making me think that either the working document manual is incorrect or the configuration/alignment of the chip is slightly off.
  • Without introducing another dependency (Boost?), I don't have a reliable way to calculate the CRC checksum of the links.
  • The trigger links have not been properly set up and so the words we see collected from them are garbage.
  • I think a logging library would make enabling/disabling these messages from the decoding area much easier. If we want to use Boost for the CRC checksum, we could then also use Boost's logging library. If we want to avoid using Boost due to its size, we could use spdlog for logging and some other standalone CRC implementation. (like this one from C-snippets).
11888811 - start of packet signal word
beef2025 - start of packet signal word
00000068 - length of packet in 32-bit words (104, does not include signal words)
00280028 - length of first two links (40 and 40)
00050005 - length of next two links (5 and 5)
00050005 - length of last two links (5 and 5)
f00c0482 - daq link header word
01022802 - common mode word
0c500c03                                                                                                              
08208602                                                                                                              
08309602                                                                                                              
0850d702                                                                                                              
0c705d03                                                                                                              
0cf04403                                                                                                              
08e0fb02                                                                                                              
0ca06503                                                                                                              
0c104903                                                                                                              
0c300803                                                                                                              
0c906503                                                                                                              
0c509603                                                                                                              
0ce03403                                                                                                              
0c104d03                                                                                                              
0c508e03                                                                                                              
0cf08d03                                                                                                              
0c508e03                                                                                                              
0cf03c03                                                                                                              
0c705d03 - calib channel sample
0cf03c03                                                                                                              
0ca02803                                                                                                              
0cf07d03                                                                                                              
0cf03803                                                                                                              
0cf07d03                                                                                                              
0c509603                                                                                                              
0c50d303                                                                                                              
0c90aa03                                                                                                              
0cb02c03                                                                                                              
0c701c03                                                                                                              
0cd06d03                                                                                                              
0c204d03                                                                                                              
0cb02803                                                                                                              
0cd03403                                                                                                              
0cb06503                                                                                                              
0c705503                                                                                                              
0870e702                                                                                                              
08f0ff02 - 
20385c8f - CRC checksum
f00c0482 - daq link header word
01020402 - common mode word
0c508e03
0890fb02
0c300c03
0cf04403
08f0ff02
0830d702
08f0ff02
08509a02
0c504d03
0cb03403
0cf07d03
0ca03403
0c304d03
0c203d03
08f00f03
0850d702
08d0fb02
0c90a603
0c107e03
0c709e03
0c90aa03
0c308e03
0c409603
0c30cf03
0cc06d03
0c90e703
0c906503
0cc02c03
0c909e03
0c501003
0cf03803
0870ae02
08f00f03
0cf03c03
0ce03403
0850d302
0870df02
6044bad2
30000400 - trigger link header
a64d1ab5
a64d1ab5
a64d1ab5
a64d1ab5
30000401 - trigger link header
a6ac9ab5
a6ac9ab5
a6ac9ab5
a6ac9ab5
30000402 - trigger link header
a68cdab4
a68cdab4
a68cdab4
a68cdab4
30000403 - trigger link header
a5cc5ab5
a5cc5ab5
a5cc5ab5
a5cc5ab5
d07e2025 - end of packet signal word
12345678 - end of packet signal word

@tomeichlersmith tomeichlersmith linked a pull request Mar 17, 2025 that will close this issue
3 tasks
@tomeichlersmith tomeichlersmith linked a pull request Mar 17, 2025 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant