<?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: FRDM-K64F I2C API MasterTxComplete Callback Status 0x451 in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-K64F-I2C-API-MasterTxComplete-Callback-Status-0x451/m-p/833771#M50413</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks.&amp;nbsp; That confirms what I'm seeing with my logic analyzer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;IMG alt="pastedImage_1.png" src="https://community.nxp.com/t5/image/serverpage/image-id/67706i075756C81EB4D5F0/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_1.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What confuses me is why am I only seeing one byte transmitted, and not the three bytes that&amp;nbsp;I expected?&amp;nbsp; This is how I have the message to be sent defined:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&amp;nbsp; buf[3] = { 0x02, 0x80, 0x70 };&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My transfer is setup as so...I've added comments to show&amp;nbsp;the values I see when I single-step with the debugger:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&amp;nbsp; memset(&amp;amp;Info[i2c].handle, 0, sizeof(i2c_master_handle_t));
&amp;nbsp; memset(&amp;amp;Info[i2c].xfer, 0, sizeof(i2c_master_transfer_t));

&amp;nbsp; Info[i2c].xfer.slaveAddress = addr;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // 0x40
&amp;nbsp; Info[i2c].xfer.direction = kI2C_Write;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // 0x00
&amp;nbsp; Info[i2c].xfer.subaddress = (uint32_t)reg; // 0x04
&amp;nbsp; Info[i2c].xfer.subaddressSize = 1;
&amp;nbsp; Info[i2c].xfer.data = buf;&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; // address of { 0x02, 0x80, 0x70 }
&amp;nbsp; Info[i2c].xfer.dataSize = len;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // 0x03
&amp;nbsp; Info[i2c].xfer.flags = kI2C_TransferDefaultFlag;

&amp;nbsp; I2C_MasterTransferCreateHandle(Config[i2c].base, &amp;amp;Info[i2c].handle, MasterTxRxCallback, I2CU_Write);
&amp;nbsp; stat = I2C_MasterTransferNonBlocking(Config[i2c].base, &amp;amp;Info[i2c].handle, &amp;amp;Info[i2c].xfer);
&amp;nbsp; Info[i2c].inProgress = true;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My understanding of the `subaddress` is that it's supposed to be the register/command to the slave device.&amp;nbsp; If that's so, then I would expect the packet on the I2C bus to be something like `{ 0x40, 0x04, 0x80, 0x70 }`.&amp;nbsp; Is that not so?&amp;nbsp; Is there perhaps something with my transfer setup that I'm missing?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 02 Nov 2020 14:14:01 GMT</pubDate>
    <dc:creator>pcpro178</dc:creator>
    <dc:date>2020-11-02T14:14:01Z</dc:date>
    <item>
      <title>FRDM-K64F I2C API MasterTxComplete Callback Status 0x451</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-K64F-I2C-API-MasterTxComplete-Callback-Status-0x451/m-p/833769#M50411</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've implemented the I2C example from&amp;nbsp;i2c_interrupt_b2b_transfer_master.c in my application.&amp;nbsp; I've verified that the interrupt is firing and the callback is getting called.&amp;nbsp; However, a status of 0x451 is being passed to the callback.&amp;nbsp; What does that status code mean?&amp;nbsp; The way the example is written, it looks like a status code of zero should be expected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's my transmit code as implemented from the example.&amp;nbsp; Any help would be great.&amp;nbsp; Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;[REDACTED]&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Aug 2018 20:25:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-K64F-I2C-API-MasterTxComplete-Callback-Status-0x451/m-p/833769#M50411</guid>
      <dc:creator>pcpro178</dc:creator>
      <dc:date>2018-08-28T20:25:02Z</dc:date>
    </item>
    <item>
      <title>Re: FRDM-K64F I2C API MasterTxComplete Callback Status 0x451</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-K64F-I2C-API-MasterTxComplete-Callback-Status-0x451/m-p/833770#M50412</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Jim,&lt;/P&gt;&lt;P&gt;Regarding your question, this is the status defination for the function.&lt;/P&gt;&lt;PRE&gt;static void MasterTxRxCallback(I2C_Type *base, i2c_master_handle_t *handle, status_t status, void *userData)&lt;/PRE&gt;&lt;P&gt;//defined in fsl_common.h&lt;/P&gt;&lt;P&gt;#define MAKE_STATUS(group, code) ((((group)*100) + (code)))&amp;nbsp; &lt;/P&gt;&lt;P&gt;//defined in fsl_i2c.h&lt;/P&gt;&lt;P&gt;//kStatusGroup_I2C is 11&lt;/P&gt;&lt;P&gt;enum _i2c_status //&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; kStatus_I2C_Busy = MAKE_STATUS(kStatusGroup_I2C, 0),&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*!&amp;lt; I2C is busy with current transfer. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; kStatus_I2C_Idle = MAKE_STATUS(kStatusGroup_I2C, 1),&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*!&amp;lt; Bus is Idle. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; kStatus_I2C_Nak = MAKE_STATUS(kStatusGroup_I2C, 2),&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;lt; NAK received during transfer. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; kStatus_I2C_ArbitrationLost = MAKE_STATUS(kStatusGroup_I2C, 3), /*!&amp;lt; Arbitration lost during transfer. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; kStatus_I2C_Timeout = MAKE_STATUS(kStatusGroup_I2C, 4),&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*!&amp;lt; Wait event timeout. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; kStatus_I2C_Addr_Nak = MAKE_STATUS(kStatusGroup_I2C, 5),&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*!&amp;lt; NAK received during the address probe. */&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Obviously, if the status value is 0x451, 1105 in decimal, it is kStatus_I2C_Addr_Nak&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope it can help you&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Xiangjun Rong&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Aug 2018 03:35:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-K64F-I2C-API-MasterTxComplete-Callback-Status-0x451/m-p/833770#M50412</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2018-08-29T03:35:50Z</dc:date>
    </item>
    <item>
      <title>Re: FRDM-K64F I2C API MasterTxComplete Callback Status 0x451</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-K64F-I2C-API-MasterTxComplete-Callback-Status-0x451/m-p/833771#M50413</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks.&amp;nbsp; That confirms what I'm seeing with my logic analyzer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;IMG alt="pastedImage_1.png" src="https://community.nxp.com/t5/image/serverpage/image-id/67706i075756C81EB4D5F0/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_1.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What confuses me is why am I only seeing one byte transmitted, and not the three bytes that&amp;nbsp;I expected?&amp;nbsp; This is how I have the message to be sent defined:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&amp;nbsp; buf[3] = { 0x02, 0x80, 0x70 };&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My transfer is setup as so...I've added comments to show&amp;nbsp;the values I see when I single-step with the debugger:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&amp;nbsp; memset(&amp;amp;Info[i2c].handle, 0, sizeof(i2c_master_handle_t));
