<?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: SPI master and 3 DAC's</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/SPI-master-and-3-DAC-s/m-p/787435#M47916</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Lars,&lt;/P&gt;&lt;P&gt;Anyway, if you can change handle-&amp;gt;lastCommand or handle-&amp;gt;command which are copied to base-&amp;gt;PUSHR register when you transfer data, it is okay.&lt;/P&gt;&lt;P&gt;With the following lines, you can change the handle-&amp;gt;lastCommand or handle-&amp;gt;command.&lt;/P&gt;&lt;P&gt;/*Start master transfer*/&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; masterXfer.txData = masterTxData;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; masterXfer.rxData = masterRxData;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; masterXfer.dataSize = TRANSFER_SIZE;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; masterXfer.configFlags = kDSPI_MasterCtar0 | EXAMPLE_DSPI_MASTER_PCS_FOR_TRANSFER | kDSPI_MasterPcsContinuous;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DSPI_MasterTransferNonBlocking(EXAMPLE_DSPI_MASTER_BASEADDR, &amp;amp;g_m_handle, &amp;amp;masterXfer);&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Wait slave received all data. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (!isTransferCompleted)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;In other words, if you want to select one DAC, just change the line:&lt;/P&gt;&lt;P&gt;masterXfer.configFlags = kDSPI_MasterCtar0 |&lt;STRONG&gt; EXAMPLE_DSPI_MASTER_PCS_FOR_TRANSFER&lt;/STRONG&gt; | kDSPI_MasterPcsContinuous;&lt;/P&gt;&lt;P&gt;then call the DSPI_MasterTransferNonBlocking(EXAMPLE_DSPI_MASTER_BASEADDR, &amp;amp;g_m_handle, &amp;amp;masterXfer);&lt;/P&gt;&lt;P&gt;the SPI will communicate with the device you selected by the &lt;STRONG&gt;EXAMPLE_DSPI_MASTER_PCS_FOR_TRANSFER&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;kDSPI_MasterPcs0 = 0U &amp;lt;&amp;lt; DSPI_MASTER_PCS_SHIFT, /*!&amp;lt; DSPI master transfer use PCS0 signal. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; kDSPI_MasterPcs1 = 1U &amp;lt;&amp;lt; DSPI_MASTER_PCS_SHIFT, /*!&amp;lt; DSPI master transfer use PCS1 signal. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; kDSPI_MasterPcs2 = 2U &amp;lt;&amp;lt; DSPI_MASTER_PCS_SHIFT, /*!&amp;lt; DSPI master transfer use PCS2 signal.*/&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; kDSPI_MasterPcs3 = 3U &amp;lt;&amp;lt; DSPI_MASTER_PCS_SHIFT, /*!&amp;lt; DSPI master transfer use PCS3 signal. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; kDSPI_MasterPcs4 = 4U &amp;lt;&amp;lt; DSPI_MASTER_PCS_SHIFT, /*!&amp;lt; DSPI master transfer use PCS4 signal. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; kDSPI_MasterPcs5 = 5U &amp;lt;&amp;lt; DSPI_MASTER_PCS_SHIFT, /*!&amp;lt; DSPI master transfer use PCS5 signal. */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pls have a try.&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;xiangjun rong&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 30 Jul 2018 08:59:10 GMT</pubDate>
    <dc:creator>xiangjun_rong</dc:creator>
    <dc:date>2018-07-30T08:59:10Z</dc:date>
    <item>
      <title>SPI master and 3 DAC's</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/SPI-master-and-3-DAC-s/m-p/787432#M47913</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have to attach 3 very similar DAC's to the same SPI interface and not knowing too much about SPI or the Kinetis K platform I thought I only had to make one SPI configuration, and then set the relevant chip select signals to switch between which DAC I was talking to. But from the questions/comments on the community it seems like I have to make 3 almost identical "master_config" with only the "whichPcs" being apart, and then re-initialize the specific SPI interface from scratch each time I need to switch DAC, is that really the case?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would assume only one configuration was needed, and perhaps a specific function available to shift chip select.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I cannot find a good example for this to see how it's supposed to be done, can you perhaps point me to one?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the benefit of being able to use the newest MCUXpresso and SDK's available if needed. I am making code to be used on Kinetis K26_180, but I guess an example from any Kinetis board would help me, as I just need to understand how it's done. Perhaps even some documentation is available?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jul 2018 08:34:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/SPI-master-and-3-DAC-s/m-p/787432#M47913</guid>
      <dc:creator>lah1</dc:creator>
      <dc:date>2018-07-26T08:34:26Z</dc:date>
    </item>
    <item>
      <title>Re: SPI master and 3 DAC's</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/SPI-master-and-3-DAC-s/m-p/787433#M47914</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Lars,&lt;/P&gt;&lt;P&gt;i think one master_config is okay, when you want to transfer data to different slave spi modle, based on the driver example, you just use the following code.&lt;/P&gt;&lt;P&gt;You just change the EXAMPLE_DSPI_MASTER_PCS_FOR_TRANSFER, it is okay.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;/*Start master transfer*/&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; masterXfer.txData = masterTxData;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; masterXfer.rxData = masterRxData;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; masterXfer.dataSize = TRANSFER_SIZE;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; masterXfer.configFlags = kDSPI_MasterCtar0 | EXAMPLE_DSPI_MASTER_PCS_FOR_TRANSFER | kDSPI_MasterPcsContinuous;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DSPI_MasterTransferNonBlocking(EXAMPLE_DSPI_MASTER_BASEADDR, &amp;amp;g_m_handle, &amp;amp;masterXfer);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Wait slave received all data. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (!isTransferCompleted)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;Hope it can help you&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;xiangJun Rong&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jul 2018 07:24:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/SPI-master-and-3-DAC-s/m-p/787433#M47914</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2018-07-27T07:24:41Z</dc:date>
    </item>
    <item>
      <title>Re: SPI master and 3 DAC's</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/SPI-master-and-3-DAC-s/m-p/787434#M47915</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm sorry, but I don't think this answers my question: how do I do "Chip select" to select between my 3 SPI slaves?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does your answer imply that I should not use the "whichPcs" variable in the SPI master control structure and do chip select with independent pins, or how is this supposed to work?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Lars&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jul 2018 05:57:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/SPI-master-and-3-DAC-s/m-p/787434#M47915</guid>
      <dc:creator>lah1</dc:creator>
      <dc:date>2018-07-30T05:57:37Z</dc:date>
    </item>
    <item>
      <title>Re: SPI master and 3 DAC's</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/SPI-master-and-3-DAC-s/m-p/787435#M47916</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Lars,&lt;/P&gt;&lt;P&gt;Anyway, if you can change handle-&amp;gt;lastCommand or handle-&amp;gt;command which are copied to base-&amp;gt;PUSHR register when you transfer data, it is okay.&lt;/P&gt;&lt;P&gt;With the following lines, you can change the handle-&amp;gt;lastCommand or handle-&amp;gt;command.&lt;/P&gt;&lt;P&gt;/*Start master transfer*/&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; masterXfer.txData = masterTxData;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; masterXfer.rxData = masterRxData;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; masterXfer.dataSize = TRANSFER_SIZE;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; masterXfer.configFlags = kDSPI_MasterCtar0 | EXAMPLE_DSPI_MASTER_PCS_FOR_TRANSFER | kDSPI_MasterPcsContinuous;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DSPI_MasterTransferNonBlocking(EXAMPLE_DSPI_MASTER_BASEADDR, &amp;amp;g_m_handle, &amp;amp;masterXfer);&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Wait slave received all data. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (!isTransferCompleted)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;In other words, if you want to select one DAC, just change the line:&lt;/P&gt;&lt;P&gt;masterXfer.configFlags = kDSPI_MasterCtar0 |&lt;STRONG&gt; EXAMPLE_DSPI_MASTER_PCS_FOR_TRANSFER&lt;/STRONG&gt; | kDSPI_MasterPcsContinuous;&lt;/P&gt;&lt;P&gt;then call the DSPI_MasterTransferNonBlocking(EXAMPLE_DSPI_MASTER_BASEADDR, &amp;amp;g_m_handle, &amp;amp;masterXfer);&lt;/P&gt;&lt;P&gt;the SPI will communicate with the device you selected by the &lt;STRONG&gt;EXAMPLE_DSPI_MASTER_PCS_FOR_TRANSFER&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;kDSPI_MasterPcs0 = 0U &amp;lt;&amp;lt; DSPI_MASTER_PCS_SHIFT, /*!&amp;lt; DSPI master transfer use PCS0 signal. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; kDSPI_MasterPcs1 = 1U &amp;lt;&amp;lt; DSPI_MASTER_PCS_SHIFT, /*!&amp;lt; DSPI master transfer use PCS1 signal. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; kDSPI_MasterPcs2 = 2U &amp;lt;&amp;lt; DSPI_MASTER_PCS_SHIFT, /*!&amp;lt; DSPI master transfer use PCS2 signal.*/&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; kDSPI_MasterPcs3 = 3U &amp;lt;&amp;lt; DSPI_MASTER_PCS_SHIFT, /*!&amp;lt; DSPI master transfer use PCS3 signal. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; kDSPI_MasterPcs4 = 4U &amp;lt;&amp;lt; DSPI_MASTER_PCS_SHIFT, /*!&amp;lt; DSPI master transfer use PCS4 signal. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; kDSPI_MasterPcs5 = 5U &amp;lt;&amp;lt; DSPI_MASTER_PCS_SHIFT, /*!&amp;lt; DSPI master transfer use PCS5 signal. */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pls have a try.&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;xiangjun rong&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jul 2018 08:59:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/SPI-master-and-3-DAC-s/m-p/787435#M47916</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2018-07-30T08:59:10Z</dc:date>
    </item>
  </channel>
</rss>

