<?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 configuration in S12 / MagniV Microcontrollers</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/SPI-configuration/m-p/183558#M6845</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi! I'm trying to transmit a byte from SPI0 to SPI1, for which I tried using the below given code- --------------------------------------------------------- void main(void) { SPI0CR1=0x5F;//SPIO enabled and cofigured as master SPI0CR2=0x00; SPI0BR=0x77; SPI1CR1=0x48;//SPI1 enabled and configured as slave SPI1CR2=0x00; SPI1BR=0x77; EnableInterrupts; for(;&lt;/SPAN&gt;&lt;A href="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif"&gt;&lt;IMG alt=":smileywink:" class="emoticon emoticon-smileywink" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif" title="Smiley Wink" /&gt;&lt;/A&gt;&lt;SPAN&gt; { while(!SPI0SR_SPTEF ); SPI0DR=0x78; while(!SPI1SR_SPIF); i=SPI1DR; } } ----------------------------------------------- and also this is being run as Full Chip Simulation where i've used the following command file to virtually connect MOSI0 to MOSI1 and SCK0 to SCK1 ------------- openio pinconn connect "Pim.PORTSPin5","Pim.PORTPPin1" connect "Pim.PORTSPin6","Pim.PORTPPin2" ------------- My problem is, while the Txd byte is available at MOSI0, the same is not being transmitted to SPI1, or in other words, data is not getting written onto the SPI1... Can someone please help me figure out the problem.. Regards, Dev&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 Jan 2008 10:55:58 GMT</pubDate>
    <dc:creator>Dev</dc:creator>
    <dc:date>2008-01-29T10:55:58Z</dc:date>
    <item>
      <title>SPI configuration</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/SPI-configuration/m-p/183558#M6845</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi! I'm trying to transmit a byte from SPI0 to SPI1, for which I tried using the below given code- --------------------------------------------------------- void main(void) { SPI0CR1=0x5F;//SPIO enabled and cofigured as master SPI0CR2=0x00; SPI0BR=0x77; SPI1CR1=0x48;//SPI1 enabled and configured as slave SPI1CR2=0x00; SPI1BR=0x77; EnableInterrupts; for(;&lt;/SPAN&gt;&lt;A href="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif"&gt;&lt;IMG alt=":smileywink:" class="emoticon emoticon-smileywink" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif" title="Smiley Wink" /&gt;&lt;/A&gt;&lt;SPAN&gt; { while(!SPI0SR_SPTEF ); SPI0DR=0x78; while(!SPI1SR_SPIF); i=SPI1DR; } } ----------------------------------------------- and also this is being run as Full Chip Simulation where i've used the following command file to virtually connect MOSI0 to MOSI1 and SCK0 to SCK1 ------------- openio pinconn connect "Pim.PORTSPin5","Pim.PORTPPin1" connect "Pim.PORTSPin6","Pim.PORTPPin2" ------------- My problem is, while the Txd byte is available at MOSI0, the same is not being transmitted to SPI1, or in other words, data is not getting written onto the SPI1... Can someone please help me figure out the problem.. Regards, Dev&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2008 10:55:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/SPI-configuration/m-p/183558#M6845</guid>
      <dc:creator>Dev</dc:creator>
      <dc:date>2008-01-29T10:55:58Z</dc:date>
    </item>
    <item>
      <title>Re: SPI configuration</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/SPI-configuration/m-p/183559#M6846</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Hello Dev, and welcome to the&amp;nbsp;forum.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;What happened to the formatting of your post?&amp;nbsp; Always a good idea to check immediately after posting, and if necessary, edit your post.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;I can't be sure about the validity of your virtual connection - others may need to assist here.&amp;nbsp; But you may also need to consider the SS connection between master and slave (since the slave operation has set CPHA = 0).&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;I can see a number of problems with the code you have posted -&lt;/FONT&gt;&lt;/DIV&gt;&lt;OL&gt;&lt;LI&gt;&lt;FONT size="2"&gt;You seem to have a mismatch between master and slave channels with respect to the control bits LSBFE and CPHA.&amp;nbsp; This is not permissible.&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="2"&gt;I would assume that you intend to operate with automatic operation of the master SS line as an output (SSOE = 1).&amp;nbsp; This also requires that&amp;nbsp;MODFEN = 1 (SPI0CR2 = 0x10).&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="2"&gt;Even though you are not using the return data from the slave channel, you will still need to clear the flag to prevent an overrun condition.&amp;nbsp; This will require SPI0DR to be read.&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="2"&gt;While not a problem per se, be aware that setting the baud rate for the slave channel fulfills no purpose.&amp;nbsp; The master will determine the clock rate at which the slave operates.&lt;/FONT&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Part of the modified code is reflected below -.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;while (!SPI0SR_SPTEF );&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;SPI0DR = 0x78;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;/* Send byte to master */&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;while (!SPI0SR_SPIF); /* Wait for transmission complete */&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;i = SPI0DR;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Clear flag for master */&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;while (!SPI1SR_SPIF); /* Clear flag for slave */&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;i = SPI1DR;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Byte value received by slave */&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Regards,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Mac&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2008 18:52:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/SPI-configuration/m-p/183559#M6846</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2008-01-29T18:52:40Z</dc:date>
    </item>
    <item>
      <title>Re: SPI configuration</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/SPI-configuration/m-p/183560#M6847</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hello bigmac,&lt;BR /&gt;&lt;BR /&gt;as i was posting here for the first time,&lt;BR /&gt;I didn't notice the check and edit options.&lt;BR /&gt;Sorry or that, I'll ensure that I don't repeat&lt;BR /&gt;them again.&lt;BR /&gt;&lt;BR /&gt;Yep, as u have pointed out,&lt;BR /&gt;SPI1CR1=0x4F. So silly of me!!&lt;BR /&gt;&lt;BR /&gt;And wrt this program- it works fine&lt;BR /&gt;on the muc.. But the same prog didn't&lt;BR /&gt;work when set under "Full Chip Simulation".&lt;BR /&gt;So, I guess there is something wrong with&lt;BR /&gt;that virtual conection stuff that I've used.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks a lot.&lt;BR /&gt;Regards,&lt;BR /&gt;Dev&lt;BR /&gt;&lt;BR /&gt;Message Edited by Dev on &lt;SPAN class="date_text"&gt;2008-01-29&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;05:55 PM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jan 2008 01:43:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/SPI-configuration/m-p/183560#M6847</guid>
      <dc:creator>Dev</dc:creator>
      <dc:date>2008-01-30T01:43:40Z</dc:date>
    </item>
  </channel>
</rss>

