<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>i.MX ProcessorsのトピックRe: iMX8MP SPI timing issues</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/iMX8MP-SPI-timing-issues/m-p/2184090#M241308</link>
    <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;This could be related to the scheduling, is the ecspi the only thing running when you are running your test?&lt;BR /&gt;&lt;BR /&gt;Also, regarding creating your own driver this could be possible, for this I would recommend to reach our pro support they would be able to help you on that:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://contact.nxp.com/new-prof-svcs-sw-tech" target="_blank"&gt;https://contact.nxp.com/new-prof-svcs-sw-tech&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Best regards/Saludos,&lt;BR /&gt;Aldo.&lt;/P&gt;</description>
    <pubDate>Fri, 10 Oct 2025 21:28:34 GMT</pubDate>
    <dc:creator>AldoG</dc:creator>
    <dc:date>2025-10-10T21:28:34Z</dc:date>
    <item>
      <title>iMX8MP SPI timing issues</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX8MP-SPI-timing-issues/m-p/2183045#M241278</link>
      <description>&lt;P&gt;Dear community!&lt;/P&gt;&lt;P&gt;I have some questions about the SPI behavior on imx8mp... .&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;MASTER&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;As I'm using the IMX Linux Kernel 6.6.36 with SPI Master settings.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;pinctrl_ecspi1: ecspi1grp {
	fsl,pins =
		&amp;lt;MX8MP_IOMUXC_ECSPI1_MISO__ECSPI1_MISO		0x82&amp;gt;,
		&amp;lt;MX8MP_IOMUXC_ECSPI1_MOSI__ECSPI1_MOSI		0x82&amp;gt;,
		&amp;lt;MX8MP_IOMUXC_ECSPI1_SCLK__ECSPI1_SCLK		0x82&amp;gt;,
		&amp;lt;MX8MP_IOMUXC_ECSPI1_SS0__GPIO5_IO09		0x82&amp;gt;;
};

&amp;amp;ecspi1 {
	#address-cells = &amp;lt;1&amp;gt;;
	#size-cells = &amp;lt;0&amp;gt;;
	cs-gpios = &amp;lt;&amp;amp;gpio5 9 GPIO_ACTIVE_LOW&amp;gt;;
	pinctrl-names = "default";
	pinctrl-0 = &amp;lt;&amp;amp;pinctrl_ecspi1&amp;gt;;
	status = "okay";

	spidev0: board@0 {
		compatible = "rohm,dh2228fv";
		reg = &amp;lt;0&amp;gt;;
		spi-max-frequency = &amp;lt;20000000&amp;gt;;
	};
};&lt;/LI-CODE&gt;&lt;P&gt;so fully HW SPI should be used with chip-select as well.&lt;/P&gt;&lt;P&gt;I wanted to send some bytes from this peripheral, so I used &lt;EM&gt;spidev_test&lt;/EM&gt; binary for those purposes:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;spidev_test -D /dev/spidev3.0 -v -s 20000000 -b 8 -p "\x11\x22\x33"&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;It should send 3 bytes from master at 20MHz which is working fine, from data point of view, but not the timing. If I send more bytes, the delay between last clock and deactivation the chipselect is in range of microseconds. Sometimes it's ~4us, sometimes ~500us, so it's really nondeterministic.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tek00000.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/360055iAD1B507D75B4F2EE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tek00000.png" alt="tek00000.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tek00001.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/360056i8ACB5E5B7B889DE3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tek00001.png" alt="tek00001.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So it's basically unusable if you imagine, that I wanted to use 512B transfer at 120Hz, which is ~8.33ms and the delay will be ~1ms.&lt;/P&gt;&lt;P&gt;I was looking into driver and didn't find any place where the delay or timeout should happens.&amp;nbsp;&lt;A href="https://github.com/nxp-imx/linux-imx/blob/lf-6.6.y/drivers/spi/spi-imx.c" target="_blank"&gt;https://github.com/nxp-imx/linux-imx/blob/lf-6.6.y/drivers/spi/spi-imx.c&lt;/A&gt;&amp;nbsp;or&amp;nbsp;&lt;A href="https://github.com/nxp-imx/linux-imx/blob/lf-6.6.y/drivers/spi/spi.c" target="_blank"&gt;https://github.com/nxp-imx/linux-imx/blob/lf-6.6.y/drivers/spi/spi.c&lt;/A&gt;&amp;nbsp;should have the delays set to 0 while is not set. How to really set the value to minimum or make it deterministic at least. Is it done by design, or there is some king of bug?&lt;/P&gt;&lt;P&gt;Next problem is with multi &lt;EM&gt;spi_ioc_transfers&lt;/EM&gt;. If you send multiple transfers, they are "scheduled" not immediately, but sometimes there is some kind of delay between them.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tek00011.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/360057i1B41CF37BEAAEE3A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tek00011.png" alt="tek00011.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tek00013.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/360058iF548DFBBB1B0D604/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tek00013.png" alt="tek00013.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Is it done by scheduler, or where/how this happen?&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SLAVE&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Now we look at the slave part.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;pinctrl_ecspi2: ecspi2grp {
	fsl,pins =
		&amp;lt;MX8MP_IOMUXC_SD2_DATA3__ECSPI2_MISO		0x1C0&amp;gt;,
		&amp;lt;MX8MP_IOMUXC_ECSPI2_MOSI__ECSPI2_MOSI		0x1C0&amp;gt;,
		&amp;lt;MX8MP_IOMUXC_ECSPI2_SCLK__ECSPI2_SCLK		0x1C0&amp;gt;,
		&amp;lt;MX8MP_IOMUXC_SD2_DATA2__ECSPI2_SS0		0x1C0&amp;gt;;
	};

