<?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: How to dynamically configure SPI baudrate？ in S32K</title>
    <link>https://community.nxp.com/t5/S32K/How-to-dynamically-configure-SPI-baudrate/m-p/2259354#M55283</link>
    <description>&lt;P&gt;Could you specify used RTD and example code?&lt;/P&gt;</description>
    <pubDate>Wed, 10 Dec 2025 16:05:20 GMT</pubDate>
    <dc:creator>davidtosenovjan</dc:creator>
    <dc:date>2025-12-10T16:05:20Z</dc:date>
    <item>
      <title>How to dynamically configure SPI baudrate？</title>
      <link>https://community.nxp.com/t5/S32K/How-to-dynamically-configure-SPI-baudrate/m-p/2259213#M55277</link>
      <description>&lt;P&gt;Hi Team:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;I'm using S32K144 and&amp;nbsp;configure the baudrate of spi2 to 100K through PE tools（refer to the attached image）,&amp;nbsp;&amp;nbsp;I want to dynamically configure the speed of spi2 to 50K/20K/10K/5K during the device running.&lt;/P&gt;&lt;P&gt;The following is the test code:&lt;/P&gt;&lt;P&gt;//***********************************************&lt;/P&gt;&lt;P&gt;uint32_t baud2;&lt;BR /&gt;status_t ret_sts;&lt;/P&gt;&lt;P&gt;lpspi_master_config_t spiConfig1;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;spiConfig1.bitsPerSec = 10000; //10Kbps baudrate&lt;BR /&gt;spiConfig1.whichPcs = LPSPI_PCS2;&lt;BR /&gt;spiConfig1.pcsPolarity = LPSPI_ACTIVE_LOW;&lt;BR /&gt;spiConfig1.isPcsContinuous = false;&lt;BR /&gt;&lt;STRONG&gt;spiConfig1.bitcount = 16;&lt;/STRONG&gt;&lt;BR /&gt;spiConfig1.clkPhase = LPSPI_CLOCK_PHASE_1ST_EDGE;&lt;BR /&gt;spiConfig1.clkPolarity = LPSPI_SCK_ACTIVE_HIGH;&lt;BR /&gt;spiConfig1.lsbFirst= false;&lt;BR /&gt;spiConfig1.transferType = LPSPI_USING_INTERRUPTS;&lt;/P&gt;&lt;P&gt;ret_sts = LPSPI_DRV_MasterConfigureBus(LPSPICOM2, (lpspi_master_config_t *)&amp;amp;spiConfig1, &amp;amp;baud2);&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;printf("ret_sts = %d,baud2=%d\r\n",ret_sts,baud2);&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;//****************************************************&lt;/P&gt;&lt;P&gt;After running, printf output:&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;ret_sts = 1,baud2=0&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;so LPSPI_DRV_MasterConfigureBus() return&amp;nbsp;&lt;STRONG&gt;STATUS_ERROR&lt;/STRONG&gt;,&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;trace into it and find the&amp;nbsp;STATUS_ERROR&amp;nbsp;is caused by the following code:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;//****************************************************&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if ((spiConfig-&amp;gt;bitcount &amp;lt; 8U) || (spiConfig-&amp;gt;bitcount &amp;gt; 4096U))&lt;BR /&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;EM&gt;&lt;STRONG&gt;printf("spi bitcount=%d\r\n",spiConfig-&amp;gt;bitcount);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; return STATUS_ERROR;&lt;BR /&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;//****************************************************&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Then output&amp;nbsp; &amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;spi bitcount=0&amp;nbsp;&amp;nbsp;&lt;/EM&gt;&lt;/STRONG&gt;,&amp;nbsp;&amp;nbsp;but the actual value of bitcount should be equal to &lt;EM&gt;&lt;STRONG&gt;16&lt;/STRONG&gt;&lt;/EM&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;May I ask where my method went wrong?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;How to achieve dynamic configuration of SPI baudrate?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you for your suggestion.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Fed&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Dec 2025 12:05:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/How-to-dynamically-configure-SPI-baudrate/m-p/2259213#M55277</guid>
      <dc:creator>fedora</dc:creator>
      <dc:date>2025-12-10T12:05:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to dynamically configure SPI baudrate？</title>
      <link>https://community.nxp.com/t5/S32K/How-to-dynamically-configure-SPI-baudrate/m-p/2259354#M55283</link>
      <description>&lt;P&gt;Could you specify used RTD and example code?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Dec 2025 16:05:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/How-to-dynamically-configure-SPI-baudrate/m-p/2259354#M55283</guid>
      <dc:creator>davidtosenovjan</dc:creator>
      <dc:date>2025-12-10T16:05:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to dynamically configure SPI baudrate？</title>
      <link>https://community.nxp.com/t5/S32K/How-to-dynamically-configure-SPI-baudrate/m-p/2259379#M55284</link>
      <description>&lt;P&gt;Thanks !&lt;/P&gt;&lt;P&gt;I don't know what's the RTD.&lt;/P&gt;&lt;P&gt;The requirement is that when the device is activated, the speed of SPI can be 100k, but when the device is in sleep mode, the speed of SPI can only be 10k or even lower. Therefore, it is necessary to dynamically change the SPI speed.&lt;/P&gt;&lt;P&gt;Thanks and regards,&lt;/P&gt;&lt;P&gt;Fed&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Dec 2025 16:54:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/How-to-dynamically-configure-SPI-baudrate/m-p/2259379#M55284</guid>
      <dc:creator>fedora</dc:creator>
      <dc:date>2025-12-10T16:54:01Z</dc:date>
    </item>
  </channel>
</rss>

