<?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: Buffered and Non-buffered uart ioctl in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Buffered-and-Non-buffered-uart-ioctl/m-p/1553851#M15803</link>
    <description>Hi,
Q1)When reading uart in buffered mode and using ioctl(SCI0, SCI_GET_RX_CHARS_READY, NULL) to determine how many chars are in read buffer, the ioctl always returns 1 (even when there is no input).  Why?
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;pls check the body of api function  ioctl(SCI0, SCI_GET_RX_CHARS_READY, NULL), and check how the driver code to read data from receiver register to the buffer.

(2) When reading uart in non-buffered mode, there appears to be no ioctl call to determine if a char is in the read data register. There appears to be no way to determine if a char has been received. Am I wrong?
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;Can you tell us the DSC part number?  Anyway, I suppose that you use interrupt mode, as you know that there is FIFO for the SCI receiver, in the ISR of receiver, you can check the QSCI Control Register 2 (QSCIx_CTRL2), the QSCIx_CTRL2[RFCNT] bits represent the number of bytes the SCI has received. You can check the bits in ISR and read the data from FIFO.
Hope it can help you
BR
XiangJun Rong

10–8
RFCNT
Receive FIFO Count
These read only bits show how many words are used in the RX FIFO. As words are received,
CTRL2[RFCNT] is incremented. As words are read from DATA the value of CTRL2[RFCNT] decrements.
There is one word time to read DATA between when STAT[RDRF] is set (interrupt asserted), due to the
RX FIFO being full, and when an overflow condition is flagged.
000 0 words in RX FIFO
001 1 word in RX FIFO
010 2 words in RX FIFO
011 3 words in RX FIFO
100 4 words in RX FIFO
101 Reserved
110 Reserved
111 Reserved</description>
    <pubDate>Tue, 15 Nov 2022 08:37:18 GMT</pubDate>
    <dc:creator>xiangjun_rong</dc:creator>
    <dc:date>2022-11-15T08:37:18Z</dc:date>
    <item>
      <title>Buffered and Non-buffered uart ioctl</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Buffered-and-Non-buffered-uart-ioctl/m-p/1552799#M15800</link>
      <description>&lt;P&gt;Running bare metal software on MC56F800-EVK with CW11.1 and DSC Quickstart 2.7.&lt;/P&gt;&lt;P&gt;Two questions:&lt;/P&gt;&lt;P&gt;(1)&amp;nbsp; When reading uart in buffered mode and using ioctl(SCI0, SCI_GET_RX_CHARS_READY, NULL) to determine how many chars are in read buffer, the ioctl always returns 1 (even when there is no input).&amp;nbsp; Why?&lt;/P&gt;&lt;P&gt;(2) When reading uart in non-buffered mode, there appears to be no ioctl call to determine if a char is in the read data register. There appears to be no way to determine if a char has been received. Am I wrong?&lt;/P&gt;</description>
      <pubDate>Sun, 13 Nov 2022 01:22:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Buffered-and-Non-buffered-uart-ioctl/m-p/1552799#M15800</guid>
      <dc:creator>pgillaspy</dc:creator>
      <dc:date>2022-11-13T01:22:45Z</dc:date>
    </item>
    <item>
      <title>Re: Buffered and Non-buffered uart ioctl</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Buffered-and-Non-buffered-uart-ioctl/m-p/1553851#M15803</link>
      <description>Hi,
Q1)When reading uart in buffered mode and using ioctl(SCI0, SCI_GET_RX_CHARS_READY, NULL) to determine how many chars are in read buffer, the ioctl always returns 1 (even when there is no input).  Why?
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;pls check the body of api function  ioctl(SCI0, SCI_GET_RX_CHARS_READY, NULL), and check how the driver code to read data from receiver register to the buffer.

(2) When reading uart in non-buffered mode, there appears to be no ioctl call to determine if a char is in the read data register. There appears to be no way to determine if a char has been received. Am I wrong?
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;Can you tell us the DSC part number?  Anyway, I suppose that you use interrupt mode, as you know that there is FIFO for the SCI receiver, in the ISR of receiver, you can check the QSCI Control Register 2 (QSCIx_CTRL2), the QSCIx_CTRL2[RFCNT] bits represent the number of bytes the SCI has received. You can check the bits in ISR and read the data from FIFO.
Hope it can help you
BR
XiangJun Rong

10–8
RFCNT
Receive FIFO Count
These read only bits show how many words are used in the RX FIFO. As words are received,
CTRL2[RFCNT] is incremented. As words are read from DATA the value of CTRL2[RFCNT] decrements.
There is one word time to read DATA between when STAT[RDRF] is set (interrupt asserted), due to the
RX FIFO being full, and when an overflow condition is flagged.
000 0 words in RX FIFO
001 1 word in RX FIFO
010 2 words in RX FIFO
011 3 words in RX FIFO
100 4 words in RX FIFO
101 Reserved
110 Reserved
111 Reserved</description>
      <pubDate>Tue, 15 Nov 2022 08:37:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Buffered-and-Non-buffered-uart-ioctl/m-p/1553851#M15803</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2022-11-15T08:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: Buffered and Non-buffered uart ioctl</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Buffered-and-Non-buffered-uart-ioctl/m-p/1556647#M15811</link>
      <description>&lt;P&gt;I got the SCI successfully running without using buffered IO. i am using non-buffered but with the TX and RX FIFOs enabled. By carefully reading the tech manual, I was able to setup the TX FIFO full count and the RX FIFO empty count flags such that I am able to TX and RX&amp;nbsp; very efficiently. Consider this support item closed.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Nov 2022 21:03:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Buffered-and-Non-buffered-uart-ioctl/m-p/1556647#M15811</guid>
      <dc:creator>pgillaspy</dc:creator>
      <dc:date>2022-11-18T21:03:28Z</dc:date>
    </item>
  </channel>
</rss>

