<?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>CodeWarrior for MCUのトピックInitializing MAX11068 with MC9S12DG256CFU - Processor Expert - I2C Bean</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Initializing-MAX11068-with-MC9S12DG256CFU-Processor-Expert-I2C/m-p/203221#M7707</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using Codewarrior version 5.9.0 and Processor Expert Version 3.02 to program an MC9S12DG256CFU to control the MAX11068 battery monitoring chip.&amp;nbsp; I have never used I2C before and I have limited experience working with these microcontrollers.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to use the I2C functions provided by the processer expert bean, but I am having trouble intializing the MAX11068.&amp;nbsp; I assume the connections are correct because the I2C functions are returning 0x00 for there error code.&amp;nbsp; Page 58 of the MAX11068 outlines the two initialization sequences I am working on called "HELLOALL" and "ROLLCALL".&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Issues:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. With the HELLOALL command all I need to do is send one byte on the data line for the devices to start assigning themselves addresses.&amp;nbsp; Here is the basic code I am using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; helloByte=0xE0;&amp;nbsp;&amp;nbsp; //This is the command Byte that assigns the first device address&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; error[0] = EI2C1_SelectSlave(helloByte);&lt;/EM&gt;&amp;nbsp; //There is no slave address yet, so assigning command byte.&lt;BR /&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; error[0] = EI2C1_SendChar(0x00);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; error[0] = EI2C1_SendStop();&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I received an acknowledge, but I am not sure this code is working because I send that zero byte.&amp;nbsp; Is there any way to just send the command byte?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. With the ROLLCALL command I need to be able to perform a restart to change the master from transmitting to receiving..&amp;nbsp; There doesn't seem to be anyway of doing this, so I have been trying to just set the RSTA bit of the IBCR register myself.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; error[0]=EI2C1_SelectSlave(BRDADDRW); //Broadcast set to write&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; error[0]=EI2C1_SendChar(0x01);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Command For Device Address Register&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IBCR &amp;amp;= ~0x0C;&amp;nbsp;&amp;nbsp; //~00001100 = 11110011 //Set Restart and Auto Ack&lt;BR /&gt;&amp;nbsp;&amp;nbsp; error[0]=EI2C1_RecvBlock(all_addresses,2,rec);&amp;nbsp; //I only have one device connected so only 2 bytes should be received&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there anyway to perform a restart with the Processor Expert functions?&amp;nbsp; Other than setting the restart bit should I be setting any other bits or will the Bean functions handle the rest? &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 06 Feb 2012 23:05:37 GMT</pubDate>
    <dc:creator>chill23</dc:creator>
    <dc:date>2012-02-06T23:05:37Z</dc:date>
    <item>
      <title>Initializing MAX11068 with MC9S12DG256CFU - Processor Expert - I2C Bean</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Initializing-MAX11068-with-MC9S12DG256CFU-Processor-Expert-I2C/m-p/203221#M7707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using Codewarrior version 5.9.0 and Processor Expert Version 3.02 to program an MC9S12DG256CFU to control the MAX11068 battery monitoring chip.&amp;nbsp; I have never used I2C before and I have limited experience working with these microcontrollers.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to use the I2C functions provided by the processer expert bean, but I am having trouble intializing the MAX11068.&amp;nbsp; I assume the connections are correct because the I2C functions are returning 0x00 for there error code.&amp;nbsp; Page 58 of the MAX11068 outlines the two initialization sequences I am working on called "HELLOALL" and "ROLLCALL".&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Issues:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. With the HELLOALL command all I need to do is send one byte on the data line for the devices to start assigning themselves addresses.&amp;nbsp; Here is the basic code I am using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; helloByte=0xE0;&amp;nbsp;&amp;nbsp; //This is the command Byte that assigns the first device address&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; error[0] = EI2C1_SelectSlave(helloByte);&lt;/EM&gt;&amp;nbsp; //There is no slave address yet, so assigning command byte.&lt;BR /&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; error[0] = EI2C1_SendChar(0x00);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; error[0] = EI2C1_SendStop();&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I received an acknowledge, but I am not sure this code is working because I send that zero byte.&amp;nbsp; Is there any way to just send the command byte?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. With the ROLLCALL command I need to be able to perform a restart to change the master from transmitting to receiving..&amp;nbsp; There doesn't seem to be anyway of doing this, so I have been trying to just set the RSTA bit of the IBCR register myself.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; error[0]=EI2C1_SelectSlave(BRDADDRW); //Broadcast set to write&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; error[0]=EI2C1_SendChar(0x01);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Command For Device Address Register&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IBCR &amp;amp;= ~0x0C;&amp;nbsp;&amp;nbsp; //~00001100 = 11110011 //Set Restart and Auto Ack&lt;BR /&gt;&amp;nbsp;&amp;nbsp; error[0]=EI2C1_RecvBlock(all_addresses,2,rec);&amp;nbsp; //I only have one device connected so only 2 bytes should be received&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there anyway to perform a restart with the Processor Expert functions?&amp;nbsp; Other than setting the restart bit should I be setting any other bits or will the Bean functions handle the rest? &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 23:05:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Initializing-MAX11068-with-MC9S12DG256CFU-Processor-Expert-I2C/m-p/203221#M7707</guid>
      <dc:creator>chill23</dc:creator>
      <dc:date>2012-02-06T23:05:37Z</dc:date>
    </item>
    <item>
      <title>Re: Initializing MAX11068 with MC9S12DG256CFU - Processor Expert - I2C Bean</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Initializing-MAX11068-with-MC9S12DG256CFU-Processor-Expert-I2C/m-p/203222#M7708</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;1 - There is no capablity to send only command byte in the InternalI2C component.&lt;/P&gt;&lt;P&gt;2 - Restart is performed within "RecvBlock" method in case "Automatic stop condition" is set to "no". For more details please see the code of this method:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if(IBCR_MS_SL) {&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Is device in master mode? */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IBCR_RSTA = 1U;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* If yes then repeat start cycle generated */&lt;BR /&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;best regards&lt;BR /&gt;Vojtech Filip&lt;BR /&gt;Processor Expert Support Team&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Feb 2012 18:07:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Initializing-MAX11068-with-MC9S12DG256CFU-Processor-Expert-I2C/m-p/203222#M7708</guid>
      <dc:creator>ProcessorExpert</dc:creator>
      <dc:date>2012-02-07T18:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: Initializing MAX11068 with MC9S12DG256CFU - Processor Expert - I2C Bean</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Initializing-MAX11068-with-MC9S12DG256CFU-Processor-Expert-I2C/m-p/203223#M7709</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have viewed the processor expert code, but it does not use the defined registers.&amp;nbsp; It simply accesses the data and clock pins directly.&amp;nbsp; Also, I have determined I won't be able to use the receive command because I need to be able to send the address of the slave and then send the address of the register I want to read.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So with that determined, I wrote code using the methods outlined in AN3291.pdf.&amp;nbsp;&amp;nbsp; In my configuration the microcontroller will always be the master.&amp;nbsp; The code seems to be working and I can read and write from the device some of the time.&amp;nbsp; The problem is that the microcontroller loses arbitration most of the time and the program hangs in either a loop looking for the interrupt flag or a loop waiting for the RXAK bit to be set.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think there are two problems occuring, one: the bus frequency isn't optimal and two: on-reset of the microcontroller the bus is hanging.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Can someone explain to me which i2c values listed on page 5 of the Maxim11068 datasheet correspond to the table&amp;nbsp; in the S12IICV2.pdf?&amp;nbsp; The internal bus clock of the microcontroller is set to 24MHz and the max speed of the MAXIM chip is 200kHz. so I know I need a divider of 120 or greater.&amp;nbsp; I am not sure how to compare the other values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Again, all of my code is written according to the an3291.pdf polling method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Feb 2012 14:21:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Initializing-MAX11068-with-MC9S12DG256CFU-Processor-Expert-I2C/m-p/203223#M7709</guid>
      <dc:creator>chill23</dc:creator>
      <dc:date>2012-02-17T14:21:21Z</dc:date>
    </item>
  </channel>
</rss>

