Hmm, I’m trying to take advantage of the multiple frames to nicely organize my HLA by returning 1 frame each for MOSI and MISO sides of my SPI transactions in decode()
.
def decode(self, frame: AnalyzerFrame):
'''
Process a frame from the input analyzer, and optionally return a single `AnalyzerFrame` or a list of `AnalyzerFrame`s.
The type and data values in `frame` will depend on the input analyzer.
'''
if frame.type == 'enable':
self.log('Trace', 'CS_L enabled at {0}'.format(frame.start_time))
self.mosi_data.reset()
self.miso_data.reset()
self.mosi_data.set_time(True, frame.start_time)
self.miso_data.set_time(True, frame.start_time)
elif frame.type == 'result':
self.log('Trace', 'Result frame: {0}'.format(frame.data))
self.mosi_data.add_raw_bytes(list(frame.data['mosi']))
self.miso_data.add_raw_bytes(list(frame.data['miso']))
elif frame.type == 'error':
self.log('Error', 'Clock in wrong state when CS_L enabled')
elif frame.type == 'disable':
self.log('Trace', 'CS_L disabled at {0}'.format(frame.end_time))
self.mosi_data.set_time(False, frame.end_time)
self.miso_data.set_time(False, frame.end_time)
frames = []
if self.mosi_data.parse():
self.log('Debug', 'SPI MOSI frame @ {0}\n\t{1}'.format(self.mosi_data.get_time_string(True), self.mosi_data.to_string()))
frames.append(AnalyzerFrame(SPIFrame', self.mosi_data.start_time, self.mosi_data.end_time, { 'type': 'MOSI', 'time': self.mosi_data.get_time_string(True), 'data': self.mosi_data.to_string() }))
else:
self.log('Debug', 'Unknown MOSI frame @ {0}\n\t{1}'.format(self.mosi_data.get_time_string(True), self.mosi_data.raw_bytes_to_string(self.mosi_data.raw_bytes)))
frames.append(AnalyzerFrame('Unknown', self.mosi_data.start_time, self.mosi_data.end_time, { 'time': self.mosi_data.get_time_string(True) }))
if self.miso_data.parse():
self.log('Debug', 'SPI MISO frame @ {0}\n\t{1}'.format(self.miso_data.get_time_string(True), self.miso_data.to_string()))
frames.append(AnalyzerFrame('SPIFrame', self.miso_data.start_time, self.miso_data.end_time, { 'type': 'MISO', 'time': self.miso_data.get_time_string(True), 'data': self.miso_data.to_string() }))
else:
self.log('Debug', 'Unknown MISO frame @ {0}\n\t{1}'.format(self.miso_data.get_time_string(True), self.miso_data.raw_bytes_to_string(self.miso_data.raw_bytes)))
frames.append(AnalyzerFrame('Unknown', self.miso_data.start_time, self.miso_data.end_time, { 'time': self.miso_data.get_time_string(True) }))
return frames
The HLA runs great in Logic2 v2.3.1 and I get no errors or warnings, but I only see bubbles for MISO, the 2nd item in the list I returned in decode()
, in the analyzer line of the capture. Am I doing something wrong or are there some UI constraints I may be encountering?
I’m able to workaround this by creating a single “super frame” that contains data for both MOSI and MISO, but it would be nicer to see 2 frames instead (1 stacked vertically above the other would be great, so I don’t lose valuable horizontal space when displaying multiple!)
Thanks for all the hard work you guys are putting into this software! It’s already light years better than Logic1 (in my opinion)! Keep up the good work!