<?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 I2C Transmission problem in S12 / MagniV Microcontrollers</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/I2C-Transmission-problem/m-p/165134#M5353</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, I would like to point out that I tried to read most of the messages related to I2C posted on this Forum and the AN2318, but I could not find solution to my problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="text-decoration: underline;"&gt;Symptom:&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No pulse is transmitted from the master to the slave when the master is supposed to transmit 8bytes of data. (I am using an oscilloscope to check SCL and SDA lines)&lt;/P&gt;&lt;P&gt;While I debug the code (from AN2318SW) I can observe that the execution hangs at&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;
while(TxBufferemptyflag == CLEAR){} /*wait while message is transmitted */&lt;/PRE&gt;&lt;P&gt;from the master side.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;Description of my set up:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;1. Currently two Dragon-12 Plus Boards (with MC9S12DG256B) are used as master and slave.&lt;/P&gt;&lt;P&gt;2. SCL and SDA lines with 2.2kohm resistors to Vcc(5V).&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. Concerning the code, AN2318SW master and slave codes are used.&lt;/P&gt;&lt;P&gt;4. Modifications that I made to the code/project:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; - From the function ConfigureI2CModule(void) for both master and slave,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; Iic.ibfd.byte = 0x00; --&amp;gt;&amp;nbsp; Iic.ibfd.byte = 0x1F;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Because Bus_clock=24Mhz, desired I2C_bus = 100kbps =&amp;gt; SCLDivider = 240 =&amp;gt; IBFD = 0x1F&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; - added a source file called &lt;EM&gt;isr_vector.c&lt;/EM&gt; to the projects of the master and the slave&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; to specify that _I2CISR is the I2C ISR.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;Observation&lt;/STRONG&gt;&lt;/SPAN&gt;:&lt;/P&gt;&lt;P&gt;The main.c of the master has preprocessor&amp;nbsp;&lt;/P&gt;&lt;P&gt;#define&amp;nbsp; SLAVE 0xF0&lt;/P&gt;&lt;P&gt;and its ConfigureI2CModule() function has&lt;/P&gt;&lt;P&gt;Iic.ibad.byte = 0x0A;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;while the main.c of the slave has preprocessor&lt;/P&gt;&lt;P&gt;#define SLAVE 0xA0&lt;/P&gt;&lt;P&gt;and its ConfigureI2CModule() function has&amp;nbsp;&lt;/P&gt;&lt;P&gt;Iic.ibad.byte = 0xF0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the latter case(slave), shouldn't&amp;nbsp; &lt;STRONG&gt;#define SLAVE 0xA0&lt;/STRONG&gt; be &lt;STRONG&gt;#define SLAVE 0x0A&lt;/STRONG&gt;?&lt;/P&gt;&lt;P&gt;Or in the former case(master), shouldn't &lt;STRONG&gt;Iic.ibad.byte = 0x0A;&lt;/STRONG&gt; be &lt;STRONG&gt;Iic.ibad.byte = 0xA0;&lt;/STRONG&gt;?&lt;/P&gt;&lt;P&gt;Actually I tried both ways, but this didn't solve my problem.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;Reference&lt;/STRONG&gt;&lt;/SPAN&gt;:&lt;/P&gt;&lt;P&gt;The reference source code is at &lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.freescale.com%2Fwebapp%2Fsps%2Fdownload%2Flicense.jsp%3FcolCode%3DAN2318SW%26nodeId%3D0162464634%26location%3Doverview%26WT_TYPE%3DApplication%2520Notes%26WT_VENDOR%3DFREESCALE%26WT_FILE_FORMAT%3Dpdf%26WT_ASSET%3DDocumentation" rel="noopener noreferrer" target="_blank"&gt;AN2318SW&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I look forward to get your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jaeyun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Oct 2020 09:11:26 GMT</pubDate>
    <dc:creator>admin</dc:creator>
    <dc:date>2020-10-29T09:11:26Z</dc:date>
    <item>
      <title>I2C Transmission problem</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/I2C-Transmission-problem/m-p/165134#M5353</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, I would like to point out that I tried to read most of the messages related to I2C posted on this Forum and the AN2318, but I could not find solution to my problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="text-decoration: underline;"&gt;Symptom:&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No pulse is transmitted from the master to the slave when the master is supposed to transmit 8bytes of data. (I am using an oscilloscope to check SCL and SDA lines)&lt;/P&gt;&lt;P&gt;While I debug the code (from AN2318SW) I can observe that the execution hangs at&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;
