<?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: LPC55S16 UART Sending via DMA and Receiving via FLEXCOMMx_IRQHandler() possible?</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S16-UART-Sending-via-DMA-and-Receiving-via-FLEXCOMMx/m-p/1378637#M47164</link>
    <description>&lt;P&gt;Hello Alice_Yang,&lt;BR /&gt;I have already tried this before your answer. However, here the behavior is different than expected. After sending, the FLEXCOMMx_IRQHandler is called instead of the DMA callback function. This is then permanently triggered if you don't check for kUSART_TxFifoEmptyFlag and disabled with USARTx-&amp;gt;INTENCLR = USART_INTENCLR_TXIDLECLR_MASK. Also afterwards the DMA callback does not come up. What can I do about this?&lt;/P&gt;&lt;P&gt;Furthermore I didn't understand if, despite global handles of type dma_handle_t, usart_dma_handle_t and usart_handle_t every time before using by USART_TransferSendDMA in another function it is necessary to call USART_TransferCreateHandleDMA again, otherwise nothing will be sent. It is not clear to me why this is necessary, since the handles were created globally. In the usart_dma_transfer example it worked without the additional call.&lt;/P&gt;&lt;P&gt;I had also tried to modify the usart_dma_transfer example to realize the reception also by means of DMA. Because I don't know how big the amount of data to be received is, I had used a rxbuffer of one byte in this case. Unfortunately this variant was so unperformant that from strings with a length of 250 characters only 148 were captured and processed. Could this be made more performant? Then I would not need to mix interrupt operation with DMA operation and all my worries would be solved.&lt;/P&gt;&lt;P&gt;Can you tell me how I can deinitialize the whole thing again? So that I can build an interface, which I can also shut down and reinitialize? For some things like the Usart and DMA there are Deinit functions. Then there are also various disable functions. What do I do with the handles (this ones: DMA_CreateHandle(&amp;amp;g_uartTxDmaHandle, EXAMPLE_UART_DMA_BASEADDR, USART_TX_DMA_CHANNEL);)? Just set them to NULL? Or leave them and make the same call at reinit with the same vars?&lt;/P&gt;&lt;P&gt;Best regards and thanks in advance&lt;/P&gt;</description>
    <pubDate>Tue, 30 Nov 2021 07:01:08 GMT</pubDate>
    <dc:creator>Ralf_Rademacher</dc:creator>
    <dc:date>2021-11-30T07:01:08Z</dc:date>
    <item>
      <title>LPC55S16 UART Sending via DMA and Receiving via FLEXCOMMx_IRQHandler() possible?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S16-UART-Sending-via-DMA-and-Receiving-via-FLEXCOMMx/m-p/1377474#M47121</link>
      <description>&lt;P&gt;Hello Community,&lt;BR /&gt;I am trying to modify the usart_dma_transfer example so that I can send using USART_DMA. But since I don't know what amount of data will come back, I want to receive via interrupt. Unfortunately I didn't manage to use the FLEXCOMM0_IRQHandler together with the DMA. Because when I execute USART_TransferSendDMA(DEMO_USART, &amp;amp;g_uartDmaHandle, &amp;amp;xfer); I get into the FLEXCOMM0_IRQHandler afterwards and not out again.&lt;/P&gt;&lt;P&gt;I need urgent help. Maybe someone can provide me with a small example.&lt;/P&gt;&lt;P&gt;Best&lt;/P&gt;&lt;P&gt;Ralf&lt;/P&gt;</description>
      <pubDate>Fri, 26 Nov 2021 07:57:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S16-UART-Sending-via-DMA-and-Receiving-via-FLEXCOMMx/m-p/1377474#M47121</guid>
      <dc:creator>Ralf_Rademacher</dc:creator>
      <dc:date>2021-11-26T07:57:38Z</dc:date>
    </item>
    <item>
      <title>Re: LPC55S16 UART Sending via DMA and Receiving via FLEXCOMMx_IRQHandler() possible?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S16-UART-Sending-via-DMA-and-Receiving-via-FLEXCOMMx/m-p/1378517#M47161</link>
      <description>&lt;P&gt;Hello Ralf,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is recommend to combine the two demos "lpcxpresso55s16_usart_interrupt" " and "/lpcxpresso55s16_usart_dma_transfer" to develop your own project.&amp;nbsp; Demo usart_interrupt includes&amp;nbsp;&lt;/P&gt;
