<?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>Kinetis Microcontrollers中的主题 Re: KW38's CS cannot be controlled through gpio.</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KW38-s-CS-cannot-be-controlled-through-gpio/m-p/1762480#M65736</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/200888"&gt;@EduardoZamora&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;&lt;P&gt;Ted Wu&lt;/P&gt;</description>
    <pubDate>Thu, 23 Nov 2023 08:10:50 GMT</pubDate>
    <dc:creator>tedwu1</dc:creator>
    <dc:date>2023-11-23T08:10:50Z</dc:date>
    <item>
      <title>KW38's CS cannot be controlled through gpio.</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KW38-s-CS-cannot-be-controlled-through-gpio/m-p/1760653#M65719</link>
      <description>&lt;P&gt;Hello friend,&lt;/P&gt;&lt;P&gt;I want to use gpio as CS because I have 3 SPI devices. I use frdmkw38_dspi_polling_b2b_transfer_master project. But the CS (PTA19) pin always high. I cannot control it to low. I modified some code as follows. Can anyone guide me? Thank you in advance.&lt;/P&gt;&lt;P&gt;Best wishes&lt;/P&gt;&lt;P&gt;Ted Wu&lt;/P&gt;&lt;P&gt;pin_mux.c&lt;BR /&gt;void BOARD_InitPins(void)&lt;BR /&gt;{&lt;BR /&gt;...&lt;BR /&gt;/* PORTA16 (pin 4) is configured as SPI1_SOUT */&lt;BR /&gt;PORT_SetPinMux(PORTA, 16U, kPORT_MuxAlt2);&lt;/P&gt;&lt;P&gt;/* PORTA17 (pin 5) is configured as SPI1_SIN */&lt;BR /&gt;PORT_SetPinMux(PORTA, 17U, kPORT_MuxAlt2);&lt;/P&gt;&lt;P&gt;/* PORTA18 (pin 6) is configured as SPI1_SCK */&lt;BR /&gt;PORT_SetPinMux(PORTA, 18U, kPORT_MuxAlt2);&lt;/P&gt;&lt;P&gt;/* PORTA19 (pin 7) is configured as SPI1_PCS0 */&lt;BR /&gt;PORT_SetPinMux(PORTA, 19U, kPORT_MuxAsGpio);&lt;/P&gt;&lt;P&gt;PORTA-&amp;gt;PCR[19] = ((PORTA-&amp;gt;PCR[19] &amp;amp;&lt;BR /&gt;/* Mask bits to zero which are setting */&lt;BR /&gt;(~(PORT_PCR_SRE_MASK | PORT_PCR_ISF_MASK)))&lt;/P&gt;&lt;P&gt;/* Slew Rate Enable: Fast slew rate is configured on the corresponding pin, if the pin is&lt;BR /&gt;* configured as a digital output. */&lt;BR /&gt;| PORT_PCR_SRE(kPORT_FastSlewRate));&lt;BR /&gt;....&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;dspi_polling_b2b_transfer_master.c&lt;BR /&gt;int main(void)&lt;BR /&gt;{&lt;BR /&gt;BOARD_InitPins();&lt;BR /&gt;BOARD_BootClockRUN();&lt;BR /&gt;BOARD_InitDebugConsole();&lt;/P&gt;&lt;P&gt;/* Define the init structure for the output pin */&lt;BR /&gt;gpio_pin_config_t gpio_1_config = {&lt;BR /&gt;kGPIO_DigitalOutput,&lt;BR /&gt;1,&lt;BR /&gt;};&lt;BR /&gt;...&lt;BR /&gt;srcClock_Hz = DSPI_MASTER_CLK_FREQ;&lt;BR /&gt;DSPI_MasterInit(EXAMPLE_DSPI_MASTER_BASEADDR, &amp;amp;masterConfig, srcClock_Hz);&lt;/P&gt;&lt;P&gt;/* Init output CS GPIO. */&lt;BR /&gt;GPIO_PinInit(GPIOA, 19U, &amp;amp;gpio_1_config);&lt;/P&gt;&lt;P&gt;while (1)&lt;BR /&gt;{&lt;BR /&gt;...&lt;BR /&gt;/* Start master transfer, send data to slave */&lt;BR /&gt;masterXfer.txData = masterTxData;&lt;BR /&gt;masterXfer.rxData = NULL;&lt;BR /&gt;masterXfer.dataSize = TRANSFER_SIZE;&lt;BR /&gt;masterXfer.configFlags = kDSPI_MasterCtar0;&lt;BR /&gt;GPIO_PinWrite(GPIOA, 1U &amp;lt;&amp;lt; 19, 0);&lt;BR /&gt;DSPI_MasterTransferBlocking(EXAMPLE_DSPI_MASTER_BASEADDR, &amp;amp;masterXfer);&lt;BR /&gt;GPIO_PinWrite(GPIOA, 1U &amp;lt;&amp;lt; 19, 1);&lt;BR /&gt;...&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2023 10:19:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KW38-s-CS-cannot-be-controlled-through-gpio/m-p/1760653#M65719</guid>
      <dc:creator>tedwu1</dc:creator>
      <dc:date>2023-11-21T10:19:44Z</dc:date>
    </item>
    <item>
      <title>Re: KW38's CS cannot be controlled through gpio.</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KW38-s-CS-cannot-be-controlled-through-gpio/m-p/1761357#M65722</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/167590"&gt;@tedwu1&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Hope you are doing well.&lt;/P&gt;
&lt;P&gt;According to the FRDM-KW38 schematics (which can be downloaded from the &lt;A href="https://www.nxp.com/design/designs/freedom-development-kit-for-kw39-38-37-mcus:FRDM-KW38" target="_blank"&gt;FRDM-KW38&lt;/A&gt; webpage, Design Files section), PTA19 should be connected to FXOS8700CQ Combo Sensor Pin 11 (INT1). Please, consider using another pin as GPIO for your application.&lt;/P&gt;
&lt;P&gt;Regards,&lt;BR /&gt;Eduardo.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2023 00:45:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KW38-s-CS-cannot-be-controlled-through-gpio/m-p/1761357#M65722</guid>
      <dc:creator>EduardoZamora</dc:creator>
      <dc:date>2023-11-22T00:45:59Z</dc:date>
    </item>
    <item>
      <title>Re: KW38's CS cannot be controlled through gpio.</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KW38-s-CS-cannot-be-controlled-through-gpio/m-p/1761581#M65724</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/200888"&gt;@EduardoZamora&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I use a single SPI, I can control the PTA19 (CS) potential level through the SPI program. But I have 3 SPI devices. I want to use gpio as CS (chip select) to distinguish which SPI is used at a time. So I want to use gpio as CS. But if I use gpio as CS I can't control it.&lt;/P&gt;&lt;P&gt;Best wishes&lt;/P&gt;&lt;P&gt;Ted Wu&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2023 05:26:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KW38-s-CS-cannot-be-controlled-through-gpio/m-p/1761581#M65724</guid>
      <dc:creator>tedwu1</dc:creator>
      <dc:date>2023-11-22T05:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: KW38's CS cannot be controlled through gpio.</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KW38-s-CS-cannot-be-controlled-through-gpio/m-p/1762208#M65730</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Just as a quick test you can try the following:&lt;/P&gt;
&lt;P&gt;In pin_mux.c &amp;gt; &lt;SPAN&gt;BOARD_InitPins&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;, add&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV style="background-color: #ffffff; padding: 0px 0px 0px 2px;"&gt;
&lt;DIV style="color: #000000; background-color: #ffffff; font-family: 'Consolas'; font-size: 10pt; white-space: nowrap;"&gt;
&lt;PRE&gt;&lt;SPAN&gt;PORT_SetPinMux(PORTC, 3U, &lt;/SPAN&gt;&lt;SPAN&gt;kPORT_MuxAsGpio&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&lt;SPAN&gt;In dspi_transfer_master.c, add the following after pins and clock initialization:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;gpio_pin_config_t gpio_as_cs = {&lt;BR /&gt;    kGPIO_DigitalOutput,&lt;BR /&gt;    1,&lt;BR /&gt;};&lt;BR /&gt;&lt;BR /&gt;GPIO_PinInit(GPIOC, 3U, &amp;amp;gpio_as_cs);&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;After that, try writing the GPIO output:&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV style="background-color: #ffffff; padding: 0px 0px 0px 2px;"&gt;
&lt;DIV style="color: #000000; background-color: #ffffff; font-family: 'Consolas'; font-size: 10pt; white-space: nowrap;"&gt;
&lt;PRE&gt;&lt;SPAN&gt;GPIO_PinWrite(GPIOC, 3U, 0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;/* Delay */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for&lt;/SPAN&gt;&lt;SPAN&gt; (i = 0U; i &amp;lt; EXAMPLE_DSPI_DEALY_COUNT; i++)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; __NOP();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; GPIO_PinWrite(GPIOC, 3U, 1);&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;You should see that the GPIO output level changes. However, please consider taking a look at the FRDM-KW38 schematics file to confirm that the pin you are trying to configure is not being used or connected to another module.&lt;/P&gt;
&lt;P&gt;Please, let me know your findings.&lt;/P&gt;
&lt;P&gt;Regards,&lt;BR /&gt;Eduardo.&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 22 Nov 2023 22:13:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KW38-s-CS-cannot-be-controlled-through-gpio/m-p/1762208#M65730</guid>
      <dc:creator>EduardoZamora</dc:creator>
      <dc:date>2023-11-22T22:13:28Z</dc:date>
    </item>
    <item>
      <title>Re: KW38's CS cannot be controlled through gpio.</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KW38-s-CS-cannot-be-controlled-through-gpio/m-p/1762480#M65736</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/200888"&gt;@EduardoZamora&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;&lt;P&gt;Ted Wu&lt;/P&gt;</description>
      <pubDate>Thu, 23 Nov 2023 08:10:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KW38-s-CS-cannot-be-controlled-through-gpio/m-p/1762480#M65736</guid>
      <dc:creator>tedwu1</dc:creator>
      <dc:date>2023-11-23T08:10:50Z</dc:date>
    </item>
  </channel>
</rss>