&amp;amp;ecspi2 {
	#address-cells = &amp;lt;0&amp;gt;;
	#size-cells = &amp;lt;0&amp;gt;;
	pinctrl-names = "default";
	pinctrl-0 = &amp;lt;&amp;amp;pinctrl_ecspi2&amp;gt;;
	spi-slave;
	status = "okay";
};&lt;/LI-CODE&gt;&lt;P&gt;I wanted to use the slave in a way, where the number of received bytes is not known. I wanted to use a variant which will be relying on CS. I have to probably create an own driver with ring-buffer and inform a user-space once the data have been received. Is it even possible to wrap this driver?&lt;/P&gt;&lt;P&gt;Many thanks for any kind of advice.&lt;/P&gt;&lt;P&gt;Andy&lt;/P&gt;</description>
      <pubDate>Thu, 09 Oct 2025 13:32:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX8MP-SPI-timing-issues/m-p/2183045#M241278</guid>
      <dc:creator>andrej_valek</dc:creator>
      <dc:date>2025-10-09T13:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: iMX8MP SPI timing issues</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX8MP-SPI-timing-issues/m-p/2184090#M241308</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;This could be related to the scheduling, is the ecspi the only thing running when you are running your test?&lt;BR /&gt;&lt;BR /&gt;Also, regarding creating your own driver this could be possible, for this I would recommend to reach our pro support they would be able to help you on that:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://contact.nxp.com/new-prof-svcs-sw-tech" target="_blank"&gt;https://contact.nxp.com/new-prof-svcs-sw-tech&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Best regards/Saludos,&lt;BR /&gt;Aldo.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Oct 2025 21:28:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX8MP-SPI-timing-issues/m-p/2184090#M241308</guid>
      <dc:creator>AldoG</dc:creator>
      <dc:date>2025-10-10T21:28:34Z</dc:date>
    </item>
    <item>
      <title>Re: iMX8MP SPI timing issues</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX8MP-SPI-timing-issues/m-p/2184944#M241352</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;First, I would like to thanks for the replays, but I have an another questions then.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;This could be related to the scheduling, is the ecspi the only thing running when you are running your test?&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Yes, nothing else, just a &lt;EM&gt;spidev_test&lt;/EM&gt; utility was running on the device. Is there a way to see the scheduling, or?&lt;/P&gt;&lt;P&gt;I made some more measurements...&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;spidev_test -D /dev/spidev3.0 -b 8 -s 20000000 -I 10000 -S 4096
spi mode: 0x0
bits per word: 8
max speed: 20000000 Hz (20000 kHz)
rate: tx 9660.0kbps, rx 9660.0kbps
rate: tx 10918.3kbps, rx 10918.3kbps
rate: tx 10898.6kbps, rx 10898.6kbps
rate: tx 10905.2kbps, rx 10905.2kbps
rate: tx 10911.7kbps, rx 10911.7kbps
rate: tx 10918.3kbps, rx 10918.3kbps
total: tx 40000.0KB, rx 40000.0KB&lt;/LI-CODE&gt;&lt;P&gt;As you can see, that clock is set to 20MHz, but the real speed is about ~10Mbps. So I change the clock to 50MHz.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;spidev_test -D /dev/spidev3.0 -b 8 -s 50000000 -I 10000 -S 4096
spi mode: 0x40
bits per word: 8
max speed: 50000000 Hz (50000 kHz)
rate: tx 13349.7kbps, rx 13349.7kbps
rate: tx 13382.5kbps, rx 13382.5kbps
rate: tx 13369.3kbps, rx 13369.3kbps
rate: tx 13395.6kbps, rx 13395.6kbps
total: tx 40000.0KB, rx 40000.0KB&lt;/LI-CODE&gt;&lt;P&gt;and in this case the speed was ~13Mbps.&lt;/P&gt;&lt;P&gt;I'm expecting the speed about 20 or 50Mbps for these clocks. If we look at the DTB:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;ecspi1: spi@30820000 {
	#address-cells = &amp;lt;1&amp;gt;;
	#size-cells = &amp;lt;0&amp;gt;;
	compatible = "fsl,imx8mp-ecspi", "fsl,imx6ul-ecspi";
	reg = &amp;lt;0x30820000 0x10000&amp;gt;;
	interrupts = &amp;lt;GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH&amp;gt;;
	clocks = &amp;lt;&amp;amp;clk IMX8MP_CLK_ECSPI1_ROOT&amp;gt;,
		 &amp;lt;&amp;amp;clk IMX8MP_CLK_ECSPI1_ROOT&amp;gt;;
	clock-names = "ipg", "per";
	assigned-clock-rates = &amp;lt;80000000&amp;gt;;
	assigned-clocks = &amp;lt;&amp;amp;clk IMX8MP_CLK_ECSPI1&amp;gt;;
	assigned-clock-parents = &amp;lt;&amp;amp;clk IMX8MP_SYS_PLL1_800M&amp;gt;;&lt;/LI-CODE&gt;&lt;P&gt;I don't see some kind of limitation because of clock. So what's the real bottleneck here? Is there some kind of ECSPI HW limitation, or?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;I would recommend to reach our pro support they would be able to help you on that&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Ok, good to know, that there is a way to get better support. Maybe I will use it in the future... .&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Andy&lt;/P&gt;</description>
      <pubDate>Mon, 13 Oct 2025 14:49:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX8MP-SPI-timing-issues/m-p/2184944#M241352</guid>
      <dc:creator>andrej_valek</dc:creator>
      <dc:date>2025-10-13T14:49:00Z</dc:date>
    </item>
  </channel>
</rss>

