<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Two chips on one SPI]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I'm using IO ninja spi tap. I have two chips on one SPI bus (with two separate chip select pins), flash and eeprom. When FLASH chip select is set to HIGH, the sniffer reads bytes from EEPROM at this time, and vice versa, when EEPROM chip select is set to HIGH, I see the bytes sent from FLASH in the log.</p>
<p dir="auto">Is it possible to set in options or write a script when chip select is on the HIGH level so that the logger does no read data from spi? or filter it out? I've just started using this tool and i'm not yet expert with scripting.</p>
<p dir="auto">Bartosz.</p>
]]></description><link>http://64.23.185.212/forum/topic/19/two-chips-on-one-spi</link><generator>RSS for Node</generator><lastBuildDate>Wed, 12 Aug 2026 06:31:06 GMT</lastBuildDate><atom:link href="http://64.23.185.212/forum/topic/19.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 02 Feb 2022 13:57:11 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Two chips on one SPI on Fri, 11 Feb 2022 11:10:57 GMT]]></title><description><![CDATA[<p dir="auto">Hi Vladimir,</p>
<p dir="auto">thank you for the script, it worked perfectly!</p>
<p dir="auto">Bartosz.</p>
]]></description><link>http://64.23.185.212/forum/post/61</link><guid isPermaLink="true">http://64.23.185.212/forum/post/61</guid><dc:creator><![CDATA[Bartosz Kozlowski]]></dc:creator><pubDate>Fri, 11 Feb 2022 11:10:57 GMT</pubDate></item><item><title><![CDATA[Reply to Two chips on one SPI on Wed, 09 Feb 2022 02:01:13 GMT]]></title><description><![CDATA[<p dir="auto">Hello Bartosz,</p>
<p dir="auto">The script for a filter to do what you want is very simple. First, you deduce the state of the CS line (from the <code>I2cSpiTapLogRecordCode.SpiStart and SpiStop</code> log records); then, you use this state to either hide or show the MOSI/MISO data (the <code>log.StdRecordCode.TxRx</code> log records).</p>
<p dir="auto">The source code for such a filter might look something like this:</p>
<pre><code>import "doc_Layer.jnc"
import "I2cSpiTap/I2cSpiTapLogRecordCode.jnc"

class SpiCsFilterLayer:
	doc.Layer,
	log.Filter
{
protected:
	ui.EnumProperty* m_csFilterProp; // a property to choose the filtering strategy
	int m_cs; // the state of the CS line

public:
	construct(doc.PluginHost* pluginHost);

	override bool filter(
		uint64_t timestamp,
		uint64_t recordCode,
		void const* p,
		size_t size
		);
}

SpiCsFilterLayer.construct(doc.PluginHost* pluginHost)
{
	basetype.construct(pluginHost);

	ui.EnumPropertyOption csFilterOptions[] = {
		{ "Show always", -1 },
		{ "Show when CS low", 0 },
		{ "Show when CS high", 1 },
	}

	m_csFilterProp = m_pluginHost.m_propertyGrid.createEnumProperty(
		"MOSI/MISO filter",
		"Show MOSI/MISO filtering criteria",
		csFilterOptions,
		countof(csFilterOptions)
	);

	m_cs = -1; // -1 means unknown
	pluginHost.m_log.addFilter(this);
}

bool SpiCsFilterLayer.filter(
	uint64_t timestamp,
	uint64_t recordCode,
	void const* p,
	size_t size
	)
{
	bool isVisible = true;

	switch (recordCode)
	{
	case log.StdRecordCode.SessionStarted:
		m_cs = -1; // reset to unknown
		break;

	case I2cSpiTapLogRecordCode.SpiStart:
		m_cs = 0;
		break;

	case I2cSpiTapLogRecordCode.SpiStop:
		m_cs = 1;
		break;

	case log.StdRecordCode.TxRx:
		isVisible =
			m_csFilterProp.m_value == -1 || // show always
			m_csFilterProp.m_value == m_cs; // matches the current state of CS
		break;
	}

	return isVisible;
}
</code></pre>
<p dir="auto">An archive with the complete filter plugin is attached (<a href="/forum/assets/uploads/files/1644371934574-spicsfilter.7z">SpiCsFilter.7z</a>)</p>
<p dir="auto">Usage:</p>
<ol>
<li>Start I2C/SPI session</li>
<li>Open the <code>SpiCsFilter.njplg</code> file to attach this filter</li>
<li>Go to "Settings"</li>
<li>Select the appropriate filtering criteria</li>
<li>Hit "Apply and rebuild log" to apply the filter to the whole log (clicking "Apply" or "OK" will apply the filter "from now on" (i.e., to the follow-up log records only)</li>
</ol>
]]></description><link>http://64.23.185.212/forum/post/60</link><guid isPermaLink="true">http://64.23.185.212/forum/post/60</guid><dc:creator><![CDATA[Vladimir]]></dc:creator><pubDate>Wed, 09 Feb 2022 02:01:13 GMT</pubDate></item></channel></rss>