<?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: 9S12X SPI handling SPIE, SPTIE in S12 / MagniV Microcontrollers</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/9S12X-SPI-handling-SPIE-SPTIE/m-p/201111#M8129</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;&lt;BLOCKQUOTE&gt;&lt;DIV&gt;&lt;HR /&gt;&lt;/DIV&gt;&lt;DIV&gt;Heppell wrote:&lt;BR /&gt;In my current design, I am sending data accross MOSI and then Enabling SPTIE, once the interupt fires I assume data has been sent and Disable SPTIE. I do this for every Transmit.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;No. In master mode SPTIE interrupt fires when SPTEF is set. And SPTEF flag gets&amp;nbsp;set not when transfer is complete, but when transmit buffer is ampty. SPTEF just tells you&amp;nbsp;that you can buffer another byte to send. And SPIF is set when transfer is complete.&lt;/DIV&gt;&lt;BLOCKQUOTE&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;When I want to receive information I need to "clock" it, so I send dummy 8 bytes, and wait for received information which seems to set the SPIF flag and clear it before I read SPISR, or fire the interupt.&lt;BR /&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;Hm. In master mode I&amp;nbsp;always for transfer complete. And then, after transfer is complete (all 8 bits clocked), I expect new received data available in SPIDR.&lt;/DIV&gt;&lt;DIV&gt;You say you clear it (SPIF?) before you read SPISR. To clear SPIF you have to read SPISR, then read SPIDR.&lt;/DIV&gt;&lt;BLOCKQUOTE&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;Example:&lt;BR /&gt;EEPROM Read Operation:&lt;BR /&gt;1) Send Read Instruction, Enable SPTIE. (Interupt occurs after TX, disables SPTIE, goes to next operation)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;No, in your case interrupt occurs during "TX", not after. You should enable not SPTIE, but SPIE. When SPIE interrupt fires you can go to 2).&lt;/DIV&gt;&lt;BLOCKQUOTE&gt;&lt;DIV&gt;&lt;BR /&gt;2) Send Address, Enable SPTIE. (Interupt occurs after TX, disables SPTIE, goes to next operation)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;SPIE.&lt;/DIV&gt;&lt;BLOCKQUOTE&gt;&amp;nbsp;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 11 Nov 2008 13:03:44 GMT</pubDate>
    <dc:creator>kef</dc:creator>
    <dc:date>2008-11-11T13:03:44Z</dc:date>
    <item>
      <title>9S12X SPI handling SPIE, SPTIE</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/9S12X-SPI-handling-SPIE-SPTIE/m-p/201110#M8128</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a question on the proper usage of the SPI Interupts and the SPISR register flags. (SPIF, SPTEF, MODF)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In my current design, I am sending data accross MOSI and then Enabling SPTIE, once the interupt fires I assume data has been sent and Disable SPTIE. I do this for every Transmit. When I want to receive information I need to "clock" it, so I send dummy 8 bytes, and wait for received information which seems to set the SPIF flag and clear it before I read SPISR, or fire the interupt.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;EEPROM Read Operation:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Send Read Instruction, Enable SPTIE. (Interupt occurs after TX, disables SPTIE, goes to next operation)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2) Send Address, Enable SPTIE. (Interupt occurs after TX, disables SPTIE, goes to next operation)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3) Send 0x00 to Clock in 8 Bytes of data on Receive (MISO) line.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;-&amp;gt; Wait on SPIE interrupt for received data. (Not functioning properly)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;*Note CS is active low for the entire operation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a better way than Disabling/Enabling the interupt, and how can I track the incomming data?&lt;/SPAN&gt;&lt;BR /&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Nov 2008 04:12:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/9S12X-SPI-handling-SPIE-SPTIE/m-p/201110#M8128</guid>
      <dc:creator>Heppell</dc:creator>
      <dc:date>2008-11-11T04:12:12Z</dc:date>
    </item>
    <item>
      <title>Re: 9S12X SPI handling SPIE, SPTIE</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/9S12X-SPI-handling-SPIE-SPTIE/m-p/201111#M8129</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;&lt;BLOCKQUOTE&gt;&lt;DIV&gt;&lt;HR /&gt;&lt;/DIV&gt;&lt;DIV&gt;Heppell wrote:&lt;BR /&gt;In my current design, I am sending data accross MOSI and then Enabling SPTIE, once the interupt fires I assume data has been sent and Disable SPTIE. I do this for every Transmit.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;No. In master mode SPTIE interrupt fires when SPTEF is set. And SPTEF flag gets&amp;nbsp;set not when transfer is complete, but when transmit buffer is ampty. SPTEF just tells you&amp;nbsp;that you can buffer another byte to send. And SPIF is set when transfer is complete.&lt;/DIV&gt;&lt;BLOCKQUOTE&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;When I want to receive information I need to "clock" it, so I send dummy 8 bytes, and wait for received information which seems to set the SPIF flag and clear it before I read SPISR, or fire the interupt.&lt;BR /&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;Hm. In master mode I&amp;nbsp;always for transfer complete. And then, after transfer is complete (all 8 bits clocked), I expect new received data available in SPIDR.&lt;/DIV&gt;&lt;DIV&gt;You say you clear it (SPIF?) before you read SPISR. To clear SPIF you have to read SPISR, then read SPIDR.&lt;/DIV&gt;&lt;BLOCKQUOTE&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;Example:&lt;BR /&gt;EEPROM Read Operation:&lt;BR /&gt;1) Send Read Instruction, Enable SPTIE. (Interupt occurs after TX, disables SPTIE, goes to next operation)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;No, in your case interrupt occurs during "TX", not after. You should enable not SPTIE, but SPIE. When SPIE interrupt fires you can go to 2).&lt;/DIV&gt;&lt;BLOCKQUOTE&gt;&lt;DIV&gt;&lt;BR /&gt;2) Send Address, Enable SPTIE. (Interupt occurs after TX, disables SPTIE, goes to next operation)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;SPIE.&lt;/DIV&gt;&lt;BLOCKQUOTE&gt;&amp;nbsp;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Nov 2008 13:03:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/9S12X-SPI-handling-SPIE-SPTIE/m-p/201111#M8129</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2008-11-11T13:03:44Z</dc:date>
    </item>
  </channel>
</rss>