while(TxBufferemptyflag == CLEAR){} /*wait while message is transmitted */&lt;/PRE&gt;&lt;P&gt;from the master side.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;Description of my set up:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;1. Currently two Dragon-12 Plus Boards (with MC9S12DG256B) are used as master and slave.&lt;/P&gt;&lt;P&gt;2. SCL and SDA lines with 2.2kohm resistors to Vcc(5V).&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. Concerning the code, AN2318SW master and slave codes are used.&lt;/P&gt;&lt;P&gt;4. Modifications that I made to the code/project:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; - From the function ConfigureI2CModule(void) for both master and slave,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; Iic.ibfd.byte = 0x00; --&amp;gt;&amp;nbsp; Iic.ibfd.byte = 0x1F;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Because Bus_clock=24Mhz, desired I2C_bus = 100kbps =&amp;gt; SCLDivider = 240 =&amp;gt; IBFD = 0x1F&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; - added a source file called &lt;EM&gt;isr_vector.c&lt;/EM&gt; to the projects of the master and the slave&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; to specify that _I2CISR is the I2C ISR.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;Observation&lt;/STRONG&gt;&lt;/SPAN&gt;:&lt;/P&gt;&lt;P&gt;The main.c of the master has preprocessor&amp;nbsp;&lt;/P&gt;&lt;P&gt;#define&amp;nbsp; SLAVE 0xF0&lt;/P&gt;&lt;P&gt;and its ConfigureI2CModule() function has&lt;/P&gt;&lt;P&gt;Iic.ibad.byte = 0x0A;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;while the main.c of the slave has preprocessor&lt;/P&gt;&lt;P&gt;#define SLAVE 0xA0&lt;/P&gt;&lt;P&gt;and its ConfigureI2CModule() function has&amp;nbsp;&lt;/P&gt;&lt;P&gt;Iic.ibad.byte = 0xF0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the latter case(slave), shouldn't&amp;nbsp; &lt;STRONG&gt;#define SLAVE 0xA0&lt;/STRONG&gt; be &lt;STRONG&gt;#define SLAVE 0x0A&lt;/STRONG&gt;?&lt;/P&gt;&lt;P&gt;Or in the former case(master), shouldn't &lt;STRONG&gt;Iic.ibad.byte = 0x0A;&lt;/STRONG&gt; be &lt;STRONG&gt;Iic.ibad.byte = 0xA0;&lt;/STRONG&gt;?&lt;/P&gt;&lt;P&gt;Actually I tried both ways, but this didn't solve my problem.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;Reference&lt;/STRONG&gt;&lt;/SPAN&gt;:&lt;/P&gt;&lt;P&gt;The reference source code is at &lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.freescale.com%2Fwebapp%2Fsps%2Fdownload%2Flicense.jsp%3FcolCode%3DAN2318SW%26nodeId%3D0162464634%26location%3Doverview%26WT_TYPE%3DApplication%2520Notes%26WT_VENDOR%3DFREESCALE%26WT_FILE_FORMAT%3Dpdf%26WT_ASSET%3DDocumentation" rel="noopener noreferrer" target="_blank"&gt;AN2318SW&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I look forward to get your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jaeyun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:11:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/I2C-Transmission-problem/m-p/165134#M5353</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2020-10-29T09:11:26Z</dc:date>
    </item>
    <item>
      <title>Re: I2C Transmission problem</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/I2C-Transmission-problem/m-p/165135#M5354</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My bad.&lt;/P&gt;&lt;P&gt;The observation should have been:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Observation&lt;/STRONG&gt;&lt;/U&gt;:&lt;/P&gt;&lt;P&gt;The main.c of the master has preprocessor&amp;nbsp;&lt;/P&gt;&lt;P&gt;#define&amp;nbsp; SLAVE 0xF0&lt;/P&gt;&lt;P&gt;and its ConfigureI2CModule() function has&lt;/P&gt;&lt;P&gt;Iic.ibad.byte = 0xA0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;while the main.c of the slave has preprocessor&lt;/P&gt;&lt;P&gt;#define SLAVE 0x0A&lt;/P&gt;&lt;P&gt;and its ConfigureI2CModule() function has&amp;nbsp;&lt;/P&gt;&lt;P&gt;Iic.ibad.byte = 0xF0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the latter case(slave), shouldn't&amp;nbsp; &lt;STRONG&gt;#define SLAVE 0x0A&lt;/STRONG&gt; be &lt;STRONG&gt;#define SLAVE 0xA0&lt;/STRONG&gt;?&lt;/P&gt;&lt;P&gt;Or in the former case(master), shouldn't &lt;STRONG&gt;Iic.ibad.byte = 0xA0;&lt;/STRONG&gt; be &lt;STRONG&gt;Iic.ibad.byte = 0x0A;&lt;/STRONG&gt;?&lt;/P&gt;&lt;P&gt;Actually I tried both ways, but this didn't solve my problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looking forward to getting your help,&lt;/P&gt;&lt;P&gt;Jaeyun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 22 Mar 2009 10:07:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/I2C-Transmission-problem/m-p/165135#M5354</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2009-03-22T10:07:38Z</dc:date>
    </item>
  </channel>
</rss>

