<?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 My sharring - IMX 28 to MC56f8257  SPI in 15 mega bit in Processor Expert Software</title>
    <link>https://community.nxp.com/t5/Processor-Expert-Software/My-sharring-IMX-28-to-MC56f8257-SPI-in-15-mega-bit/m-p/208697#M883</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We are working on both IMX28 and MC56f8x000 family.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found that the support from freescale is not very helpfull , so i think all programmers should share there findings to help each other.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will share with you..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;tring to achive 15000000 mega bit between IMX 28 and MC56f8257 was not an easy task,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First we tried using the processor expert.&lt;/P&gt;&lt;P&gt;The PE has two options:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) Works in interrupt&lt;/P&gt;&lt;P&gt;2) Works in polling.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using the code that the PE generate in interrupt as is you can get no more than 1Mbit.&lt;/P&gt;&lt;P&gt;using the code that the PE generae in polling you can get up to 4Mbit (even less)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But in order to get 15 mega bit we need to do something else&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) &amp;nbsp;Works in interrupt.&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) In the interrupt routine &amp;nbsp;, after getting the first byte poll the reset of the data&lt;/P&gt;&lt;P&gt;3) be 100% effeciency in the code and dont waiste even 1 cycle&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Spi routine in the intrrupt must get first the entire data , it cannot parse the data , perform even check for overrun.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code that will work in 15 mega in the Controller side:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in the SPI RX intrrupts:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for (i = 0; i &amp;lt; size ; i++)&lt;BR /&gt;{&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; while (!(getRegBit(QSPI0_SCTRL,SPRF)))&lt;BR /&gt;&amp;nbsp; &amp;nbsp; {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;&amp;nbsp; &amp;nbsp; RxBuffer[i] = getReg(QSPI0_DRCV);&lt;BR /&gt;}&lt;BR /&gt;if (getRegBit(QSPI0_SCTRL,OVRF))&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp;/* Occured any overflow condition between QSPI0_SCTRL and QSPI0_DRCV reading? */&lt;BR /&gt;&amp;nbsp; &amp;nbsp;getReg(QSPI0_DRCV); /* Clear the overflow flag */&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;note:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the controller does not know the size and it should accept it via an header , then the header must be send slowly from IMX.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Suppose my header has 3 bytes:&lt;/P&gt;&lt;P&gt;Sequence indication one byte&lt;/P&gt;&lt;P&gt;Size - two bytes&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In IMX side i will send the data as follow:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for (i = 0 ; i &amp;lt; 3 i++)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; write (fd , data &amp;nbsp;, 1)&amp;nbsp;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and then the data&amp;nbsp;&lt;/P&gt;&lt;P&gt;write (fd , data , size)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where size is more than 1.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When sending in IMX data using write more than 1 it being sent as a burst , fast as you configure the SPI.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Eli&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 22 Feb 2012 14:10:52 GMT</pubDate>
    <dc:creator>EliArad</dc:creator>
    <dc:date>2012-02-22T14:10:52Z</dc:date>
    <item>
      <title>My sharring - IMX 28 to MC56f8257  SPI in 15 mega bit</title>
      <link>https://community.nxp.com/t5/Processor-Expert-Software/My-sharring-IMX-28-to-MC56f8257-SPI-in-15-mega-bit/m-p/208697#M883</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We are working on both IMX28 and MC56f8x000 family.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found that the support from freescale is not very helpfull , so i think all programmers should share there findings to help each other.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will share with you..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;tring to achive 15000000 mega bit between IMX 28 and MC56f8257 was not an easy task,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First we tried using the processor expert.&lt;/P&gt;&lt;P&gt;The PE has two options:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) Works in interrupt&lt;/P&gt;&lt;P&gt;2) Works in polling.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using the code that the PE generate in interrupt as is you can get no more than 1Mbit.&lt;/P&gt;&lt;P&gt;using the code that the PE generae in polling you can get up to 4Mbit (even less)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But in order to get 15 mega bit we need to do something else&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) &amp;nbsp;Works in interrupt.&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) In the interrupt routine &amp;nbsp;, after getting the first byte poll the reset of the data&lt;/P&gt;&lt;P&gt;3) be 100% effeciency in the code and dont waiste even 1 cycle&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Spi routine in the intrrupt must get first the entire data , it cannot parse the data , perform even check for overrun.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code that will work in 15 mega in the Controller side:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in the SPI RX intrrupts:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for (i = 0; i &amp;lt; size ; i++)&lt;BR /&gt;{&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; while (!(getRegBit(QSPI0_SCTRL,SPRF)))&lt;BR /&gt;&amp;nbsp; &amp;nbsp; {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;&amp;nbsp; &amp;nbsp; RxBuffer[i] = getReg(QSPI0_DRCV);&lt;BR /&gt;}&lt;BR /&gt;if (getRegBit(QSPI0_SCTRL,OVRF))&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp;/* Occured any overflow condition between QSPI0_SCTRL and QSPI0_DRCV reading? */&lt;BR /&gt;&amp;nbsp; &amp;nbsp;getReg(QSPI0_DRCV); /* Clear the overflow flag */&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;note:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the controller does not know the size and it should accept it via an header , then the header must be send slowly from IMX.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Suppose my header has 3 bytes:&lt;/P&gt;&lt;P&gt;Sequence indication one byte&lt;/P&gt;&lt;P&gt;Size - two bytes&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In IMX side i will send the data as follow:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for (i = 0 ; i &amp;lt; 3 i++)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; write (fd , data &amp;nbsp;, 1)&amp;nbsp;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and then the data&amp;nbsp;&lt;/P&gt;&lt;P&gt;write (fd , data , size)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where size is more than 1.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When sending in IMX data using write more than 1 it being sent as a burst , fast as you configure the SPI.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Eli&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 14:10:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Processor-Expert-Software/My-sharring-IMX-28-to-MC56f8257-SPI-in-15-mega-bit/m-p/208697#M883</guid>
      <dc:creator>EliArad</dc:creator>
      <dc:date>2012-02-22T14:10:52Z</dc:date>
    </item>
  </channel>
</rss>

