<?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 MQX_FILE_PTR  IO stream for UART communication, mqx_file struct not accessable! in MQX Software Solutions</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-FILE-PTR-IO-stream-for-UART-communication-mqx-file-struct/m-p/654065#M17250</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey guys, I am currently working with a Kinetis K70 processor which should communicate over UART5 with a Bluetooth Module. I use the IO serial port ittyf:&amp;nbsp; to regulate the UART. My communication works fine, i can send commands in blocking mode and the Bluetooth Module responds. Now I'm having trouble in receiving the response and buffering them since I have different commands for the Bluetooth Module and corresponding responses. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My code is set up as follows:&lt;/P&gt;&lt;P&gt;for the init:&lt;/P&gt;&lt;P&gt;static MQX_FILE_PTR p_bluetooth;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;p_bluetooth = fopen(STRK_BLUETOOTH_SERIAL_PORT, (char *)(IO_SERIAL_RAW_IO));&lt;BR /&gt;ioctl(p_bluetooth, IO_IOCTL_SERIAL_SET_FLAGS, IO_SERIAL_RAW_IO);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can send commands in blocking mode with while the RX is disabled:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;char *command = cmd_buffer; // cmd_buffer contains the bluetooth command&lt;/P&gt;&lt;P&gt;fwrite(command , 1, strlen(command), p_bluetooth);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Afterwards RX is enabled:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My problem now is that the bluetooth module can respond with different strings of different length:&lt;/P&gt;&lt;P&gt;for the fread function I have to now how much characters exactly are in the p_bluetooth&amp;nbsp; filepointer&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(Here an example for the first 10 characters, which works fine)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fflush(p_bluetooth);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; char output_buffer[100];&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// read first 10 char into ouput_buffer&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;fread(output_buffer, 1, 10, p_bluetooth);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;For acessing the ungot_characters in the Filestream I tryed to acces the struct of MQX_FILE liike:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;p_bluetooth-&amp;gt;SIZE&lt;/P&gt;&lt;P&gt;p_bluetooth-&amp;gt;LOCATION&lt;/P&gt;&lt;P&gt;p_bluetooth-&amp;gt;UNGOT_CHARACTERS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally thoes values reamind zero all time even though I send and receive chars. I also can read and write to the file_ptr but nothing changes. I just want to now the number of chars in my p_bluetooth MQX_FILE_PTR which were not read but it seems there is no way to get that number. It seems that the mqx_file struct is not updated at all.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did I miss something when I initialized it? I would be very glad for any help and advice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fabian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 Apr 2017 12:21:55 GMT</pubDate>
    <dc:creator>chelios</dc:creator>
    <dc:date>2017-04-06T12:21:55Z</dc:date>
    <item>
      <title>MQX_FILE_PTR  IO stream for UART communication, mqx_file struct not accessable!</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-FILE-PTR-IO-stream-for-UART-communication-mqx-file-struct/m-p/654065#M17250</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey guys, I am currently working with a Kinetis K70 processor which should communicate over UART5 with a Bluetooth Module. I use the IO serial port ittyf:&amp;nbsp; to regulate the UART. My communication works fine, i can send commands in blocking mode and the Bluetooth Module responds. Now I'm having trouble in receiving the response and buffering them since I have different commands for the Bluetooth Module and corresponding responses. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My code is set up as follows:&lt;/P&gt;&lt;P&gt;for the init:&lt;/P&gt;&lt;P&gt;static MQX_FILE_PTR p_bluetooth;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;p_bluetooth = fopen(STRK_BLUETOOTH_SERIAL_PORT, (char *)(IO_SERIAL_RAW_IO));&lt;BR /&gt;ioctl(p_bluetooth, IO_IOCTL_SERIAL_SET_FLAGS, IO_SERIAL_RAW_IO);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can send commands in blocking mode with while the RX is disabled:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;char *command = cmd_buffer; // cmd_buffer contains the bluetooth command&lt;/P&gt;&lt;P&gt;fwrite(command , 1, strlen(command), p_bluetooth);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Afterwards RX is enabled:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My problem now is that the bluetooth module can respond with different strings of different length:&lt;/P&gt;&lt;P&gt;for the fread function I have to now how much characters exactly are in the p_bluetooth&amp;nbsp; filepointer&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(Here an example for the first 10 characters, which works fine)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fflush(p_bluetooth);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; char output_buffer[100];&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// read first 10 char into ouput_buffer&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;fread(output_buffer, 1, 10, p_bluetooth);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;For acessing the ungot_characters in the Filestream I tryed to acces the struct of MQX_FILE liike:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;p_bluetooth-&amp;gt;SIZE&lt;/P&gt;&lt;P&gt;p_bluetooth-&amp;gt;LOCATION&lt;/P&gt;&lt;P&gt;p_bluetooth-&amp;gt;UNGOT_CHARACTERS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally thoes values reamind zero all time even though I send and receive chars. I also can read and write to the file_ptr but nothing changes. I just want to now the number of chars in my p_bluetooth MQX_FILE_PTR which were not read but it seems there is no way to get that number. It seems that the mqx_file struct is not updated at all.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did I miss something when I initialized it? I would be very glad for any help and advice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fabian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Apr 2017 12:21:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-FILE-PTR-IO-stream-for-UART-communication-mqx-file-struct/m-p/654065#M17250</guid>
      <dc:creator>chelios</dc:creator>
      <dc:date>2017-04-06T12:21:55Z</dc:date>
    </item>
    <item>
      <title>Re: MQX_FILE_PTR  IO stream for UART communication, mqx_file struct not accessable!</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-FILE-PTR-IO-stream-for-UART-communication-mqx-file-struct/m-p/654066#M17251</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Fibian:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I found one bug fix may be related to your issue.&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/14690i931C2F39402F0345/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;This fix is release in MQX 4.2.0 (May 2015). What version you are using?&amp;nbsp; if it is an older version, I would suggest you update to the MQX 4.2.0 with patch 4.2.0.2 and try again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Apr 2017 08:13:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-FILE-PTR-IO-stream-for-UART-communication-mqx-file-struct/m-p/654066#M17251</guid>
      <dc:creator>danielchen</dc:creator>
      <dc:date>2017-04-25T08:13:47Z</dc:date>
    </item>
  </channel>
</rss>

