<?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: Getting IIC to work with S912 in S12 / MagniV Microcontrollers</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Getting-IIC-to-work-with-S912-9S12DG256/m-p/211110#M8759</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Well, that Standard Edition is free up to 32K.&lt;BR /&gt;Also, processor expert will generate code for you for many of the IO's.&lt;BR /&gt;And of course CW has the best support as it is from the manufacture.&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 Apr 2008 00:46:31 GMT</pubDate>
    <dc:creator>JimDon</dc:creator>
    <dc:date>2008-04-10T00:46:31Z</dc:date>
    <item>
      <title>Getting IIC to work with S912 - 9S12DG256.</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Getting-IIC-to-work-with-S912-9S12DG256/m-p/211101#M8750</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for days I am trying to get the IIC bus to work on an 9S12DG256. Now, I was hoping you guys could give me some hints what the problem might be.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;First of all, I am using the PLL with 24 MHz. Therefore I am using a SCL clock divider of 80 (IBFD = 0x14). Hope that is correct.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using the ICC Compiler. This is my code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;IBFD = 0x14;&amp;nbsp; // init IBFDIBAD = 0xA0;&amp;nbsp; // set slave address
IBCR |= 0b10000000;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // IBEN = 1 - IIC bus enableIBCR |= 0b01000000;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // IBIE = 1 - IIC interrupt enable
while(IBSR&amp;amp;0b00100000)
{
 printf("wait until bus is free");
};
printf("bus free");
&amp;nbsp; 
IBCR |= 0b01000000;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // IBIE = 1 - IIC interrupt enable
IBCR |= 0b00010000;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // TX/RX = 1 - transmit mode
IBCR |= 0b00100000;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // MS/SL = 1 - master mode - START signal
printf("START");
IICDR = 0b10010000;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // address slave
printf("slave addressed");&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;The "START" output is reached but never is the "slave addressed". The controller seems to stop at&lt;PRE&gt;IICDR = 0b10010000;&lt;/PRE&gt;leaving the SDA high (5 V) and the SCL low (0 V).&lt;BR /&gt;&lt;BR /&gt;I have been trying various things but neither seemed to work. Any help would be appreciated.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Bastian Goericke&lt;BR /&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Added p/n to subject.&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Message Edited by NLFSJ on &lt;/SPAN&gt;&lt;SPAN class="date_text"&gt;2008-04-16&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN class="time_text"&gt;03:37 PM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2008 14:14:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Getting-IIC-to-work-with-S912-9S12DG256/m-p/211101#M8750</guid>
      <dc:creator>Bastian</dc:creator>
      <dc:date>2008-04-09T14:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: Getting IIC to work with S912</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Getting-IIC-to-work-with-S912-9S12DG256/m-p/211102#M8751</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;You are enabling IIC interrupts. Do you have IIC interrupt handler somewhere? is IIC vector pointing properly to IIC ISR? If not then it's OK that controller hangs after you write IIC data register.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Did you try to use search at the bottom of this page? Also search 8-bit MCU forum. All FSL MCU's have nearly identical IIC peripheral.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2008 14:46:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Getting-IIC-to-work-with-S912-9S12DG256/m-p/211102#M8751</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2008-04-09T14:46:35Z</dc:date>
    </item>
    <item>
      <title>Re: Getting IIC to work with S912</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Getting-IIC-to-work-with-S912-9S12DG256/m-p/211103#M8752</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;I just tried the code without enabling the interrupt . The controller didn't hang up and reached the "slave addressed".&lt;BR /&gt;Seems like something is wrong with the ISR or interrupt vector.&lt;BR /&gt;I am using the TwinPEEKs monitor program and I set up the IIC interrupt and ISR like this:&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;// I2C Interrupt Handler:    *((unsigned char *)0x3fa3) = 0x06;   // JMP opcode   *((void (**)(void))0x3fa4) = I2Chandler;#pragma interrupt_handler I2Chandlervoid I2Chandler(void){ i2c_flag = 1;}&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;&amp;nbsp;As far as I know this should be correct. Do you have any idea why the ISR isn't triggered correctly?&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Bastian&lt;BR /&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2008 15:32:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Getting-IIC-to-work-with-S912-9S12DG256/m-p/211103#M8752</guid>
      <dc:creator>Bastian</dc:creator>
      <dc:date>2008-04-09T15:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: Getting IIC to work with S912</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Getting-IIC-to-work-with-S912-9S12DG256/m-p/211104#M8753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Your ISR handler should acknowledge IIC interrupt by clearing IBIF flag:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; IBSR = 2 /*IBSR_IBIF_MASK*/;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2008 16:25:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Getting-IIC-to-work-with-S912-9S12DG256/m-p/211104#M8753</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2008-04-09T16:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: Getting IIC to work with S912</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Getting-IIC-to-work-with-S912-9S12DG256/m-p/211105#M8754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Thanks kef, that helped. Now the ISR is working although it wasn't easy for me to understand that writing a "1" clears the flag. Especially since the documentation stated: "This bit must be cleared by software, writing a low to it, in the interrupt routine."&lt;BR /&gt;Nevertheless, I am finally making some progress. However it may take a while until I reach the functionality described in AppNore2318.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Bastian&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2008 20:53:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Getting-IIC-to-work-with-S912-9S12DG256/m-p/211105#M8754</guid>
      <dc:creator>Bastian</dc:creator>
      <dc:date>2008-04-09T20:53:45Z</dc:date>
    </item>
    <item>
      <title>Re: Getting IIC to work with S912</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Getting-IIC-to-work-with-S912-9S12DG256/m-p/211106#M8755</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;There is an app note with a software example that shows a fully interrupt driven master and slave i2c.&lt;BR /&gt;&lt;BR /&gt;The app note is &lt;A href="%20%20http://www.freescale.com/files/microcontrollers/doc/app_note/AN2318.pdf?fsrch=1" rel="nofollow" target="_blank"&gt;AN2318.pdf,&lt;/A&gt; and the software is &lt;A href="http://www.freescale.com/webapp/sps/download/license.jsp?colCode=AN2318SW&amp;amp;location=null&amp;amp;fpsp=1" rel="nofollow" target="_blank"&gt;AN2318SW.zip.&lt;/A&gt;&lt;BR /&gt;You will have to login to download the software.&lt;BR /&gt;&lt;BR /&gt;You may have to cut and paste the routines into your code, but it is a working example that should answer all your questions.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;Message Edited by JimDon on &lt;SPAN class="date_text"&gt;2008-04-09&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;10:06 AM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2008 21:04:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Getting-IIC-to-work-with-S912-9S12DG256/m-p/211106#M8755</guid>
      <dc:creator>JimDon</dc:creator>
      <dc:date>2008-04-09T21:04:52Z</dc:date>
    </item>
    <item>
      <title>Re: Getting IIC to work with S912</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Getting-IIC-to-work-with-S912-9S12DG256/m-p/211107#M8756</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Thanks Jim, I tried the AN2318 first but I never got the interrupt to work. Probably because I am not using the CodeWarrior but the Imagecraft Compiler. At some point I decided to start from scratch. Now, I am considering to try the AN2318 code again, although there might be more differences between these 2 compilers (e.g. the IBDR is called IICDR in the Imagecraft).&lt;BR /&gt;&lt;BR /&gt;Bastian&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2008 21:14:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Getting-IIC-to-work-with-S912-9S12DG256/m-p/211107#M8756</guid>
      <dc:creator>Bastian</dc:creator>
      <dc:date>2008-04-09T21:14:41Z</dc:date>
    </item>
    <item>
      <title>Re: Getting IIC to work with S912</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Getting-IIC-to-work-with-S912-9S12DG256/m-p/211108#M8757</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Well, at least the code should serve to show how the registers should be written and how status should be acted upon.&lt;BR /&gt;&lt;BR /&gt;Since CW is free, you could give it a try.&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2008 23:28:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Getting-IIC-to-work-with-S912-9S12DG256/m-p/211108#M8757</guid>
      <dc:creator>JimDon</dc:creator>
      <dc:date>2008-04-09T23:28:41Z</dc:date>
    </item>
    <item>
      <title>Re: Getting IIC to work with S912</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Getting-IIC-to-work-with-S912-9S12DG256/m-p/211109#M8758</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Yeah, you are right. As a template it should help a lot.&lt;BR /&gt;&lt;BR /&gt;Oh, CW is free? I didn't know that, got the impression it wouldn't be free when I looked at the website.&lt;BR /&gt;Maybe I'll will give it a try. But since everyone else in my team is using the ICC, I stuck with that when I first started.&lt;BR /&gt;&lt;BR /&gt;Bastian&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2008 23:37:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Getting-IIC-to-work-with-S912-9S12DG256/m-p/211109#M8758</guid>
      <dc:creator>Bastian</dc:creator>
      <dc:date>2008-04-09T23:37:15Z</dc:date>
    </item>
    <item>
      <title>Re: Getting IIC to work with S912</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Getting-IIC-to-work-with-S912-9S12DG256/m-p/211110#M8759</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Well, that Standard Edition is free up to 32K.&lt;BR /&gt;Also, processor expert will generate code for you for many of the IO's.&lt;BR /&gt;And of course CW has the best support as it is from the manufacture.&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Apr 2008 00:46:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Getting-IIC-to-work-with-S912-9S12DG256/m-p/211110#M8759</guid>
      <dc:creator>JimDon</dc:creator>
      <dc:date>2008-04-10T00:46:31Z</dc:date>
    </item>
    <item>
      <title>Re: Getting IIC to work with S912</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Getting-IIC-to-work-with-S912-9S12DG256/m-p/211111#M8760</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;Thanks for you help Jim.&lt;BR /&gt;&lt;BR /&gt;I got the IIC bus to run with a modified AN2318 code. Getting to read the temperature from an Maxim DS1624 (thermometer) was astonishing easy. However, I am stuck now with a PCF8583P (real-time clock). It does not respond or acknowledges any data sent to it. I have checked its slave address (1010000x for A0 grounded). Also I have tried various IBFD values (even though I am not exactly sure how to calculate the correct value).&lt;BR /&gt;Whatever I try, the themometer always responds correctly, but never does the real-time clock.&lt;BR /&gt;Do you have any ideas what the problem might be?&lt;BR /&gt;&lt;BR /&gt;Bastian Goericke&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Apr 2008 15:05:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Getting-IIC-to-work-with-S912-9S12DG256/m-p/211111#M8760</guid>
      <dc:creator>Bastian</dc:creator>
      <dc:date>2008-04-16T15:05:39Z</dc:date>
    </item>
    <item>
      <title>Re: Getting IIC to work with S912 - 9S12DG256.</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Getting-IIC-to-work-with-S912-9S12DG256/m-p/211112#M8761</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Ok, now I found out something interesting.&lt;BR /&gt;After one byte is sent and the ISR is called, the 'Acknowledge received' bit in the IBSR is not set. But after the ISR is completed, then, at some point, the 'Acknowledge received' bit is set. I have no idea, why the bit would be set that late.&lt;BR /&gt;When I try my other IIC device (which works with my code), the bit is set when the ISR is called (as expected).&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Bastian&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Apr 2008 17:46:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Getting-IIC-to-work-with-S912-9S12DG256/m-p/211112#M8761</guid>
      <dc:creator>Bastian</dc:creator>
      <dc:date>2008-04-21T17:46:15Z</dc:date>
    </item>
  </channel>
</rss>