&lt;P&gt;UART receiving interrupt.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Alice&lt;/P&gt;</description>
      <pubDate>Tue, 30 Nov 2021 02:55:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S16-UART-Sending-via-DMA-and-Receiving-via-FLEXCOMMx/m-p/1378517#M47161</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2021-11-30T02:55:16Z</dc:date>
    </item>
    <item>
      <title>Re: LPC55S16 UART Sending via DMA and Receiving via FLEXCOMMx_IRQHandler() possible?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S16-UART-Sending-via-DMA-and-Receiving-via-FLEXCOMMx/m-p/1378637#M47164</link>
      <description>&lt;P&gt;Hello Alice_Yang,&lt;BR /&gt;I have already tried this before your answer. However, here the behavior is different than expected. After sending, the FLEXCOMMx_IRQHandler is called instead of the DMA callback function. This is then permanently triggered if you don't check for kUSART_TxFifoEmptyFlag and disabled with USARTx-&amp;gt;INTENCLR = USART_INTENCLR_TXIDLECLR_MASK. Also afterwards the DMA callback does not come up. What can I do about this?&lt;/P&gt;&lt;P&gt;Furthermore I didn't understand if, despite global handles of type dma_handle_t, usart_dma_handle_t and usart_handle_t every time before using by USART_TransferSendDMA in another function it is necessary to call USART_TransferCreateHandleDMA again, otherwise nothing will be sent. It is not clear to me why this is necessary, since the handles were created globally. In the usart_dma_transfer example it worked without the additional call.&lt;/P&gt;&lt;P&gt;I had also tried to modify the usart_dma_transfer example to realize the reception also by means of DMA. Because I don't know how big the amount of data to be received is, I had used a rxbuffer of one byte in this case. Unfortunately this variant was so unperformant that from strings with a length of 250 characters only 148 were captured and processed. Could this be made more performant? Then I would not need to mix interrupt operation with DMA operation and all my worries would be solved.&lt;/P&gt;&lt;P&gt;Can you tell me how I can deinitialize the whole thing again? So that I can build an interface, which I can also shut down and reinitialize? For some things like the Usart and DMA there are Deinit functions. Then there are also various disable functions. What do I do with the handles (this ones: DMA_CreateHandle(&amp;amp;g_uartTxDmaHandle, EXAMPLE_UART_DMA_BASEADDR, USART_TX_DMA_CHANNEL);)? Just set them to NULL? Or leave them and make the same call at reinit with the same vars?&lt;/P&gt;&lt;P&gt;Best regards and thanks in advance&lt;/P&gt;</description>
      <pubDate>Tue, 30 Nov 2021 07:01:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S16-UART-Sending-via-DMA-and-Receiving-via-FLEXCOMMx/m-p/1378637#M47164</guid>
      <dc:creator>Ralf_Rademacher</dc:creator>
      <dc:date>2021-11-30T07:01:08Z</dc:date>
    </item>
    <item>
      <title>Re: LPC55S16 UART Sending via DMA and Receiving via FLEXCOMMx_IRQHandler() possible?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S16-UART-Sending-via-DMA-and-Receiving-via-FLEXCOMMx/m-p/1380433#M47208</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;SPAN&gt;Ralf_Rademacher,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;I think&amp;nbsp; you need analysis the issue step by step. the first step is making UART TX with DMA work well,&lt;/P&gt;
&lt;P&gt;then working with UART RX.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Alice&lt;/P&gt;</description>
      <pubDate>Thu, 02 Dec 2021 08:07:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S16-UART-Sending-via-DMA-and-Receiving-via-FLEXCOMMx/m-p/1380433#M47208</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2021-12-02T08:07:59Z</dc:date>
    </item>
    <item>
      <title>Re: LPC55S16 UART Sending via DMA and Receiving via FLEXCOMMx_IRQHandler() possible?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S16-UART-Sending-via-DMA-and-Receiving-via-FLEXCOMMx/m-p/1380515#M47211</link>
      <description>&lt;P&gt;Hi Alice,&lt;/P&gt;&lt;P&gt;i just have setup a little example:&lt;/P&gt;&lt;PRE&gt;#include "pin_mux.h"
#include "board.h"
#include "fsl_usart.h"
#include "fsl_usart_dma.h"
#include "fsl_dma.h"
#include "fsl_debug_console.h"
#include "fsl_usart_dma.h"
#include &amp;lt;stdbool.h&amp;gt;
#include "fsl_power.h"
/*******************************************************************************
 * Definitions
 ******************************************************************************/
#define USART_TX_DMA_CHANNEL      5
/*******************************************************************************
 * Variables
 ******************************************************************************/
