<?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>Kinetis Design Studio中的主题 Printf in event.c causes probles</title>
    <link>https://community.nxp.com/t5/Kinetis-Design-Studio/Printf-in-event-c-causes-probles/m-p/655585#M8588</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;using chip set mk22fx512vlk12&lt;/P&gt;&lt;P&gt;in even.c ...&lt;/P&gt;&lt;P&gt;void I2C_OnMasterBlockSent(LDD_TUserData *UserDataPtr)&lt;BR /&gt;{&lt;BR /&gt; /* Write your code here ... */&lt;BR /&gt; /* Set DataTransmittedFlg flag */&lt;BR /&gt; appData.DataTransmittedFlg = TRUE;&lt;BR /&gt; printf("Event I2C Block Sent\n\r");&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;/*&lt;BR /&gt;** ===================================================================&lt;BR /&gt;** Event : I2C_OnMasterBlockReceived (module Events)&lt;BR /&gt;**&lt;BR /&gt;** Component : I2C [I2C_LDD]&lt;BR /&gt;*/&lt;BR /&gt;/*!&lt;BR /&gt;** @brief&lt;BR /&gt;** This event is called when I2C is in master mode and finishes&lt;BR /&gt;** the reception of the data successfully. This event is not&lt;BR /&gt;** available for the SLAVE mode and if MasterReceiveBlock is&lt;BR /&gt;** disabled.&lt;BR /&gt;** @param&lt;BR /&gt;** UserDataPtr - Pointer to the user or&lt;BR /&gt;** RTOS specific data. This pointer is passed&lt;BR /&gt;** as the parameter of Init method.&lt;BR /&gt;*/&lt;BR /&gt;/* ===================================================================*/&lt;/P&gt;&lt;P&gt;void I2C_OnMasterBlockReceived(LDD_TUserData *UserDataPtr)&lt;BR /&gt;{&lt;BR /&gt; /* Write your code here ... */&lt;BR /&gt; /* Set DataReceivedFlg flag */&lt;BR /&gt; appData.DataReceivedFlg = TRUE;&lt;BR /&gt; //printf("Event I2C Block Received\n\r");&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Notice the two printf lines. I can have both statements print&amp;nbsp;&lt;/P&gt;&lt;P&gt;when I comment out the printf in&amp;nbsp;&lt;SPAN&gt;I2C_OnMasterBlockSend this event never asserts.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;the code gets stuck in the first I2C write event.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt; do&lt;BR /&gt; {&lt;BR /&gt; appData.Error = I2C_MasterSendBlock(appData.I2C_Ptr, &amp;amp;data, 1U,LDD_I2C_SEND_STOP);&lt;BR /&gt; while (!appData.DataTransmittedFlg){}&lt;BR /&gt; appData.DataTransmittedFlg = FALSE; &amp;nbsp; &amp;nbsp;///CODE REMAINS HEAR.&lt;BR /&gt; if (appData.Error != 0)&lt;BR /&gt; {&lt;BR /&gt; printf("I2C write during read error %d\r\n", appData.Error);&lt;BR /&gt; //cpu_delay_ms(1);&lt;BR /&gt; }&lt;BR /&gt; } while (appData.Error != 0);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;when I put it back in it works fine.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;how can I remove these printf calls and still have my code work?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Mar 2017 19:42:49 GMT</pubDate>
    <dc:creator>jacewalton</dc:creator>
    <dc:date>2017-03-15T19:42:49Z</dc:date>
    <item>
      <title>Printf in event.c causes probles</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/Printf-in-event-c-causes-probles/m-p/655585#M8588</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;using chip set mk22fx512vlk12&lt;/P&gt;&lt;P&gt;in even.c ...&lt;/P&gt;&lt;P&gt;void I2C_OnMasterBlockSent(LDD_TUserData *UserDataPtr)&lt;BR /&gt;{&lt;BR /&gt; /* Write your code here ... */&lt;BR /&gt; /* Set DataTransmittedFlg flag */&lt;BR /&gt; appData.DataTransmittedFlg = TRUE;&lt;BR /&gt; printf("Event I2C Block Sent\n\r");&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;/*&lt;BR /&gt;** ===================================================================&lt;BR /&gt;** Event : I2C_OnMasterBlockReceived (module Events)&lt;BR /&gt;**&lt;BR /&gt;** Component : I2C [I2C_LDD]&lt;BR /&gt;*/&lt;BR /&gt;/*!&lt;BR /&gt;** @brief&lt;BR /&gt;** This event is called when I2C is in master mode and finishes&lt;BR /&gt;** the reception of the data successfully. This event is not&lt;BR /&gt;** available for the SLAVE mode and if MasterReceiveBlock is&lt;BR /&gt;** disabled.&lt;BR /&gt;** @param&lt;BR /&gt;** UserDataPtr - Pointer to the user or&lt;BR /&gt;** RTOS specific data. This pointer is passed&lt;BR /&gt;** as the parameter of Init method.&lt;BR /&gt;*/&lt;BR /&gt;/* ===================================================================*/&lt;/P&gt;&lt;P&gt;void I2C_OnMasterBlockReceived(LDD_TUserData *UserDataPtr)&lt;BR /&gt;{&lt;BR /&gt; /* Write your code here ... */&lt;BR /&gt; /* Set DataReceivedFlg flag */&lt;BR /&gt; appData.DataReceivedFlg = TRUE;&lt;BR /&gt; //printf("Event I2C Block Received\n\r");&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Notice the two printf lines. I can have both statements print&amp;nbsp;&lt;/P&gt;&lt;P&gt;when I comment out the printf in&amp;nbsp;&lt;SPAN&gt;I2C_OnMasterBlockSend this event never asserts.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;the code gets stuck in the first I2C write event.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt; do&lt;BR /&gt; {&lt;BR /&gt; appData.Error = I2C_MasterSendBlock(appData.I2C_Ptr, &amp;amp;data, 1U,LDD_I2C_SEND_STOP);&lt;BR /&gt; while (!appData.DataTransmittedFlg){}&lt;BR /&gt; appData.DataTransmittedFlg = FALSE; &amp;nbsp; &amp;nbsp;///CODE REMAINS HEAR.&lt;BR /&gt; if (appData.Error != 0)&lt;BR /&gt; {&lt;BR /&gt; printf("I2C write during read error %d\r\n", appData.Error);&lt;BR /&gt; //cpu_delay_ms(1);&lt;BR /&gt; }&lt;BR /&gt; } while (appData.Error != 0);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;when I put it back in it works fine.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;how can I remove these printf calls and still have my code work?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Mar 2017 19:42:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/Printf-in-event-c-causes-probles/m-p/655585#M8588</guid>
      <dc:creator>jacewalton</dc:creator>
      <dc:date>2017-03-15T19:42:49Z</dc:date>
    </item>
    <item>
      <title>Re: Printf in event.c causes probles</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/Printf-in-event-c-causes-probles/m-p/655586#M8589</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Jace,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The "printf" shouldn't impact the project .&lt;/P&gt;&lt;P&gt;I recommend you first refer to the demo code under "Help on component ":&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/15527iBAD8DF331F2F3702/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&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/15509i586B8E9896974841/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;Hope it helps&lt;/P&gt;&lt;P&gt;Alice&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Mar 2017 03:03:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/Printf-in-event-c-causes-probles/m-p/655586#M8589</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2017-03-16T03:03:14Z</dc:date>
    </item>
  </channel>
</rss>

