<?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: Chip_UART_ReadRB() Not Correctly Implemented? in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Chip-UART-ReadRB-Not-Correctly-Implemented/m-p/724677#M29303</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ken,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN&gt;Chip_UART_ReadRB()&amp;nbsp; is just used to read the buffer data which saved data in the interrupt ISR, Chip_UART_ReadRB()&amp;nbsp; is not the interrupt process function, if you are not sure it works, you also can save the data in the ISR directly by yourself.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Wish it helps you!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Kerry&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 Feb 2018 02:55:39 GMT</pubDate>
    <dc:creator>kerryzhou</dc:creator>
    <dc:date>2018-02-22T02:55:39Z</dc:date>
    <item>
      <title>Chip_UART_ReadRB() Not Correctly Implemented?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Chip-UART-ReadRB-Not-Correctly-Implemented/m-p/724674#M29300</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Has anyone successfully used the method&amp;nbsp;Chip_UART_ReadRB() as implemented in LPCOpen 2.1 in&amp;nbsp;uart_17xx_40xx.c? I ask because the code does not look complete. This is what&amp;nbsp;I see in the library source code:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;STRONG&gt;/* Copy data from a receive ring buffer */&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;int Chip_UART_ReadRB(LPC_USART_T *pUART, RINGBUFF_T *pRB, void *data, int bytes)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; (void) pUART;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; return RingBuffer_PopMult(pRB, (uint8_t *) data, bytes);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P&gt;Two things:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. The "(void)pUART;" does nothing&lt;/P&gt;&lt;P&gt;2. Interrupts should be getting disabled around the call to RingBuffer_PopMul()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Ken&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Feb 2018 23:15:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Chip-UART-ReadRB-Not-Correctly-Implemented/m-p/724674#M29300</guid>
      <dc:creator>kenatmicrolynx</dc:creator>
      <dc:date>2018-02-07T23:15:55Z</dc:date>
    </item>
    <item>
      <title>Re: Chip_UART_ReadRB() Not Correctly Implemented?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Chip-UART-ReadRB-Not-Correctly-Implemented/m-p/724675#M29301</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ken,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; I have test this API function on my EA LPC4088 board, it works.&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/4870iA5891ECD2DDFC40F/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;&amp;nbsp; You can find, when I use the serial assistant send the UART data to the LPC4088, the Chip_UART_ReadRB()&amp;nbsp; can get the data, and use the Chip_UART_SendRB send it back.&lt;/P&gt;&lt;P&gt;&amp;nbsp;About your two question:&lt;/P&gt;&lt;P&gt;1. The "(void)pUART;" does nothing&lt;/P&gt;&lt;P&gt;&amp;nbsp;Answer: Yes, it does nothing, but I think it used for the API format, just used for the good readability.It's the write habit. It won't influence the function, so you don't need to care about it.&lt;/P&gt;&lt;P&gt;2. Interrupts should be getting disabled around the call to RingBuffer_PopMul()&lt;/P&gt;&lt;P&gt;Answer: No, you don't need to disable the interrupt, actually, interrupt receive the data with rxring:&lt;/P&gt;&lt;P&gt;void HANDLER_NAME(void)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;/* Want to handle any errors? Do it here. */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;/* Use default ring buffer handler. Override this with your own&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; code if you need more capability. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Chip_UART_IRQRBHandler(UART_SELECTION, &amp;amp;rxring, &amp;amp;txring);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Then use the RingBuffer_PopMul copy the rxring data to the key like this:&lt;/P&gt;&lt;P&gt;bytes = Chip_UART_ReadRB(UART_SELECTION, &amp;amp;rxring, &amp;amp;key, 1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have test it, the function works OK, give you another test result, you can find I can use this API receive the data successfully.&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/4913i7A140A570725F1E0/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;BR /&gt;Have a great day,&lt;BR /&gt;Kerry&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 11 Feb 2018 07:17:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Chip-UART-ReadRB-Not-Correctly-Implemented/m-p/724675#M29301</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2018-02-11T07:17:42Z</dc:date>
    </item>
    <item>
      <title>Re: Chip_UART_ReadRB() Not Correctly Implemented?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Chip-UART-ReadRB-Not-Correctly-Implemented/m-p/724676#M29302</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kerry,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for taking the time to respond to this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With respect, I'm still not convinced that a &lt;SPAN&gt;Chip_UART_ReadRB() is interrupt safe. A&amp;nbsp;&lt;/SPAN&gt;simple keyboard typing test&amp;nbsp;wouldn't expose that kind of bug.&amp;nbsp;To expose this bug&amp;nbsp;the Rx data interrupt would have to firing very frequently while the main code is in&amp;nbsp;RingBuffer_PopMult() pulling data off the ring buffer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't have the bandwidth to write a test for this at the moment, maybe when I retire I will :smileyhappy:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ken&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Feb 2018 21:07:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Chip-UART-ReadRB-Not-Correctly-Implemented/m-p/724676#M29302</guid>
      <dc:creator>kenatmicrolynx</dc:creator>
      <dc:date>2018-02-15T21:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: Chip_UART_ReadRB() Not Correctly Implemented?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Chip-UART-ReadRB-Not-Correctly-Implemented/m-p/724677#M29303</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ken,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN&gt;Chip_UART_ReadRB()&amp;nbsp; is just used to read the buffer data which saved data in the interrupt ISR, Chip_UART_ReadRB()&amp;nbsp; is not the interrupt process function, if you are not sure it works, you also can save the data in the ISR directly by yourself.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Wish it helps you!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Kerry&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Feb 2018 02:55:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Chip-UART-ReadRB-Not-Correctly-Implemented/m-p/724677#M29303</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2018-02-22T02:55:39Z</dc:date>
    </item>
  </channel>
</rss>