usart_dma_handle_t 	g_uartDmaHandle;
usart_handle_t 		g_usart_handle;
dma_handle_t 		g_uartTxDmaHandle;
uint8_t g_tipString[]                  	= "USART DMA example\r\nWrite this text and\r\nEcho every character immediatly\r\n";
uint8_t g_rxBuffer = 0;
volatile bool txOnGoing                	= false;
usart_config_t config;
usart_transfer_t xfer;

/*******************************************************************************
 * Code
 ******************************************************************************/
void FLEXCOMM0_IRQHandler(void)
{
    uint8_t data;
    uint32_t flags = USART_GetStatusFlags(USART0);
    /* If new data arrived. */
    if ((kUSART_RxFifoNotEmptyFlag | kUSART_RxError) &amp;amp; flags)
    {
    	g_tipString[0]=USART_ReadByte(USART0);
		DMA_EnableChannel(DMA0, USART_TX_DMA_CHANNEL);
		USART_TransferCreateHandleDMA(USART0, &amp;amp;g_uartDmaHandle, NULL, NULL, &amp;amp;g_uartTxDmaHandle, NULL);
		/* Send g_tipString out. */
		xfer.data     	= g_tipString;
		xfer.dataSize 	= 1;
		txOnGoing     	= true;
		USART_TransferSendDMA(USART0, &amp;amp;g_uartDmaHandle, &amp;amp;xfer);
    }
    if((kUSART_TxFifoEmptyFlag | kUSART_TxError) &amp;amp; flags)
    {
    	USART0-&amp;gt;INTENCLR = USART_INTENCLR_TXIDLECLR_MASK;
        if(txOnGoing)
        	txOnGoing = false;
    }
    SDK_ISR_EXIT_BARRIER;
}

