<?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>topic Re: Chip Select Toggling Between Bytes in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/Chip-Select-Toggling-Between-Bytes/m-p/1643297#M205153</link>
    <description>Better late than never, but converting to GPIO chip select did resolve this problem.</description>
    <pubDate>Tue, 02 May 2023 21:00:08 GMT</pubDate>
    <dc:creator>mwso_soe</dc:creator>
    <dc:date>2023-05-02T21:00:08Z</dc:date>
    <item>
      <title>Chip Select Toggling Between Bytes</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Chip-Select-Toggling-Between-Bytes/m-p/1579621#M199789</link>
      <description>&lt;P&gt;I am using an i.MX8Q with NOR flash connected to the lpspi3 interface.&lt;BR /&gt;&lt;BR /&gt;Here is the relevant portion of my devicetree&lt;/P&gt;&lt;LI-CODE lang="c"&gt;&amp;amp;lpspi3 {
    pinctrl-names = "default";
	pinctrl-0 = &amp;lt;&amp;amp;pinctrl_spi3&amp;gt;;
	#address-cells = &amp;lt;1&amp;gt;;
	#size-cells = &amp;lt;0&amp;gt;;
	status = "okay";
	
    // S25FL256LAGNFI010
    flash1: flash@0 {
        reg = &amp;lt;0&amp;gt;;
        #address-cells = &amp;lt;1&amp;gt;;
        #size-cells = &amp;lt;1&amp;gt;;
        compatible = "spansion,s25fl256l", "jedec,spi-nor";
        spi-max-frequency = &amp;lt;100000&amp;gt;;
        spi-tx-bus-width = &amp;lt;1&amp;gt;;
        spi-rx-bus-width = &amp;lt;1&amp;gt;;
        
        // Arbitrary demo partition 0
        partition@0 {
            label = "spi_flash_1_part0";
            reg = &amp;lt;0x0 0x100000&amp;gt;;
        };

        // Arbitrary demo partition 1
        parition@1 {
            label = "spi_flash_1_part1";
            reg = &amp;lt;0x100000 0x300000&amp;gt;;
        };
    };
};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;When the system boots and tries to discover the flash with JEDEC command 0x9F, the Chip Select is toggled between bytes causing the chip not to respond.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mwso_soe_0-1673314628906.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/206592i526382927D04C763/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mwso_soe_0-1673314628906.png" alt="mwso_soe_0-1673314628906.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I cannot find any configuration information that I may be missing to resolve this, nor have I found any threads on the forums that seem to cover similar issues.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 01:38:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Chip-Select-Toggling-Between-Bytes/m-p/1579621#M199789</guid>
      <dc:creator>mwso_soe</dc:creator>
      <dc:date>2023-01-10T01:38:02Z</dc:date>
    </item>
    <item>
      <title>Re: Chip Select Toggling Between Bytes</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Chip-Select-Toggling-Between-Bytes/m-p/1579670#M199795</link>
      <description>&lt;P&gt;You may try to config the iomux of the cs pin as gpio pin and then use "cs-gpios" to set it up in device tree file.&lt;/P&gt;
