LPC845 USART0 Receive data by DMA0

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC845 USART0 Receive data by DMA0

1,194 Views
Arturo1901
Contributor II

Hello everyone:

I want to receive 10 bytes by the serial port with the help of the DMA0 module, I attach the code and images of configuration.

The problem is when I send the 10 bytes continuos I don't receive anything, But when I send one byte by  one it is ok. Is it correct the funcionality?

So I try to configurate other channel to do a echo, the other channel is CH1 (attached images of configuration). When I receive the 10 byte (one by one), active the transfer of the channel 1 to send data to the USART0->TXDAT, and it's work...

So the problem I guess it is only for the CHANNEL0 (that is for the receive data by DMA)

has someone an idea what it is the problem? because I tried some things but I didn't find the solution.

#include <stdio.h>
#include "board.h"
#include "peripherals.h"
#include "pin_mux.h"
#include "clock_config.h"
#include "LPC845.h"
#include "fsl_debug_console.h"
/* TODO: insert other include files here. */

uint8_t dstAddr[1024];
uint8_t rx0_dma_done = 0;
uint8_t tx0_dma_done = 0;

/* TODO: insert other definitions and declarations here. */

void dma0_callbacks(struct _dma_handle *handle, void *param, bool transferDone, uint32_t tcds){


	if(tcds == kDMA_IntA){

		rx0_dma_done = 1;
	}

}

void dma0_callbacks_ch1(struct _dma_handle *handle, void *param, bool transferDone, uint32_t tcds){

	if(tcds == kDMA_IntA){


		tx0_dma_done = 1;

	}

}


/*
 * @brief   Application entry point.
 */
int main(void) {

  	/* Init board hardware. */
    BOARD_InitBootPins();
    BOARD_InitBootClocks();
    BOARD_InitBootPeripherals();
#ifndef BOARD_INIT_DEBUG_CONSOLE_PERIPHERAL
    /* Init FSL debug console. */
    BOARD_InitDebugConsole();
#endif

    PRINTF("Request RX USART0\n");

    //DMA_StartTransfer(&DMA0_CH0_Handle);

    DMA_StartTransfer(&DMA0_CH0_Handle);

    /* Force the counter to be placed into memory. */
    volatile static int i = 0 ;
    /* Enter an infinite loop, just incrementing a counter. */
    while(1) {

        if(rx0_dma_done){

        	rx0_dma_done = 0;

        	DMA_StartTransfer(&DMA0_CH1_Handle);

        }
        if(tx0_dma_done){

        	tx0_dma_done = 0;

        	DMA_StartTransfer(&DMA0_CH0_Handle);
        }

    }
    return 0 ;
}

 

Config_mx_2.jpgConfig_mx_1.jpg

Config_mx_4.jpgConfig_mx_3.jpg

Config_mx_5.jpg

 

Thanks!

0 Kudos
6 Replies

1,013 Views
felu
Contributor II

Hi Arturo,

did you find a solution and if so, would you share it? I've the same problem with my own code.

Thank you.

0 Kudos

994 Views
Arturo1901
Contributor II

Hello,

 

Yes, the problem is the debugger, when you try to send or recive information with the virtual serial port using the DMA it is not going to work, so the serial port from the LPC845 it is working correctly, so if you do the same thing but with other serial port from LPC845 is going to work. You can try to connect a USB to SERIAL to the pines RX and TX from LPC845.

Regards!

 

 

1,172 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Arturo,

Can you post all your project so that we can have a check and debug?

BR

XiangJun Rong

0 Kudos

1,169 Views
Arturo1901
Contributor II

 

Hello, of course,

This is a link of Github, you can download,

https://github.com/JorgeArturo/lpc845/tree/master/Tutorial_1_DMA__1 

Thanks,

0 Kudos

1,157 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Arturo,

Can you  compress all the project into a *.zip file and post it to the Github, in this way I can download it and load it to MCUXpresso tools and have a test.

BR

XiangJun Rong

0 Kudos

1,150 Views
Arturo1901
Contributor II

Hi,

I attached the zip file of the project,

 

Thanks,

0 Kudos