<?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 Uart stability problem in Kinetis Software Development Kit</title>
    <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Uart-stability-problem/m-p/459806#M3376</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;I have a brushless DC motor with an appropriate driver (TMCM1640). My K64F communicates via a RS485 transceiver (Artekit RS485/HD) with the RS485 interface of that driver. I am using the uart_nonblocking example code from the KDS library to send data. Uart is configured with the RTS flow control like so:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;UART_DRV_Init(UART_INSTANCE_2, &amp;amp;uartState2, &amp;amp;uartConfig); UART_HAL_SetTransmitterRtsCmd(UART2_BASE_PTR, true); UART_HAL_SetTransmitterRtsPolarityMode(UART2_BASE_PTR,true);&lt;/P&gt;&lt;P&gt;(and some other lines...)&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the main loop I use&lt;/P&gt;&lt;P&gt;UART_DRV_SendData(UART_INSTANCE_2, &amp;amp;setTargetCurrentZeroCom , 9u);&lt;/P&gt;&lt;P&gt;while (kStatus_UART_TxBusy == UART_DRV_GetTransmitStatus(UART_INSTANCE_2, NULL)){}&lt;/P&gt;&lt;P&gt;UART_DRV_ReceiveData(UART_INSTANCE_2, &amp;amp;rxChar, 9u);&lt;/P&gt;&lt;P&gt;while (kStatus_UART_RxBusy == UART_DRV_GetReceiveStatus(UART_INSTANCE_2, NULL)){}&lt;/P&gt;&lt;P&gt;to send a 9 byte command and then receive the 9 byte answer from the module. I have two problems with that and maybe this forum can answer them. I get the information, who sends what vie oscilloscope, btw.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) The command and answer loop goes on a certain amount of times at the 9600 or 115200 Baudrate for example, then it stops. Can be a few commands to a couple of hundreds. But after a while the module sends an answer and the mcu does not get it. &lt;SPAN style="font-family: FreeSans;"&gt;&lt;SPAN lang="hi-IN"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Because of the while loops in the main loop the code gets stuck and I see the error --&amp;gt; wait forever to receive. Why would it work for a few times and then stop?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What other information would you need to be able to give advice? Am I missing something simple here?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;best regards,&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 28 May 2016 12:19:01 GMT</pubDate>
    <dc:creator>michaelkoller</dc:creator>
    <dc:date>2016-05-28T12:19:01Z</dc:date>
    <item>
      <title>Uart stability problem</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Uart-stability-problem/m-p/459806#M3376</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;I have a brushless DC motor with an appropriate driver (TMCM1640). My K64F communicates via a RS485 transceiver (Artekit RS485/HD) with the RS485 interface of that driver. I am using the uart_nonblocking example code from the KDS library to send data. Uart is configured with the RTS flow control like so:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;UART_DRV_Init(UART_INSTANCE_2, &amp;amp;uartState2, &amp;amp;uartConfig); UART_HAL_SetTransmitterRtsCmd(UART2_BASE_PTR, true); UART_HAL_SetTransmitterRtsPolarityMode(UART2_BASE_PTR,true);&lt;/P&gt;&lt;P&gt;(and some other lines...)&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the main loop I use&lt;/P&gt;&lt;P&gt;UART_DRV_SendData(UART_INSTANCE_2, &amp;amp;setTargetCurrentZeroCom , 9u);&lt;/P&gt;&lt;P&gt;while (kStatus_UART_TxBusy == UART_DRV_GetTransmitStatus(UART_INSTANCE_2, NULL)){}&lt;/P&gt;&lt;P&gt;UART_DRV_ReceiveData(UART_INSTANCE_2, &amp;amp;rxChar, 9u);&lt;/P&gt;&lt;P&gt;while (kStatus_UART_RxBusy == UART_DRV_GetReceiveStatus(UART_INSTANCE_2, NULL)){}&lt;/P&gt;&lt;P&gt;to send a 9 byte command and then receive the 9 byte answer from the module. I have two problems with that and maybe this forum can answer them. I get the information, who sends what vie oscilloscope, btw.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) The command and answer loop goes on a certain amount of times at the 9600 or 115200 Baudrate for example, then it stops. Can be a few commands to a couple of hundreds. But after a while the module sends an answer and the mcu does not get it. &lt;SPAN style="font-family: FreeSans;"&gt;&lt;SPAN lang="hi-IN"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Because of the while loops in the main loop the code gets stuck and I see the error --&amp;gt; wait forever to receive. Why would it work for a few times and then stop?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What other information would you need to be able to give advice? Am I missing something simple here?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;best regards,&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 May 2016 12:19:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Uart-stability-problem/m-p/459806#M3376</guid>
      <dc:creator>michaelkoller</dc:creator>
      <dc:date>2016-05-28T12:19:01Z</dc:date>
    </item>
    <item>
      <title>Re: Uart stability problem</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Uart-stability-problem/m-p/459807#M3377</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, again!&lt;/P&gt;&lt;P&gt;I have to admit, that I don't know why, but now the following behaviour is now observable:&lt;/P&gt;&lt;P&gt;Every time the program on the mcu is started, there is a command and an answer back exactly 88 times. Then it stops. Every time. Is there a counter I don't know about?&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 May 2016 13:33:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Uart-stability-problem/m-p/459807#M3377</guid>
      <dc:creator>michaelkoller</dc:creator>
      <dc:date>2016-05-28T13:33:39Z</dc:date>
    </item>
    <item>
      <title>Re: Uart stability problem</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Uart-stability-problem/m-p/459808#M3378</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Michael,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am sorry for the delay, have you solved your problem? Regarding your issue, as far as I know, RS485 uses multiple slave/one master protocol. If you use uart_nonblocking methos based on KSDK2.0, pls refer to the example:&lt;/P&gt;&lt;P&gt;C:\SDK2.0_K64F\boards\frdmk64f\driver_examples\uart&lt;/P&gt;&lt;P&gt;especially, the example.&lt;/P&gt;&lt;P&gt;C:\SDK2.0_K64F\boards\frdmk64f\driver_examples\uart\interrupt_transfer\kds&lt;/P&gt;&lt;P&gt;In the example, the basic concept is that you call the UART_TransferSendNonBlocking(), when all the predefined number of bytes has been transferred, the callback() function is called.&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>Thu, 23 Jun 2016 09:56:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Uart-stability-problem/m-p/459808#M3378</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2016-06-23T09:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: Uart stability problem</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Uart-stability-problem/m-p/459809#M3379</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello! Sorry to answer so late. Yes I have solved the problem. After correctly configuring the physical setup, it works nicely. Thanks for the suggestion!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jul 2016 12:59:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Uart-stability-problem/m-p/459809#M3379</guid>
      <dc:creator>michaelkoller</dc:creator>
      <dc:date>2016-07-25T12:59:52Z</dc:date>
    </item>
  </channel>
</rss>

