Decoding quirky SPI and general feedback

I’ve got a device that talks SPI (as a slave), but due to device’s internals it does not follow SPI protocol precisely (e.g. in CPOL=0, CPHA=0 it launches data too quickly) which makes SPI decoder incorrectly decode data, even though SPI master understands it properly. I have a high level analyzer for the protocol on top of SPI, but due to those decoding errors it is hard to reason about it and I’m forced to reverify data by looking at raw signals, which is not very convenient. I thought it would be nice to shift all signals on MISO channel e.g. 50ns, so that SPI decoder decodes it correctly.

So, I started looking at file formats in order to modify data in them and make SPI decoder (and me) happy. I studied binary format, but it didn’t work for me. Later I discovered that it was an OLD format, and the .sal format I have is new, undocumented with no way to create my own (apparently I can export data into older formats through Logic2 automation, but not import it). Bummer.

Ok, what if I can create my own SPI decoder that interprets signals incorporating proper delays where needed?! I have downloaded an SPI low level decoder project, built and plugged it in, but then I find out that high level analyzers only support just a few built in low-level decoders, not custom ones. WAT?!

Any advise?

PS ideally it would be nice to

  1. have a library (both in C/C++ and Python) to manipulate raw data. It takes a capture (.sal) file, reads and decodes it, then gives you view of that data in a way that is easy to work with/manipulate. And it works both ways, so you can create signals and when saving it will properly encode it.
  2. have high level analyzers working with custom low-level decoders.
  3. have better documentation on high level analyzers. E.g. return_types field is not documented at all. Ok, it’s a dictionary mapping from custom types to those types settings. But the only setting that everybody use is the “format”, which appears to be some template engine template (Jinja?). Can we use normal Jinja stuff for those, e.g. conditional rendering (e.g. show some value but only if it is not zero)? Are there any other settings for return types besides “format”? Should this field be a class variable or it can be an instance variable initialized in constructor (e.g. based on settings)?

@maxim.kulkin Sorry for all the trouble with that.

The binary format described in the support article you linked pertains to binary files exported via exporting raw data (which is different from the .sal capture file generated when saving your capture). This is mentioned at the top of the support article.

We don’t publish official documentation, nor maintain documenation, for the .sal file format, but we provided some unofficial notes about it in the forum post below.

As for adding HLA support for your custom analyzer, we’ve provided some guidelines below.

For the other questions I haven’t addressed, I’ll meet with the rest of the team here and I’ll follow up with you on those topics.