<?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>LPC MicrocontrollersのトピックRe: Sending a byte using UART</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Sending-a-byte-using-UART/m-p/1343309#M46500</link>
    <description>&lt;P&gt;Thank you Diego!&lt;/P&gt;&lt;P&gt;I'm using a LPCXpresso LPC1347 board with MCUXpresso&amp;nbsp; IDE v11.4.0 and LPCOpen v2.05.&lt;/P&gt;&lt;P&gt;I tried your function:&lt;/P&gt;&lt;LI-SPOILER&gt;uint8_t array[]={0x80, 0x30, 0x31, 0x50};&lt;BR /&gt;&lt;BR /&gt;&lt;P&gt;Chip_UART_Send(LPC_USART, "UART_Send!\n\r", 12);&lt;BR /&gt;Chip_UART_Send(LPC_USART, (const uint8_t *) &amp;amp;array[i], 10);&lt;BR /&gt;Chip_UART_Send(LPC_USART, (const uint8_t *) array[i], 10);&lt;/P&gt;&lt;P&gt;Chip_UART_SendBlocking(LPC_USART, "\n\rUART_SendBlocking\n\r", 21);&lt;BR /&gt;Chip_UART_SendBlocking(LPC_USART, (const uint8_t *) &amp;amp;array[i], 10);&lt;BR /&gt;Chip_UART_SendBlocking(LPC_USART, (const uint8_t *) array[i], 10);&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;/* Transmit a byte array through the UART peripheral (non-blocking) */&lt;BR /&gt;int Chip_UART_Send(LPC_USART_T *pUART, const void *data, int numBytes)&lt;BR /&gt;{&lt;BR /&gt;int sent = 0;&lt;BR /&gt;uint8_t *p8 = (uint8_t *) data;&lt;/P&gt;&lt;P&gt;/* Send until the transmit FIFO is full or out of bytes */&lt;BR /&gt;while ((sent &amp;lt; numBytes) &amp;amp;&amp;amp; ((Chip_UART_ReadLineStatus(pUART) &amp;amp; UART_LSR_THRE) != 0))&lt;BR /&gt;{&lt;BR /&gt;Chip_UART_SendByte(pUART, *p8);&lt;BR /&gt;p8++;&lt;BR /&gt;sent++;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;return sent;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;/* Transmit a byte array through the UART peripheral (blocking) */&lt;BR /&gt;int Chip_UART_SendBlocking(LPC_USART_T *pUART, const void *data, int numBytes)&lt;BR /&gt;{&lt;BR /&gt;int pass, sent = 0;&lt;BR /&gt;uint8_t *p8 = (uint8_t *) data;&lt;/P&gt;&lt;P&gt;while (numBytes &amp;gt; 0) {&lt;BR /&gt;pass = Chip_UART_Send(pUART, p8, numBytes);&lt;BR /&gt;numBytes -= pass;&lt;BR /&gt;sent += pass;&lt;BR /&gt;p8 += pass;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;return sent;&lt;BR /&gt;}&lt;/P&gt;&lt;/LI-SPOILER&gt;&lt;P&gt;And this is the output:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Captura.jpg" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/156603i83D13B7746AF1656/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Captura.jpg" alt="Captura.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Chip_UART_Send only sends the first character but not the first byte of my array &lt;LI-EMOJI id="lia_disappointed-face" title=":disappointed_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 21 Sep 2021 13:48:21 GMT</pubDate>
    <dc:creator>emimad</dc:creator>
    <dc:date>2021-09-21T13:48:21Z</dc:date>
    <item>
      <title>Sending a byte using UART</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Sending-a-byte-using-UART/m-p/1342567#M46488</link>
      <description>&lt;P&gt;Hi all!&lt;/P&gt;&lt;P&gt;I'm trying to send some bytes through UART but I'm having some problems, probably because my old programming memories.&lt;/P&gt;&lt;P&gt;uint8_t array[]={0x80, 0x30, 0x31, 0x50};&lt;/P&gt;&lt;P&gt;for(i=0;i&amp;lt;4;i++){&lt;/P&gt;&lt;P&gt;Chip_UART_SendByte(LPC_USART, array[i]);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm sure it's an stupid question... but after check many examples I can't send my array byte by byte &lt;LI-EMOJI id="lia_disappointed-face" title=":disappointed_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Sun, 19 Sep 2021 18:51:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Sending-a-byte-using-UART/m-p/1342567#M46488</guid>
      <dc:creator>emimad</dc:creator>
      <dc:date>2021-09-19T18:51:05Z</dc:date>
    </item>
    <item>
      <title>Re: Sending a byte using UART</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Sending-a-byte-using-UART/m-p/1342940#M46495</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/191428"&gt;@emimad&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope you are doing well!&lt;/P&gt;
&lt;P&gt;Could you let me know&amp;nbsp; which LPC board/MCU&amp;nbsp; and LPC drivers are you using?&lt;/P&gt;
&lt;P&gt;Are you able to see any&amp;nbsp; part of your transmitted data array in the TX pin?&amp;nbsp; Or fails completely?&lt;/P&gt;
&lt;P&gt;As a quick comment,&amp;nbsp; I would better call that function as below :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;/* Transmit a byte array through the UART peripheral (non-blocking) */
int Chip_UART_Send(LPC_USART_T *pUART, const void *data, int numBytes)
{
  int sent = 0;
  uint8_t *p8 = (uint8_t *) data;

  /* Send until the transmit FIFO is full or out of bytes */
  while ((sent &amp;lt; numBytes) &amp;amp;&amp;amp;
    ((Chip_UART_ReadLineStatus(pUART) &amp;amp; UART_LSR_THRE) != 0)) 
  {
     Chip_UART_SendByte(pUART, *p8);
     p8++;
     sent++;
  }
  return sent;
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is done in the LPC4347 LPCopen drivers.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And&amp;nbsp; make sure that the RX pins and the UART are properly clocked and configured as the UM mentions.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;All the best ,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Diego.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Sep 2021 21:33:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Sending-a-byte-using-UART/m-p/1342940#M46495</guid>
      <dc:creator>diego_charles</dc:creator>
      <dc:date>2021-09-20T21:33:50Z</dc:date>
    </item>
    <item>
      <title>Re: Sending a byte using UART</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Sending-a-byte-using-UART/m-p/1343309#M46500</link>
      <description>&lt;P&gt;Thank you Diego!&lt;/P&gt;&lt;P&gt;I'm using a LPCXpresso LPC1347 board with MCUXpresso&amp;nbsp; IDE v11.4.0 and LPCOpen v2.05.&lt;/P&gt;&lt;P&gt;I tried your function:&lt;/P&gt;&lt;LI-SPOILER&gt;uint8_t array[]={0x80, 0x30, 0x31, 0x50};&lt;BR /&gt;&lt;BR /&gt;&lt;P&gt;Chip_UART_Send(LPC_USART, "UART_Send!\n\r", 12);&lt;BR /&gt;Chip_UART_Send(LPC_USART, (const uint8_t *) &amp;amp;array[i], 10);&lt;BR /&gt;Chip_UART_Send(LPC_USART, (const uint8_t *) array[i], 10);&lt;/P&gt;&lt;P&gt;Chip_UART_SendBlocking(LPC_USART, "\n\rUART_SendBlocking\n\r", 21);&lt;BR /&gt;Chip_UART_SendBlocking(LPC_USART, (const uint8_t *) &amp;amp;array[i], 10);&lt;BR /&gt;Chip_UART_SendBlocking(LPC_USART, (const uint8_t *) array[i], 10);&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;/* Transmit a byte array through the UART peripheral (non-blocking) */&lt;BR /&gt;int Chip_UART_Send(LPC_USART_T *pUART, const void *data, int numBytes)&lt;BR /&gt;{&lt;BR /&gt;int sent = 0;&lt;BR /&gt;uint8_t *p8 = (uint8_t *) data;&lt;/P&gt;&lt;P&gt;/* Send until the transmit FIFO is full or out of bytes */&lt;BR /&gt;while ((sent &amp;lt; numBytes) &amp;amp;&amp;amp; ((Chip_UART_ReadLineStatus(pUART) &amp;amp; UART_LSR_THRE) != 0))&lt;BR /&gt;{&lt;BR /&gt;Chip_UART_SendByte(pUART, *p8);&lt;BR /&gt;p8++;&lt;BR /&gt;sent++;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;return sent;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;/* Transmit a byte array through the UART peripheral (blocking) */&lt;BR /&gt;int Chip_UART_SendBlocking(LPC_USART_T *pUART, const void *data, int numBytes)&lt;BR /&gt;{&lt;BR /&gt;int pass, sent = 0;&lt;BR /&gt;uint8_t *p8 = (uint8_t *) data;&lt;/P&gt;&lt;P&gt;while (numBytes &amp;gt; 0) {&lt;BR /&gt;pass = Chip_UART_Send(pUART, p8, numBytes);&lt;BR /&gt;numBytes -= pass;&lt;BR /&gt;sent += pass;&lt;BR /&gt;p8 += pass;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;return sent;&lt;BR /&gt;}&lt;/P&gt;&lt;/LI-SPOILER&gt;&lt;P&gt;And this is the output:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Captura.jpg" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/156603i83D13B7746AF1656/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Captura.jpg" alt="Captura.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Chip_UART_Send only sends the first character but not the first byte of my array &lt;LI-EMOJI id="lia_disappointed-face" title=":disappointed_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Sep 2021 13:48:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Sending-a-byte-using-UART/m-p/1343309#M46500</guid>
      <dc:creator>emimad</dc:creator>
      <dc:date>2021-09-21T13:48:21Z</dc:date>
    </item>
  </channel>
</rss>

