<?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 MicrocontrollersのトピックRe: RS485 half duplex communication problem</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/RS485-half-duplex-communication-problem/m-p/640290#M38769</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just an update..&lt;/P&gt;&lt;P&gt;I've tried to disable all the exception transmissions from the board (because I've seen in the data I'm getting error packets, so I've figured I will only send correct packet when asked to), and now I'm getting the correct answer - but endlessly. Does it mean the tx fifo is always full? why is it?&lt;/P&gt;&lt;P&gt;I think this is a good start - but need some ideas...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It happens only when the other 'user' has been using the 24V of the board. As if the K64 has something wrong from this point forward.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 25 Apr 2017 18:26:21 GMT</pubDate>
    <dc:creator>roymessinger</dc:creator>
    <dc:date>2017-04-25T18:26:21Z</dc:date>
    <item>
      <title>RS485 half duplex communication problem</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/RS485-half-duplex-communication-problem/m-p/640289#M38768</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've asked a similar question &lt;A _jive_internal="true" href="https://community.nxp.com/thread/447085"&gt;before&lt;/A&gt;, and the result &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/mjbcswitzerland"&gt;mjbcswitzerland&lt;/A&gt;&amp;nbsp;has given me (and proved to be correct) was to replace the 2 resistors shown in the picture (R189=0, R188 not assembled):&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/14104i52D7DF31ACF359B4/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;My board is installed on a big machine with lots of other electronics/mechanics going on. I have 2 boards on the machine. Each board is getting 24V and using DC/DC transfers it to 3.3. On this 24V I have other 'users' also.&lt;/P&gt;&lt;P&gt;What I am experiencing is that in one of the boards, whenever a different user (on the same 24V main power line) is turned on, I'm getting an endless loop of tx enable, shown here:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="rs485_1.jpeg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/14418i0B2DEDD8E1852B28/image-size/large?v=v2&amp;amp;px=999" role="button" title="rs485_1.jpeg" alt="rs485_1.jpeg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="rs485_2.jpeg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/14376i95A52AE743799A40/image-size/large?v=v2&amp;amp;px=999" role="button" title="rs485_2.jpeg" alt="rs485_2.jpeg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I did not see any voltage spikes on the 3.3 of the K64 nor on the 24V when the other user is turned on. I'm using a USB to RS485 dongle which is not shielded (ready made product) - so I'm guessing an outside noise is coupled on this cable.&amp;nbsp;When it happens, even the slightest touch on this cable and it starts to show this tx enables, sometimes when I touch it it suddenly stops.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This goes forever, and obviously, the connection with the K64 is dead, until I power on it. Without turning On/Off this user, there is no problem with the connection.&lt;/P&gt;&lt;P&gt;The green line is the tx enable. The yellow line is the Rs485 transmission (A+)&lt;/P&gt;&lt;P&gt;a. Even if it is a noise problem, how come the K64 sends endless TX enable pulses ? I would have thought just a one time scenario, not all the time.&lt;/P&gt;&lt;P&gt;b. Any idea how to solve it? Maybe something with the RS485 termination resistors?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Apr 2017 13:03:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/RS485-half-duplex-communication-problem/m-p/640289#M38768</guid>
      <dc:creator>roymessinger</dc:creator>
      <dc:date>2017-04-25T13:03:49Z</dc:date>
    </item>
    <item>
      <title>Re: RS485 half duplex communication problem</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/RS485-half-duplex-communication-problem/m-p/640290#M38769</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just an update..&lt;/P&gt;&lt;P&gt;I've tried to disable all the exception transmissions from the board (because I've seen in the data I'm getting error packets, so I've figured I will only send correct packet when asked to), and now I'm getting the correct answer - but endlessly. Does it mean the tx fifo is always full? why is it?&lt;/P&gt;&lt;P&gt;I think this is a good start - but need some ideas...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It happens only when the other 'user' has been using the 24V of the board. As if the K64 has something wrong from this point forward.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Apr 2017 18:26:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/RS485-half-duplex-communication-problem/m-p/640290#M38769</guid>
      <dc:creator>roymessinger</dc:creator>
      <dc:date>2017-04-25T18:26:21Z</dc:date>
    </item>
    <item>
      <title>Re: RS485 half duplex communication problem</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/RS485-half-duplex-communication-problem/m-p/640291#M38770</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Roymessinger,&lt;/P&gt;&lt;P&gt;Frankly speaking, I do not know the background of your issue. From software, it seems that your code has issue:&lt;/P&gt;&lt;P&gt;void send_message_in_uart(unsigned char *query, unsigned char string_length)&lt;BR /&gt;{&lt;BR /&gt;while ((kUART_TxDataRegEmptyFlag &amp;amp; UART_GetStatusFlags(UART_CH_ACTIVE)))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UART_WriteBlocking(UART_CH_ACTIVE, query, string_length);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;while (!(UART1-&amp;gt;S1 &amp;amp; UART_S1_TC_MASK))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; __asm("NOP");&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;uint32_t UART_GetStatusFlags(UART_Type *base)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint32_t status_flag;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; status_flag = base-&amp;gt;S1 | ((uint32_t)(base-&amp;gt;S2) &amp;lt;&amp;lt; 8);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#if defined(FSL_FEATURE_UART_HAS_EXTENDED_DATA_REGISTER_FLAGS) &amp;amp;&amp;amp; FSL_FEATURE_UART_HAS_EXTENDED_DATA_REGISTER_FLAGS&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; status_flag |= ((uint32_t)(base-&amp;gt;ED) &amp;lt;&amp;lt; 16);&lt;BR /&gt;#endif&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#if defined(FSL_FEATURE_UART_HAS_FIFO) &amp;amp;&amp;amp; FSL_FEATURE_UART_HAS_FIFO&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; status_flag |= ((uint32_t)(base-&amp;gt;SFIFO) &amp;lt;&amp;lt; 24);&lt;BR /&gt;#endif&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return status_flag;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void UART_WriteBlocking(UART_Type *base, const uint8_t *data, size_t length)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* This API can only ensure that the data is written into the data buffer but can't&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ensure all data in the data buffer are sent into the transmit shift buffer. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (length--)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (!(base-&amp;gt;S1 &amp;amp; UART_S1_TDRE_MASK))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; base-&amp;gt;D = *(data++);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;The UART_WriteBlocking() function polls&amp;nbsp; the uart flag to transmit data, it is unnecessary to add the while ((kUART_TxDataRegEmptyFlag &amp;amp; UART_GetStatusFlags(UART_CH_ACTIVE))) line, how about delet it.&lt;/P&gt;&lt;P&gt;BTW, can you use different GPIO to the DE and /RE pin?&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>Tue, 02 May 2017 04:18:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/RS485-half-duplex-communication-problem/m-p/640291#M38770</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2017-05-02T04:18:14Z</dc:date>
    </item>
    <item>
      <title>Re: RS485 half duplex communication problem</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/RS485-half-duplex-communication-problem/m-p/640292#M38771</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;It seems EMI noise caused this issue. When I've replaced the communication cables to shielded (and replaced the usb dongle with PCI to RS485 board) the problem seemed to disappear. I do not understand how EMI noise can cause such issue (only toggling the DE line) but it does.&lt;/P&gt;&lt;P&gt;Nevertheless, regarding the While line, from your experience, can it also cause such issues?&lt;/P&gt;&lt;P&gt;I will try to delete it anyway.&lt;/P&gt;&lt;P&gt;I cannot use different GPIO as it is custom board and only UART1 is used.&lt;/P&gt;&lt;P&gt;Roy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 May 2017 06:19:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/RS485-half-duplex-communication-problem/m-p/640292#M38771</guid>
      <dc:creator>roymessinger</dc:creator>
      <dc:date>2017-05-02T06:19:28Z</dc:date>
    </item>
  </channel>
</rss>