&amp;nbsp; memset(&amp;amp;Info[i2c].xfer, 0, sizeof(i2c_master_transfer_t));

&amp;nbsp; Info[i2c].xfer.slaveAddress = addr;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // 0x40
&amp;nbsp; Info[i2c].xfer.direction = kI2C_Write;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // 0x00
&amp;nbsp; Info[i2c].xfer.subaddress = (uint32_t)reg; // 0x04
&amp;nbsp; Info[i2c].xfer.subaddressSize = 1;
&amp;nbsp; Info[i2c].xfer.data = buf;&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; // address of { 0x02, 0x80, 0x70 }
&amp;nbsp; Info[i2c].xfer.dataSize = len;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // 0x03
&amp;nbsp; Info[i2c].xfer.flags = kI2C_TransferDefaultFlag;

&amp;nbsp; I2C_MasterTransferCreateHandle(Config[i2c].base, &amp;amp;Info[i2c].handle, MasterTxRxCallback, I2CU_Write);
&amp;nbsp; stat = I2C_MasterTransferNonBlocking(Config[i2c].base, &amp;amp;Info[i2c].handle, &amp;amp;Info[i2c].xfer);
&amp;nbsp; Info[i2c].inProgress = true;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My understanding of the `subaddress` is that it's supposed to be the register/command to the slave device.&amp;nbsp; If that's so, then I would expect the packet on the I2C bus to be something like `{ 0x40, 0x04, 0x80, 0x70 }`.&amp;nbsp; Is that not so?&amp;nbsp; Is there perhaps something with my transfer setup that I'm missing?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Nov 2020 14:14:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-K64F-I2C-API-MasterTxComplete-Callback-Status-0x451/m-p/833771#M50413</guid>
      <dc:creator>pcpro178</dc:creator>
      <dc:date>2020-11-02T14:14:01Z</dc:date>
    </item>
    <item>
      <title>Re: FRDM-K64F I2C API MasterTxComplete Callback Status 0x451</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-K64F-I2C-API-MasterTxComplete-Callback-Status-0x451/m-p/833772#M50414</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Okay, I got it to acknowledge messages by shifting my address byte right 1 bit for 7-bit addressing, so my address and register bytes are looking good.&amp;nbsp; However, the payload is still clearly incorrect.&amp;nbsp; The payload should be only 2 bytes: `{ 0x80, 0x70 }`.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/67799i58F5F6738FDF008D/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;UPDATE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The issue has been resolved.&amp;nbsp; The&amp;nbsp;payload contents were being overwritten, before the I2C module could transmit, due to a race condition..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Aug 2018 15:52:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-K64F-I2C-API-MasterTxComplete-Callback-Status-0x451/m-p/833772#M50414</guid>
      <dc:creator>pcpro178</dc:creator>
      <dc:date>2018-08-29T15:52:40Z</dc:date>
    </item>
  </channel>
</rss>

