<?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 SPI Master always sends 16 bits words in non-continuous mode in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/SPI-Master-always-sends-16-bits-words-in-non-continuous-mode/m-p/372896#M19452</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone come across such a problem?&amp;nbsp; I am not using the KSDK libraries, but used them to model my own driver to trim down the code size.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;I set up SPI master mode on SPI1. The code below is to show the settings. I am interfacing to a SPANSION SPI memory device, really simple and basic SPI device.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;The problem comes in with the setting of the &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.5pt; font-family: 'Arial','sans-serif';"&gt;CONT_SCKE &lt;/SPAN&gt;&lt;SPAN style="color: #1f497d;"&gt;bit in MCR.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;If I clear this bit (not continuous mode) , the SPI master clocks out 16 bits for each transfer written to PUSHR, if I set it, it clocks out 8 bits?&amp;nbsp; That should not happen.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;All other settings are kept the same for this test, I change only this one bit and see this behaviour.&amp;nbsp; I use CTAR&amp;nbsp; 0 in all cases.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;Why does the SPI module clock out 8 or a6 bits when I change this one setting? Of course I dont want continuous mode.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;Device = MK24F25612&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;My SPi init:&amp;nbsp; Info: SPI1_CTAR_USR = 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI1-&amp;gt;MCR |= SPI_MCR_MSTR_MASK;&amp;nbsp; // Master Mode&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="color: red;"&gt;//SPI1-&amp;gt;MCR |= SPI_MCR_CONT_SCKE_MASK; // clock runs continuosly&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: red;"&gt; SPI1-&amp;gt;MCR &amp;amp;= ~SPI_MCR_CONT_SCKE_MASK; // clock doesnt run continuosly&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI1-&amp;gt;MCR |=&amp;nbsp; 1 &amp;lt;&amp;lt; SPI_MCR_PCSIS_SHIFT ; // Active low CS&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI1-&amp;gt;MCR &amp;amp;= ~SPI_MCR_DIS_RXF_MASK;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI1-&amp;gt;MCR &amp;amp;= ~SPI_MCR_DIS_TXF_MASK; // enable FIFOs&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; // CS pre-delay&amp;nbsp; ---- must be &amp;gt; 3 ns, SPANSION clock is 9ns min so do at least 1 clock delay is sufficient but Ill do 8 &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI1-&amp;gt;CTAR[SPI1_CTAR_USR] &amp;amp;= ~SPI_CTAR_PCSSCK_MASK; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI1-&amp;gt;CTAR[SPI1_CTAR_USR] |= SPI_CTAR_PCSSCK(1); &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI1-&amp;gt;CTAR[SPI1_CTAR_USR] &amp;amp;= ~SPI_CTAR_CSSCK_MASK; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI1-&amp;gt;CTAR[SPI1_CTAR_USR] |= SPI_CTAR_CSSCK(8);&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; // min CS high time&amp;nbsp; 50ns for SPANSION so at 9ns clock we need @ least 6 clocks, choose 16&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI1-&amp;gt;CTAR[SPI1_CTAR_USR] &amp;amp;= ~SPI_CTAR_PASC_MASK; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI1-&amp;gt;CTAR[SPI1_CTAR_USR] |= SPI_CTAR_PASC(1);&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI1-&amp;gt;CTAR[SPI1_CTAR_USR] &amp;amp;= ~SPI_CTAR_ASC_MASK; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI1-&amp;gt;CTAR[SPI1_CTAR_USR] |= SPI_CTAR_ASC(16); &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; //baud rate SCK baud rate = (fP/PBR) x [(1+DBR)/BR]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; retBaudrate = CalcSPIBaudRate( port,&amp;nbsp; baudrate, clock);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI1-&amp;gt;CTAR[SPI1_CTAR_USR] &amp;amp;= ~SPI_CTAR_FMSZ_MASK; // bits per frame = bits-1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI1-&amp;gt;CTAR[SPI1_CTAR_USR] |= SPI_CTAR_FMSZ(7); // &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI1-&amp;gt;CTAR[SPI1_CTAR_USR] &amp;amp;= ~SPI_CTAR_CPOL_MASK; // Using Mode 0 - CLK inactive state is low CPOL = 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;&amp;nbsp; SPI1-&amp;gt;CTAR[SPI1_CTAR_USR] &amp;amp;= ~SPI_CTAR_CPHA_MASK; // Using Mode 0 - CData is captured on the leading edge of SCK and changed on the following edge CPHA = 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; // SPI1-&amp;gt;CTAR[SPI1_CTAR_USR] &amp;amp;= ~SPI_CTAR_CPOL_MASK; // Using Mode 0 - CLK inactive state is low CPOL = 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; //SPI1-&amp;gt;CTAR[SPI1_CTAR_USR] |= SPI_CTAR_CPHA_MASK; // Using Mode 0 - CData is captured on the leading edge of SCK and changed on the following edge CPHA = 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI1-&amp;gt;CTAR[SPI1_CTAR_USR] &amp;amp;= ~SPI_CTAR_LSBFE_MASK; // bit direction -SPANSION neebs msb first&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; NVIC_EnableIRQ(SPI1_IRQn);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; // Last thing - start it up&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI1-&amp;gt;MCR &amp;amp;= ~SPI_MCR_MDIS_MASK;&amp;nbsp; // Zero enables SPI&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;How I loaf the TX fifo:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;void fs_SPI_WriteDataMastermode(SPI_Type * port,&amp;nbsp; dspi_command_config_t * command,&amp;nbsp;&amp;nbsp; uint16_t data) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint32_t temp = 0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* First, build up the 32-bit word then write it to the PUSHR */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; if(command-&amp;gt;isChipSelectContinuous) temp |= SPI_PUSHR_CONT_MASK;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; temp |= SPI_PUSHR_CTAS(command-&amp;gt;whichCtar);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; temp |= SPI_PUSHR_PCS(command-&amp;gt;whichPcs);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; if (command-&amp;gt;isEndOfQueue) temp |=&amp;nbsp; SPI_PUSHR_EOQ_MASK;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; if (command-&amp;gt;clearTransferCount) temp&amp;nbsp; |= SPI_PUSHR_CTCNT_MASK;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; temp |= SPI_PUSHR_TXDATA(data);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI_PUSHR_REG(port) = temp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 02 Apr 2015 08:50:47 GMT</pubDate>
    <dc:creator>trevorhey</dc:creator>
    <dc:date>2015-04-02T08:50:47Z</dc:date>
    <item>
      <title>SPI Master always sends 16 bits words in non-continuous mode</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/SPI-Master-always-sends-16-bits-words-in-non-continuous-mode/m-p/372896#M19452</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone come across such a problem?&amp;nbsp; I am not using the KSDK libraries, but used them to model my own driver to trim down the code size.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;I set up SPI master mode on SPI1. The code below is to show the settings. I am interfacing to a SPANSION SPI memory device, really simple and basic SPI device.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;The problem comes in with the setting of the &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.5pt; font-family: 'Arial','sans-serif';"&gt;CONT_SCKE &lt;/SPAN&gt;&lt;SPAN style="color: #1f497d;"&gt;bit in MCR.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;If I clear this bit (not continuous mode) , the SPI master clocks out 16 bits for each transfer written to PUSHR, if I set it, it clocks out 8 bits?&amp;nbsp; That should not happen.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;All other settings are kept the same for this test, I change only this one bit and see this behaviour.&amp;nbsp; I use CTAR&amp;nbsp; 0 in all cases.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;Why does the SPI module clock out 8 or a6 bits when I change this one setting? Of course I dont want continuous mode.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;Device = MK24F25612&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;My SPi init:&amp;nbsp; Info: SPI1_CTAR_USR = 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI1-&amp;gt;MCR |= SPI_MCR_MSTR_MASK;&amp;nbsp; // Master Mode&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="color: red;"&gt;//SPI1-&amp;gt;MCR |= SPI_MCR_CONT_SCKE_MASK; // clock runs continuosly&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: red;"&gt; SPI1-&amp;gt;MCR &amp;amp;= ~SPI_MCR_CONT_SCKE_MASK; // clock doesnt run continuosly&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI1-&amp;gt;MCR |=&amp;nbsp; 1 &amp;lt;&amp;lt; SPI_MCR_PCSIS_SHIFT ; // Active low CS&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI1-&amp;gt;MCR &amp;amp;= ~SPI_MCR_DIS_RXF_MASK;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI1-&amp;gt;MCR &amp;amp;= ~SPI_MCR_DIS_TXF_MASK; // enable FIFOs&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; // CS pre-delay&amp;nbsp; ---- must be &amp;gt; 3 ns, SPANSION clock is 9ns min so do at least 1 clock delay is sufficient but Ill do 8 &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI1-&amp;gt;CTAR[SPI1_CTAR_USR] &amp;amp;= ~SPI_CTAR_PCSSCK_MASK; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI1-&amp;gt;CTAR[SPI1_CTAR_USR] |= SPI_CTAR_PCSSCK(1); &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI1-&amp;gt;CTAR[SPI1_CTAR_USR] &amp;amp;= ~SPI_CTAR_CSSCK_MASK; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI1-&amp;gt;CTAR[SPI1_CTAR_USR] |= SPI_CTAR_CSSCK(8);&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; // min CS high time&amp;nbsp; 50ns for SPANSION so at 9ns clock we need @ least 6 clocks, choose 16&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI1-&amp;gt;CTAR[SPI1_CTAR_USR] &amp;amp;= ~SPI_CTAR_PASC_MASK; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI1-&amp;gt;CTAR[SPI1_CTAR_USR] |= SPI_CTAR_PASC(1);&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI1-&amp;gt;CTAR[SPI1_CTAR_USR] &amp;amp;= ~SPI_CTAR_ASC_MASK; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI1-&amp;gt;CTAR[SPI1_CTAR_USR] |= SPI_CTAR_ASC(16); &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; //baud rate SCK baud rate = (fP/PBR) x [(1+DBR)/BR]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; retBaudrate = CalcSPIBaudRate( port,&amp;nbsp; baudrate, clock);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI1-&amp;gt;CTAR[SPI1_CTAR_USR] &amp;amp;= ~SPI_CTAR_FMSZ_MASK; // bits per frame = bits-1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI1-&amp;gt;CTAR[SPI1_CTAR_USR] |= SPI_CTAR_FMSZ(7); // &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI1-&amp;gt;CTAR[SPI1_CTAR_USR] &amp;amp;= ~SPI_CTAR_CPOL_MASK; // Using Mode 0 - CLK inactive state is low CPOL = 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;&amp;nbsp; SPI1-&amp;gt;CTAR[SPI1_CTAR_USR] &amp;amp;= ~SPI_CTAR_CPHA_MASK; // Using Mode 0 - CData is captured on the leading edge of SCK and changed on the following edge CPHA = 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; // SPI1-&amp;gt;CTAR[SPI1_CTAR_USR] &amp;amp;= ~SPI_CTAR_CPOL_MASK; // Using Mode 0 - CLK inactive state is low CPOL = 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; //SPI1-&amp;gt;CTAR[SPI1_CTAR_USR] |= SPI_CTAR_CPHA_MASK; // Using Mode 0 - CData is captured on the leading edge of SCK and changed on the following edge CPHA = 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI1-&amp;gt;CTAR[SPI1_CTAR_USR] &amp;amp;= ~SPI_CTAR_LSBFE_MASK; // bit direction -SPANSION neebs msb first&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; NVIC_EnableIRQ(SPI1_IRQn);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; // Last thing - start it up&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI1-&amp;gt;MCR &amp;amp;= ~SPI_MCR_MDIS_MASK;&amp;nbsp; // Zero enables SPI&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;How I loaf the TX fifo:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;void fs_SPI_WriteDataMastermode(SPI_Type * port,&amp;nbsp; dspi_command_config_t * command,&amp;nbsp;&amp;nbsp; uint16_t data) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint32_t temp = 0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* First, build up the 32-bit word then write it to the PUSHR */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; if(command-&amp;gt;isChipSelectContinuous) temp |= SPI_PUSHR_CONT_MASK;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; temp |= SPI_PUSHR_CTAS(command-&amp;gt;whichCtar);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; temp |= SPI_PUSHR_PCS(command-&amp;gt;whichPcs);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; if (command-&amp;gt;isEndOfQueue) temp |=&amp;nbsp; SPI_PUSHR_EOQ_MASK;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; if (command-&amp;gt;clearTransferCount) temp&amp;nbsp; |= SPI_PUSHR_CTCNT_MASK;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; temp |= SPI_PUSHR_TXDATA(data);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; SPI_PUSHR_REG(port) = temp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Apr 2015 08:50:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/SPI-Master-always-sends-16-bits-words-in-non-continuous-mode/m-p/372896#M19452</guid>
      <dc:creator>trevorhey</dc:creator>
      <dc:date>2015-04-02T08:50:47Z</dc:date>
    </item>
    <item>
      <title>Re: SPI Master always sends 16 bits words in non-continuous mode</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/SPI-Master-always-sends-16-bits-words-in-non-continuous-mode/m-p/372897#M19453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You left out a couple important details:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the final baud-rate control contents?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is a 'representative' content of the 'command' structure in the write-functoin call?&amp;nbsp; Can we assume you NEVER set '&lt;SPAN style="color: #1f497d;"&gt;isChipSelectContinuous' in the continuous-clock mode?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Apr 2015 14:48:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/SPI-Master-always-sends-16-bits-words-in-non-continuous-mode/m-p/372897#M19453</guid>
      <dc:creator>egoodii</dc:creator>
      <dc:date>2015-04-02T14:48:02Z</dc:date>
    </item>
    <item>
      <title>Re: SPI Master always sends 16 bits words in non-continuous mode</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/SPI-Master-always-sends-16-bits-words-in-non-continuous-mode/m-p/372898#M19454</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Trevor Hey,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Thank you for you interest in kinetis product.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Please read the K22 reference manual chapter 49.4.4.3 Continuous Selection Format carefully.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; I see your code, when you work in continuous mode:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; &lt;SPAN style="color: #1f497d;"&gt;if(command-&amp;gt;isChipSelectContinuous) temp |= SPI_PUSHR_CONT_MASK;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; You set CONT bit,&amp;nbsp; in the datasheet :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; When the CONT bit = 1, the PCS signal remains asserted for the duration of the two transfers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If you send 2 8bit byte, then it will seem that you are send 16 bits, because it isn't insert the tDT in PCSx.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; About details, please read our reference manual carefully.&lt;/P&gt;&lt;P&gt;Wish it helps you!&lt;/P&gt;&lt;P&gt;If you still have question, please contact me!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Jingjing&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Apr 2015 09:18:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/SPI-Master-always-sends-16-bits-words-in-non-continuous-mode/m-p/372898#M19454</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2015-04-03T09:18:21Z</dc:date>
    </item>
  </channel>
</rss>