&lt;P&gt;For example:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://source.codeaurora.org/external/imx/linux-imx/tree/arch/arm64/boot/dts/freescale/imx8qm-lpddr4-val-lpspi.dts?h=imx_5.4.70_2.3.0" target="_blank"&gt;https://source.codeaurora.org/external/imx/linux-imx/tree/arch/arm64/boot/dts/freescale/imx8qm-lpddr4-val-lpspi.dts?h=imx_5.4.70_2.3.0&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 02:36:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Chip-Select-Toggling-Between-Bytes/m-p/1579670#M199795</guid>
      <dc:creator>jimmychan</dc:creator>
      <dc:date>2023-01-10T02:36:38Z</dc:date>
    </item>
    <item>
      <title>Re: Chip Select Toggling Between Bytes</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Chip-Select-Toggling-Between-Bytes/m-p/1580191#M199857</link>
      <description>&lt;P&gt;Thanks for the quick reply!&lt;BR /&gt;&lt;BR /&gt;I will try this and see if it works. One thing I am most concerned about is exactly why this is happening in the first place.&lt;BR /&gt;&lt;BR /&gt;I tried looking at the lpspi drive source code but don't see anything that suggests the chip select would be pulled high between bytes. &lt;A href="https://source.codeaurora.org/external/imx/linux-imx/tree/drivers/spi/spi-fsl-lpspi.c?h=imx_4.19.35_1.1.0" target="_blank" rel="noopener"&gt;https://source.codeaurora.org/external/imx/linux-imx/tree/drivers/spi/spi-fsl-lpspi.c?h=imx_4.19.35_1.1.0&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 15:52:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Chip-Select-Toggling-Between-Bytes/m-p/1580191#M199857</guid>
      <dc:creator>mwso_soe</dc:creator>
      <dc:date>2023-01-10T15:52:42Z</dc:date>
    </item>
    <item>
      <title>Re: Chip Select Toggling Between Bytes</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Chip-Select-Toggling-Between-Bytes/m-p/1580341#M199869</link>
      <description>&lt;P&gt;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/1422"&gt;@jimmychan&lt;/a&gt;I went ahead and implemented the GPIO chip select as described in the link you sent, and after doing so I still see the same behavior of the CS0 signal as I saw before.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 21:56:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Chip-Select-Toggling-Between-Bytes/m-p/1580341#M199869</guid>
      <dc:creator>mwso_soe</dc:creator>
      <dc:date>2023-01-10T21:56:36Z</dc:date>
    </item>
    <item>
      <title>Re: Chip Select Toggling Between Bytes</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Chip-Select-Toggling-Between-Bytes/m-p/1581670#M199997</link>
      <description>&lt;P&gt;FYI. &lt;A href="https://community.nxp.com/t5/i-MX-Processors/ECSPI-multibyte-transfer-without-CS-toggle/m-p/1029179" target="_blank"&gt;https://community.nxp.com/t5/i-MX-Processors/ECSPI-multibyte-transfer-without-CS-toggle/m-p/1029179&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could try the cs_change=0.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2023 10:31:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Chip-Select-Toggling-Between-Bytes/m-p/1581670#M199997</guid>
      <dc:creator>jimmychan</dc:creator>
      <dc:date>2023-01-12T10:31:17Z</dc:date>
    </item>
    <item>
      <title>Re: Chip Select Toggling Between Bytes</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Chip-Select-Toggling-Between-Bytes/m-p/1584754#M200349</link>
      <description>&lt;P&gt;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/1422"&gt;@jimmychan&lt;/a&gt;I attempted converting the first flash's chip select to a GPIO chip select with no luck, the signal was still toggling between bytes. I am also not sure I will be able to use GPIOs for all the chip selects, since the CS1 pin does not seem to have an alternate GPIO function.&lt;BR /&gt;&lt;BR /&gt;My SoM was damaged before I could take meaningful logic captures, but I will share more information once I restore my hardware to working order.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 16:02:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Chip-Select-Toggling-Between-Bytes/m-p/1584754#M200349</guid>
      <dc:creator>mwso_soe</dc:creator>
      <dc:date>2023-01-18T16:02:51Z</dc:date>
    </item>
    <item>
      <title>Re: Chip Select Toggling Between Bytes</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Chip-Select-Toggling-Between-Bytes/m-p/1643297#M205153</link>
      <description>Better late than never, but converting to GPIO chip select did resolve this problem.</description>
      <pubDate>Tue, 02 May 2023 21:00:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Chip-Select-Toggling-Between-Bytes/m-p/1643297#M205153</guid>
      <dc:creator>mwso_soe</dc:creator>
      <dc:date>2023-05-02T21:00:08Z</dc:date>
    </item>
    <item>
      <title>Re: Chip Select Toggling Between Bytes</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Chip-Select-Toggling-Between-Bytes/m-p/1942441#M227777</link>
      <description>&lt;P&gt;Which file is the one you change the "cs_change=0" line?&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2024 16:31:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Chip-Select-Toggling-Between-Bytes/m-p/1942441#M227777</guid>
      <dc:creator>dvega</dc:creator>
      <dc:date>2024-08-28T16:31:28Z</dc:date>
    </item>
    <item>
      <title>Re: Chip Select Toggling Between Bytes</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Chip-Select-Toggling-Between-Bytes/m-p/1942453#M227778</link>
      <description>&lt;P&gt;At least looking at the &lt;A href="https://github.com/nxp-imx/linux-imx/blob/imx_5.4.70_2.3.0/drivers/spi/spi-fsl-lpspi.c" target="_blank"&gt;spi-fsl-lpspi.c&lt;/A&gt; driver (I picked an arbitrary kernel version), there is no recognition of any `cs_change` parameter that I can see, so that portion of the accepted response was irrelevant to me.&lt;BR /&gt;&lt;BR /&gt;For context on my work around this issue, I ended up just not being able to use the hardware chip select signals necessitating a redesign of our board.&lt;BR /&gt;&lt;BR /&gt;I experimented with patching the driver to change the chip select behavior, but the lift was too large given the state of the project and we were fortunate enough that the device connected to the only pin that did not have a GPIO alternate function was not critical.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I believe was being alluded to by &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/1422"&gt;@jimmychan&lt;/a&gt; was to add that parameter to the device tree node using the lpspi interface. However, a quick search of the Linux kernel I do not see any evidence of `cs_change = 0` being used in any device tree .dts file, only some spi drivers using it as an internal data structure. So, I still don't think it is much of a solution here, since the chip select control issue is due to the lpspi hardware on the i.MX8, not the driver in Linux. Instead, one would need to figure out the correct register configurations (if any) for the lpspi driver to set in order to disable this behavior.&lt;BR /&gt;&lt;BR /&gt;Hopefully this is helpful for you &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/229533"&gt;@dvega&lt;/a&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2024 17:20:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Chip-Select-Toggling-Between-Bytes/m-p/1942453#M227778</guid>
      <dc:creator>mwso_soe</dc:creator>
      <dc:date>2024-08-28T17:20:23Z</dc:date>
    </item>
  </channel>
</rss>

