<?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>Other NXP Productsのトピックusart</title>
    <link>https://community.nxp.com/t5/Other-NXP-Products/usart/m-p/2014951#M26818</link>
    <description>&lt;P&gt;"I am using the &lt;STRONG&gt;LPC55S16&lt;/STRONG&gt; microcontroller, and I am sending &lt;STRONG&gt;20 bytes&lt;/STRONG&gt; of data. After receiving, when I print it, I am only getting &lt;STRONG&gt;16 bytes&lt;/STRONG&gt; of data. How can I print the full &lt;STRONG&gt;20 bytes&lt;/STRONG&gt; of data? this is my code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#include "pin_mux.h"&lt;BR /&gt;#include "board.h"&lt;BR /&gt;#include "fsl_usart.h"&lt;BR /&gt;#include &amp;lt;stdbool.h&amp;gt;&lt;BR /&gt;#include "fsl_power.h"&lt;BR /&gt;#include "stdio.h"&lt;/P&gt;&lt;P&gt;/*******************************************************************************&lt;BR /&gt;* Definitions&lt;BR /&gt;******************************************************************************/&lt;BR /&gt;#define DEMO_USART USART0&lt;BR /&gt;#define DEMO_USART_CLK_SRC kCLOCK_Flexcomm1&lt;BR /&gt;#define DEMO_USART_CLK_FREQ CLOCK_GetFlexCommClkFreq(0U)&lt;BR /&gt;#define DEMO_USART_IRQHandler FLEXCOMM0_IRQHandler&lt;BR /&gt;#define DEMO_USART_IRQn FLEXCOMM0_IRQn&lt;/P&gt;&lt;P&gt;/*! @brief Ring buffer size (Unit: Byte). */&lt;BR /&gt;#define DEMO_RING_BUFFER_SIZE 32&lt;/P&gt;&lt;P&gt;/*******************************************************************************&lt;BR /&gt;* Prototypes&lt;BR /&gt;******************************************************************************/&lt;BR /&gt;bool ISO7816_Write(uint8_t b);&lt;BR /&gt;bool ISO7816_Read(uint8_t* b);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;uint32_t demoRingBuffer[DEMO_RING_BUFFER_SIZE];&lt;BR /&gt;volatile uint16_t txIndex;&lt;BR /&gt;volatile uint16_t rxIndex;&lt;BR /&gt;volatile uint16_t lastRxIndex; // Variable to store the last received index&lt;/P&gt;&lt;P&gt;bool ISO7816_Write(uint8_t b)&lt;BR /&gt;{&lt;BR /&gt;if (!(USART_GetStatusFlags(DEMO_USART) &amp;amp; kUSART_TxFifoNotFullFlag)) return false;&lt;BR /&gt;USART_WriteByte(DEMO_USART, b);&lt;BR /&gt;return true;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;bool ISO7816_Read(uint8_t* b)&lt;BR /&gt;{&lt;BR /&gt;if (!(USART_GetStatusFlags(DEMO_USART) &amp;amp; kUSART_RxFifoNotEmptyFlag)) return false;&lt;BR /&gt;*b = USART_ReadByte(DEMO_USART);&lt;BR /&gt;rxIndex = (rxIndex + 1) % DEMO_RING_BUFFER_SIZE; // Update rxIndex&lt;BR /&gt;return true;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;int main(void)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;usart_config_t config;&lt;/P&gt;&lt;P&gt;POWER_SetBodVbatLevel(kPOWER_BodVbatLevel1650mv, kPOWER_BodHystLevel50mv, false);&lt;BR /&gt;CLOCK_AttachClk(BOARD_DEBUG_UART_CLK_ATTACH);&lt;BR /&gt;BOARD_InitBootPins();&lt;BR /&gt;BOARD_InitBootClocks();&lt;BR /&gt;BOARD_InitDebugConsole();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;USART_GetDefaultConfig(&amp;amp;config);&lt;BR /&gt;config.baudRate_Bps = BOARD_DEBUG_UART_BAUDRATE;&lt;BR /&gt;config.enableTx = true;&lt;BR /&gt;config.enableRx = true;&lt;BR /&gt;USART_Init(DEMO_USART, &amp;amp;config, DEMO_USART_CLK_FREQ);&lt;/P&gt;&lt;P&gt;uint32_t sendDataIndex = 0; // Index to track the next byte to send&lt;BR /&gt;uint32_t i;&lt;BR /&gt;const char sendDataBuffer[] = "Hello";&lt;/P&gt;&lt;P&gt;for (size_t i = 0; i &amp;lt; sizeof(sendDataBuffer) - 1; ++i) {&lt;BR /&gt;ISO7816_Write(sendDataBuffer[i]);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;while (1)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;// Check for received data&lt;BR /&gt;uint8_t receivedData=0;&lt;BR /&gt;while (ISO7816_Read(&amp;amp;receivedData))&lt;BR /&gt;{&lt;BR /&gt;printf("receivedData=%x\n",receivedData);&lt;BR /&gt;// lastRxIndex = rxIndex; // Update last received index&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
    <pubDate>Tue, 17 Dec 2024 06:30:53 GMT</pubDate>
    <dc:creator>syedhashmiraza</dc:creator>
    <dc:date>2024-12-17T06:30:53Z</dc:date>
    <item>
      <title>usart</title>
      <link>https://community.nxp.com/t5/Other-NXP-Products/usart/m-p/2014951#M26818</link>
      <description>&lt;P&gt;"I am using the &lt;STRONG&gt;LPC55S16&lt;/STRONG&gt; microcontroller, and I am sending &lt;STRONG&gt;20 bytes&lt;/STRONG&gt; of data. After receiving, when I print it, I am only getting &lt;STRONG&gt;16 bytes&lt;/STRONG&gt; of data. How can I print the full &lt;STRONG&gt;20 bytes&lt;/STRONG&gt; of data? this is my code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#include "pin_mux.h"&lt;BR /&gt;#include "board.h"&lt;BR /&gt;#include "fsl_usart.h"&lt;BR /&gt;#include &amp;lt;stdbool.h&amp;gt;&lt;BR /&gt;#include "fsl_power.h"&lt;BR /&gt;#include "stdio.h"&lt;/P&gt;&lt;P&gt;/*******************************************************************************&lt;BR /&gt;* Definitions&lt;BR /&gt;******************************************************************************/&lt;BR /&gt;#define DEMO_USART USART0&lt;BR /&gt;#define DEMO_USART_CLK_SRC kCLOCK_Flexcomm1&lt;BR /&gt;#define DEMO_USART_CLK_FREQ CLOCK_GetFlexCommClkFreq(0U)&lt;BR /&gt;#define DEMO_USART_IRQHandler FLEXCOMM0_IRQHandler&lt;BR /&gt;#define DEMO_USART_IRQn FLEXCOMM0_IRQn&lt;/P&gt;&lt;P&gt;/*! @brief Ring buffer size (Unit: Byte). */&lt;BR /&gt;#define DEMO_RING_BUFFER_SIZE 32&lt;/P&gt;&lt;P&gt;/*******************************************************************************&lt;BR /&gt;* Prototypes&lt;BR /&gt;******************************************************************************/&lt;BR /&gt;bool ISO7816_Write(uint8_t b);&lt;BR /&gt;bool ISO7816_Read(uint8_t* b);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;uint32_t demoRingBuffer[DEMO_RING_BUFFER_SIZE];&lt;BR /&gt;volatile uint16_t txIndex;&lt;BR /&gt;volatile uint16_t rxIndex;&lt;BR /&gt;volatile uint16_t lastRxIndex; // Variable to store the last received index&lt;/P&gt;&lt;P&gt;bool ISO7816_Write(uint8_t b)&lt;BR /&gt;{&lt;BR /&gt;if (!(USART_GetStatusFlags(DEMO_USART) &amp;amp; kUSART_TxFifoNotFullFlag)) return false;&lt;BR /&gt;USART_WriteByte(DEMO_USART, b);&lt;BR /&gt;return true;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;bool ISO7816_Read(uint8_t* b)&lt;BR /&gt;{&lt;BR /&gt;if (!(USART_GetStatusFlags(DEMO_USART) &amp;amp; kUSART_RxFifoNotEmptyFlag)) return false;&lt;BR /&gt;*b = USART_ReadByte(DEMO_USART);&lt;BR /&gt;rxIndex = (rxIndex + 1) % DEMO_RING_BUFFER_SIZE; // Update rxIndex&lt;BR /&gt;return true;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;int main(void)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;usart_config_t config;&lt;/P&gt;&lt;P&gt;POWER_SetBodVbatLevel(kPOWER_BodVbatLevel1650mv, kPOWER_BodHystLevel50mv, false);&lt;BR /&gt;CLOCK_AttachClk(BOARD_DEBUG_UART_CLK_ATTACH);&lt;BR /&gt;BOARD_InitBootPins();&lt;BR /&gt;BOARD_InitBootClocks();&lt;BR /&gt;BOARD_InitDebugConsole();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;USART_GetDefaultConfig(&amp;amp;config);&lt;BR /&gt;config.baudRate_Bps = BOARD_DEBUG_UART_BAUDRATE;&lt;BR /&gt;config.enableTx = true;&lt;BR /&gt;config.enableRx = true;&lt;BR /&gt;USART_Init(DEMO_USART, &amp;amp;config, DEMO_USART_CLK_FREQ);&lt;/P&gt;&lt;P&gt;uint32_t sendDataIndex = 0; // Index to track the next byte to send&lt;BR /&gt;uint32_t i;&lt;BR /&gt;const char sendDataBuffer[] = "Hello";&lt;/P&gt;&lt;P&gt;for (size_t i = 0; i &amp;lt; sizeof(sendDataBuffer) - 1; ++i) {&lt;BR /&gt;ISO7816_Write(sendDataBuffer[i]);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;while (1)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;// Check for received data&lt;BR /&gt;uint8_t receivedData=0;&lt;BR /&gt;while (ISO7816_Read(&amp;amp;receivedData))&lt;BR /&gt;{&lt;BR /&gt;printf("receivedData=%x\n",receivedData);&lt;BR /&gt;// lastRxIndex = rxIndex; // Update last received index&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2024 06:30:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Other-NXP-Products/usart/m-p/2014951#M26818</guid>
      <dc:creator>syedhashmiraza</dc:creator>
      <dc:date>2024-12-17T06:30:53Z</dc:date>
    </item>
  </channel>
</rss>

