<?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: FRDM-K20D50M SPI Driver (non-PE) in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-K20D50M-SPI-Driver-non-PE/m-p/224657#M4292</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; &lt;SPAN style="color: #1f497d;"&gt;I found the problem!!!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;On the FRDM-K20D50M board there is a jumper J17.&amp;nbsp; When the pins are shunted it enables the accelerometer on the board (an makes the SPI MOSI signal undefined).&amp;nbsp; On the top of my board the jumper was not shunted so it made sense that the accelerometer wasn't enabled.&amp;nbsp; However, when I turned the board over there is actually a trace between the pins on J17.&amp;nbsp; As a result the accelerometer was actually enabled.&amp;nbsp; I had the trace cut so that J17 would behave in the way it was intended.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em; color: #1f497d;"&gt;I have enclosed pictures of what I am talking about.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;&lt;BR /&gt; Thanks for everyone's help.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;&lt;BR /&gt; Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;&lt;BR /&gt; Mehmood&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;&lt;SPAN style="color: #1f497d;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="front.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/41429i6E3C18950D27F739/image-size/large?v=v2&amp;amp;px=999" role="button" title="front.jpg" alt="front.jpg" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="back.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/41490iB90514B8E251371C/image-size/large?v=v2&amp;amp;px=999" role="button" title="back.jpg" alt="back.jpg" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="SpiData.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/41547iF02F62397B6AB5FD/image-size/large?v=v2&amp;amp;px=999" role="button" title="SpiData.jpg" alt="SpiData.jpg" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 Oct 2013 18:18:43 GMT</pubDate>
    <dc:creator>msn402</dc:creator>
    <dc:date>2013-10-24T18:18:43Z</dc:date>
    <item>
      <title>FRDM-K20D50M SPI Driver (non-PE)</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-K20D50M-SPI-Driver-non-PE/m-p/224651#M4286</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to the Freescale K20 family and currently working with the FRDM-K20D50M board.&amp;nbsp; I have written a SPI driver from scratch (ie not using ProcessorExpert) since I am using IAR for my IDE.&amp;nbsp; It is a simple driver in that it only transmits data and doesn't care about what is received.&amp;nbsp; I have the SPI configured as a Master but things don't seem to be working quite right.&amp;nbsp; The driver uses interrupts (but not DMA) to transfer bytes to a slave.&amp;nbsp; When I attempt to send a buffer I can see two issues:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;CLK signal is correctly functioning, however, the outgoing bytes (MOSI) don't coincide with the clock signal&lt;/LI&gt;&lt;LI&gt;the time between each byte transmission is relatively large (~1.85ms) [not very obvious from the Saleae trace attached but was the case when I expanded the view]&lt;/LI&gt;&lt;/UL&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have double- and triple-checked the connections to make sure my pin configuration and signal test points are correct.&amp;nbsp; Are there any ideas as to what is wrong with the driver?&amp;nbsp; I have also enclosed a main() application that sends [0x01, 0x02, 0x03, 0x04, 0x05] about every 1s that illustrates the issue.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Feedback is greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-337421"&gt;blink_rgb.cpp.txt.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-337421"&gt;LDSpi0.cpp.txt.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-337421"&gt;LDSpi0.h.txt.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Oct 2013 23:54:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-K20D50M-SPI-Driver-non-PE/m-p/224651#M4286</guid>
      <dc:creator>msn402</dc:creator>
      <dc:date>2013-10-22T23:54:54Z</dc:date>
    </item>
    <item>
      <title>Re: FRDM-K20D50M SPI Driver (non-PE)</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-K20D50M-SPI-Driver-non-PE/m-p/224652#M4287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mehmood,&lt;/P&gt;&lt;P&gt; Please check the clock frequency given to the SPI peripheral. The clock module needs to be initialized separately.&lt;/P&gt;&lt;P&gt;An then you can calculate the baudrate according to the SCK baud rate = (fsys/PBR) x [(1+DBR)/BR]&amp;nbsp; where fsys is the peripheral clock.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Oct 2013 04:41:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-K20D50M-SPI-Driver-non-PE/m-p/224652#M4287</guid>
      <dc:creator>nasreenshaikh</dc:creator>
      <dc:date>2013-10-23T04:41:43Z</dc:date>
    </item>
    <item>
      <title>Re: FRDM-K20D50M SPI Driver (non-PE)</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-K20D50M-SPI-Driver-non-PE/m-p/224653#M4288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Nasreen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your suggestions.&amp;nbsp; If I understand correctly, are you recommending verifying the SPI_CTAR register settings?&amp;nbsp; Once I check those settings I presume the other register settings look correct?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mehmood&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Oct 2013 05:33:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-K20D50M-SPI-Driver-non-PE/m-p/224653#M4288</guid>
      <dc:creator>msn402</dc:creator>
      <dc:date>2013-10-23T05:33:15Z</dc:date>
    </item>
    <item>
      <title>Re: FRDM-K20D50M SPI Driver (non-PE)</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-K20D50M-SPI-Driver-non-PE/m-p/224654#M4289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You an easily use Processor Expert with IAR too (&lt;A href="http://mcuoneclipse.com/2013/01/31/tutorial-iar-freertos-freedom-board/" title="http://mcuoneclipse.com/2013/01/31/tutorial-iar-freertos-freedom-board/"&gt;Tutorial: IAR + FreeRTOS + Freedom Board | MCU on Eclipse&lt;/A&gt;).&lt;/P&gt;&lt;P&gt;Even if you are not planning to use it, it provides a lot of help to get a driver working.&lt;/P&gt;&lt;P&gt;If you use it, you get a working initialization of your registers, and then you can copy the code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Oct 2013 06:49:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-K20D50M-SPI-Driver-non-PE/m-p/224654#M4289</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2013-10-23T06:49:03Z</dc:date>
    </item>
    <item>
      <title>Re: FRDM-K20D50M SPI Driver (non-PE)</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-K20D50M-SPI-Driver-non-PE/m-p/224655#M4290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Erich,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your suggestion.&amp;nbsp; I have good news and not good news:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The good news is that I was able to use Processor Expert to generate the SPI master code for me.&amp;nbsp; The interbyte time was also reduced quite a bit and the clock is set to the exact value that I wanted.&amp;nbsp; The bad news is that the behaviour is identical to my original code.&amp;nbsp; In the attached screenshots you can see the SS and CLK signals behaving correctly.&amp;nbsp; The other screenshot shows the correct data but no CLK and SS associated with it. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Mehmood&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="SpiClock.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/40154i7EE1266DEDE8895F/image-size/large?v=v2&amp;amp;px=999" role="button" title="SpiClock.jpg" alt="SpiClock.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="SpiData.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/12924i2AFD03C1FD333FE9/image-size/large?v=v2&amp;amp;px=999" role="button" title="SpiData.jpg" alt="SpiData.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Oct 2013 22:06:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-K20D50M-SPI-Driver-non-PE/m-p/224655#M4290</guid>
      <dc:creator>msn402</dc:creator>
      <dc:date>2013-10-23T22:06:11Z</dc:date>
    </item>
    <item>
      <title>Re: FRDM-K20D50M SPI Driver (non-PE)</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-K20D50M-SPI-Driver-non-PE/m-p/224656#M4291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;that really looks strange (SPI data shifted without the clock signal).&lt;/P&gt;&lt;P&gt;I see that you have two different SPI bus in your screenshot?&lt;/P&gt;&lt;P&gt;I know you said that you checked the signals, but are you 200% sure you use the correct pin/signal.&lt;/P&gt;&lt;P&gt;Otherwise (I have not checked), maybe this is documented in the errata of the device?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Oct 2013 06:13:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-K20D50M-SPI-Driver-non-PE/m-p/224656#M4291</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2013-10-24T06:13:51Z</dc:date>
    </item>
    <item>
      <title>Re: FRDM-K20D50M SPI Driver (non-PE)</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-K20D50M-SPI-Driver-non-PE/m-p/224657#M4292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; &lt;SPAN style="color: #1f497d;"&gt;I found the problem!!!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;On the FRDM-K20D50M board there is a jumper J17.&amp;nbsp; When the pins are shunted it enables the accelerometer on the board (an makes the SPI MOSI signal undefined).&amp;nbsp; On the top of my board the jumper was not shunted so it made sense that the accelerometer wasn't enabled.&amp;nbsp; However, when I turned the board over there is actually a trace between the pins on J17.&amp;nbsp; As a result the accelerometer was actually enabled.&amp;nbsp; I had the trace cut so that J17 would behave in the way it was intended.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em; color: #1f497d;"&gt;I have enclosed pictures of what I am talking about.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;&lt;BR /&gt; Thanks for everyone's help.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;&lt;BR /&gt; Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;&lt;BR /&gt; Mehmood&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;&lt;SPAN style="color: #1f497d;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="front.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/41429i6E3C18950D27F739/image-size/large?v=v2&amp;amp;px=999" role="button" title="front.jpg" alt="front.jpg" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="back.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/41490iB90514B8E251371C/image-size/large?v=v2&amp;amp;px=999" role="button" title="back.jpg" alt="back.jpg" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="SpiData.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/41547iF02F62397B6AB5FD/image-size/large?v=v2&amp;amp;px=999" role="button" title="SpiData.jpg" alt="SpiData.jpg" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Oct 2013 18:18:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-K20D50M-SPI-Driver-non-PE/m-p/224657#M4292</guid>
      <dc:creator>msn402</dc:creator>
      <dc:date>2013-10-24T18:18:43Z</dc:date>
    </item>
  </channel>
</rss>

