<?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: Problems with COM port on a MC908AP64A in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Problems-with-COM-port-on-a-MC908AP64A/m-p/207503#M17593</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Alpha,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Some issues with your code -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1)&amp;nbsp; You appear to be polling the SCTE flag within SCS1 register, rather than the SCRF flag within the IRSCS1 register, since you are waiting for a received character into the IRSCI module.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2)&amp;nbsp; Once the correct flag is polled, it is likely that COP timeout will occur since you do not reset the COP timer within your wait loop.&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp; while ((&lt;FONT color="#ff0000"&gt;IRSCS1&lt;/FONT&gt; &amp;amp; &lt;FONT color="#ff0000"&gt;0x20&lt;/FONT&gt;) == 0) // Rx done ??&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; __RESET_WATCHDOG();&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3)&amp;nbsp; It may also pay to check the code generated by the compiler for the statement -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp; IRSCDR = IRSCDR;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;to ensure that the compiler does not optimise this away.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code to initialise the port pins is unnecessary since the IRSCI module will over-ride these pins when the module is enabled.&amp;nbsp; There also seems to be little point in first zeroing the control registers before then writing the required values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have not checked your baud rate calculation.&amp;nbsp; However, it is possible that the binary notation may not be acceptable to all compilers.&amp;nbsp; Better to use hexadecimal.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mac&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 14 Aug 2009 20:37:02 GMT</pubDate>
    <dc:creator>bigmac</dc:creator>
    <dc:date>2009-08-14T20:37:02Z</dc:date>
    <item>
      <title>Problems with COM port on a MC908AP64A</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Problems-with-COM-port-on-a-MC908AP64A/m-p/207502#M17592</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;I have some configuration problems. Could you help me out ?&lt;/P&gt;&lt;P&gt;I am trying to write a test softare that will echo back to my PC trought a SCI port.&lt;/P&gt;&lt;P&gt;I have a circuitboard allready, and the IRSCI is connected to a max232 circuit.&lt;/P&gt;&lt;P&gt;The ordinary SCI is reserved to another task.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Check my code below.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#include &amp;lt;hidef.h&amp;gt; /* for EnableInterrupts macro */&lt;BR /&gt;#include "derivative.h" /* include peripheral declarations */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;void main(void) {&lt;BR /&gt;&amp;nbsp; int b=0;&lt;BR /&gt;&amp;nbsp; int a=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp; DisableInterrupts;&lt;/P&gt;&lt;P&gt;&amp;nbsp; CONFIG2 = 0x01; //Internal data bus clock&lt;BR /&gt;&amp;nbsp; DDRC&amp;amp;=~(0x80); //Rx pin as input&lt;BR /&gt;&amp;nbsp; PTC|=0x40;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Tx pin idle&lt;BR /&gt;&amp;nbsp; DDRC|=0x40;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Tx pin as output&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; IRSCC1=0x00;&lt;BR /&gt;&amp;nbsp; IRSCC2=0x00;&lt;BR /&gt;&amp;nbsp; IRSCC3=0x00;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; IRSCBR=0B00110000; // (4MHz/4)/(16*13) ~ 4800baud&lt;/P&gt;&lt;P&gt;&amp;nbsp; IRSCC1=0x40;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Enable SCI module&lt;BR /&gt;&amp;nbsp; IRSCC2=0x0C;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Enable Transmitter and Reveiver&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; EnableInterrupts;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; for(;&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;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; __RESET_WATCHDOG(); /* feeds the dog */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // A delay&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(b=0;b&amp;lt;100;b++) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while((SCS1 &amp;amp; 0x80)==0);&amp;nbsp;// Rx done ??&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IRSCDR=IRSCDR;&amp;nbsp; // Tx the character that is Rx.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; } /* loop forever */&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;What do i wrong ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Alfa Master&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Aug 2009 19:25:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Problems-with-COM-port-on-a-MC908AP64A/m-p/207502#M17592</guid>
      <dc:creator>AlfaMaster</dc:creator>
      <dc:date>2009-08-14T19:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with COM port on a MC908AP64A</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Problems-with-COM-port-on-a-MC908AP64A/m-p/207503#M17593</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Alpha,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Some issues with your code -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1)&amp;nbsp; You appear to be polling the SCTE flag within SCS1 register, rather than the SCRF flag within the IRSCS1 register, since you are waiting for a received character into the IRSCI module.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2)&amp;nbsp; Once the correct flag is polled, it is likely that COP timeout will occur since you do not reset the COP timer within your wait loop.&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp; while ((&lt;FONT color="#ff0000"&gt;IRSCS1&lt;/FONT&gt; &amp;amp; &lt;FONT color="#ff0000"&gt;0x20&lt;/FONT&gt;) == 0) // Rx done ??&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; __RESET_WATCHDOG();&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3)&amp;nbsp; It may also pay to check the code generated by the compiler for the statement -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp; IRSCDR = IRSCDR;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;to ensure that the compiler does not optimise this away.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code to initialise the port pins is unnecessary since the IRSCI module will over-ride these pins when the module is enabled.&amp;nbsp; There also seems to be little point in first zeroing the control registers before then writing the required values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have not checked your baud rate calculation.&amp;nbsp; However, it is possible that the binary notation may not be acceptable to all compilers.&amp;nbsp; Better to use hexadecimal.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mac&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Aug 2009 20:37:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Problems-with-COM-port-on-a-MC908AP64A/m-p/207503#M17593</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2009-08-14T20:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with COM port on a MC908AP64A</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Problems-with-COM-port-on-a-MC908AP64A/m-p/207504#M17594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I did as you said, check the correct flag, and added the cop reset in my loop and it worked.&lt;/P&gt;&lt;P&gt;I also dicovered how great the Initialize Device menu is. So i removed all my settings in the beginning and used the init function instead.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Terje.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Aug 2009 19:04:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Problems-with-COM-port-on-a-MC908AP64A/m-p/207504#M17594</guid>
      <dc:creator>AlfaMaster</dc:creator>
      <dc:date>2009-08-17T19:04:17Z</dc:date>
    </item>
  </channel>
</rss>