int main(void)
{

    BOARD_InitBootPins();
    BOARD_InitBootClocks();
    BOARD_InitDebugConsole();
    USART_GetDefaultConfig(&amp;amp;config);
    config.baudRate_Bps = BOARD_DEBUG_UART_BAUDRATE;
    config.enableTx     = true;
    config.enableRx     = true;
    USART_Init(USART0, &amp;amp;config, CLOCK_GetFlexCommClkFreq(0U));
    /* Configure DMA. */
    DMA_Init(DMA0);
    DMA_EnableChannel(DMA0, USART_TX_DMA_CHANNEL);
    DMA_CreateHandle(&amp;amp;g_uartTxDmaHandle, DMA0, USART_TX_DMA_CHANNEL);
    USART_TransferCreateHandleDMA(USART0, &amp;amp;g_uartDmaHandle, NULL, NULL, &amp;amp;g_uartTxDmaHandle, NULL);
    /* Send g_tipString out. */
    xfer.data     = g_tipString;
    xfer.dataSize = sizeof(g_tipString) - 1;
    txOnGoing     = true;
    USART_TransferSendDMA(USART0, &amp;amp;g_uartDmaHandle, &amp;amp;xfer);
    /* Wait send finished */
    while (txOnGoing)
    {
    }
	USART_TransferCreateHandle(USART0, &amp;amp;g_usart_handle, NULL, NULL);
    USART_EnableInterrupts(USART0, kUSART_RxLevelInterruptEnable | kUSART_RxErrorInterruptEnable);
	EnableIRQ(FLEXCOMM0_IRQn);
    while (1)
    {
        __NOP();
    }
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can i suppress to get into the FLEXCOMM0_IRQHandler() after finishing transmit?&lt;/P&gt;&lt;P&gt;Why i need to call USART_TransferCreateHandleDMA(USART0, &amp;amp;g_uartDmaHandle, NULL, NULL, &amp;amp;g_uartTxDmaHandle, NULL); every time, although I have already created the handles globally and called the function already in the main routine?&lt;/P&gt;&lt;P&gt;Also, I left out the DMA_Callback function for TX in the example, since it is not called anyway. Since the FLEXCOMM0_IRQHandler() is always called before. If I don't clear the TXIDLE flag in the FLEXCOMM0_IRQHandler(), I don't get out of the FLEXCOMM0_IRQHandler() at all.&lt;/P&gt;&lt;PRE&gt;    if((kUSART_TxFifoEmptyFlag | kUSART_TxError) &amp;amp; flags)
    {
    	USART0-&amp;gt;INTENCLR = USART_INTENCLR_TXIDLECLR_MASK;
        if(txOnGoing)
        	txOnGoing = false;
    }&lt;/PRE&gt;&lt;P&gt;If the TXIDLE flag is cleared, the DMA_Callback function for TX is not called anymore. Is there anything that can be done about this?&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Ralf&lt;/P&gt;</description>
      <pubDate>Thu, 02 Dec 2021 09:39:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S16-UART-Sending-via-DMA-and-Receiving-via-FLEXCOMMx/m-p/1380515#M47211</guid>
      <dc:creator>Ralf_Rademacher</dc:creator>
      <dc:date>2021-12-02T09:39:08Z</dc:date>
    </item>
    <item>
      <title>Re: LPC55S16 UART Sending via DMA and Receiving via FLEXCOMMx_IRQHandler() possible?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S16-UART-Sending-via-DMA-and-Receiving-via-FLEXCOMMx/m-p/1382531#M47284</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;SPAN&gt;Ralf_Rademacher,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;1) I think you shouldn't left out DMA callback, because you TX use DMA, not use interrupt.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;so I think there is issue with below code:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;  USART_TransferCreateHandleDMA(USART0, &amp;amp;g_uartDmaHandle,&lt;FONT color="#FF0000"&gt; NULL&lt;/FONT&gt;, NULL, &amp;amp;g_uartTxDmaHandle, NULL);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;2) Do you want, in the receive interrupt send data using&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;USART_TransferSendDMA(USART0, &amp;amp;g_uartDmaHandle, &amp;amp;xfer);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;if yes, I don't think you need&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;call USART_TransferCreateHandleDMA(USART0, &amp;amp;g_uartDmaHandle, NULL, NULL, &amp;amp;g_uartTxDmaHandle, NULL); every time.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Alice&lt;/P&gt;</description>
      <pubDate>Tue, 07 Dec 2021 09:17:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S16-UART-Sending-via-DMA-and-Receiving-via-FLEXCOMMx/m-p/1382531#M47284</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2021-12-07T09:17:43Z</dc:date>
    </item>
    <item>
      <title>Re: LPC55S16 UART Sending via DMA and Receiving via FLEXCOMMx_IRQHandler() possible?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S16-UART-Sending-via-DMA-and-Receiving-via-FLEXCOMMx/m-p/1382626#M47288</link>
      <description>&lt;P&gt;Hello Alice,&lt;/P&gt;&lt;P&gt;to 1.) i left it out, because i get into FLEXCOMMx_IRQHandler() instead of DMA_Handler()&lt;/P&gt;&lt;P&gt;and dont get out only if i clear the flag:&lt;/P&gt;&lt;PRE&gt;    if((kUSART_TxFifoEmptyFlag | kUSART_TxError) &amp;amp; flags)
    {
    	USART0-&amp;gt;INTENCLR = USART_INTENCLR_TXIDLECLR_MASK;
        if(txOnGoing)
        	txOnGoing = false;
    }&lt;/PRE&gt;&lt;P&gt;But in the following i still did not get in the DMA_Handler. Thats why i left it out and called the Function with NULL.&lt;/P&gt;&lt;P&gt;You can try it by yourself.&lt;/P&gt;&lt;P&gt;to 2.) yes i wanted to echo every character to terminal, to have a live feedback.&lt;/P&gt;&lt;P&gt;if you try the code without calling&lt;/P&gt;&lt;PRE&gt;USART_TransferCreateHandleDMA(USART0, &amp;amp;g_uartDmaHandle,&lt;FONT color="#FF0000"&gt; NULL&lt;/FONT&gt;, NULL, &amp;amp;g_uartTxDmaHandle, NULL);&lt;/PRE&gt;&lt;P&gt;before&lt;/P&gt;&lt;PRE&gt;USART_TransferSendDMA(USART0, &amp;amp;g_uartDmaHandle, &amp;amp;xfer);&lt;/PRE&gt;&lt;P&gt;you will see, that only once there is something echoed.&lt;/P&gt;&lt;P&gt;thats why i asked for it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but because i got no good solution here, i got a better one from other side.&lt;/P&gt;&lt;P&gt;now i only use the USART_Init from SDK, everything else is done by FLEXCOMMx_IRQHandler(). I just need my pointer to the string and a length. is very performant instead of the examples from the sdk....&lt;/P&gt;&lt;P&gt;so thats why i mark now the request as solved. even if there was no satisfying solution here.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Dec 2021 11:29:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S16-UART-Sending-via-DMA-and-Receiving-via-FLEXCOMMx/m-p/1382626#M47288</guid>
      <dc:creator>Ralf_Rademacher</dc:creator>
      <dc:date>2021-12-07T11:29:49Z</dc:date>
    </item>
  </channel>
</rss>

