How to configure uart edma with Processor expert?

cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure uart edma with Processor expert?

728 Views
Contributor II

Hello

I am using Kinetis K64 in multiple projects with KDS3.2 and KSDK1.3 without many issues. For UART applications (modbus RTU) we have found the   UART_DRV_SendDataBlocking   and  UART_DRV_ReceiveDataBlocking functions to work well under FreeRTOS.

Recently we tried to use the EDMA version of these functions without success while trying to configure them with Processor Expert.

Is there any documentation describing how this can be done? Or is there a limitation of KDSK1.3??

Labels (1)
0 Kudos
10 Replies

110 Views
Contributor II

Hi Alice

It works now. The problem with zero bytes was not related  to the Uart.

Some last questions:

Are callbacks necessary for proper edma operation? If so, how exactly do you set them in the Processor Expert Tabs?

If callbacks are not used, then is the edma engine simply polling the Uart and not interrupting the CPU, except at the end of a blocking function?

I am trying to unload the CPU as much as possible so it can do other things, without being interrupted frequently.

Thanks & best regards

Pete

0 Kudos

110 Views
NXP TechSupport
NXP TechSupport

Hello Peter,

I assume you said the eDMA callback .

In the PE, you can configure it at here :

pastedImage_1.png

After generate code , you can find :

pastedImage_2.png

I think use the callback  is optional , if you want do something after one DMA channel, you can realize it

in the function : dmaController1_Callback0(). You can have a test .

Hope it helps

Alice

0 Kudos

110 Views
Contributor II

Hi Alice

I have tried your suggestion and it sort of works. The only problem is when receiving data, it misses the last character and substitutes 00 at other character positions. Example, I receive 8 bytes and echo them using...

static void rs485Task( void *pvParameters )
{
uint16_t *reg, N,base,k;
reg = (uint16_t *)pvParameters;
static uint8_t buf[255];

UART_HAL_SetTransmitterRtsPolarityMode(UART0_BASE_PTR,true); // use RTS to enable RS485
UART_HAL_SetTransmitterRtsCmd(UART0_BASE_PTR,true);

while(1)
{
if (kStatus_UART_Success == UART_DRV_EdmaReceiveDataBlocking(rs485_IDX, buf, 8,OSA_WAIT_FOREVER))
UART_DRV_EdmaSendDataBlocking(rs485_IDX, buf, 8, OSA_WAIT_FOREVER);

..........etc

Here is a typical log of data (TX) sent by an external source vs. what has been received (RX):pastedImage_1.png 

I am using UART0 with its 4 byte fifo. Should the fifo be disabled when using DMA?

Any other suggestion?

Many thanks

Pete

0 Kudos

110 Views
NXP TechSupport
NXP TechSupport

Hello Peter,

Please disable the UART fifo to have a try .

BR

Alice

0 Kudos

110 Views
Contributor II

Hi Alice

This looks promising. But when I set fsl_uart  to DMA mode, PE automatically installs fsl_edma as a referenced component.

How can I get rid of fsl_edma and use Init_eDMA instead?

Thanks

Pete

0 Kudos

110 Views
NXP TechSupport
NXP TechSupport

Hello Peter ,

Sorry for my mistake.

It isn't need add the component of "Init_eDMA " .

When configure the fsl_UART to DMA mode :

pastedImage_1.png

there will be add the component of "fsl_edma" automatic .

Then we can utilize this component

pastedImage_2.png

then refer to the demo code to have a test.

Hope it helps

Alice

0 Kudos

110 Views
NXP TechSupport
NXP TechSupport

Hello Peter,

There are UART-eDMA demo under KSDK1.3 :

KSDK_1.3.0\examples\frdmk64f\driver_examples\uart\uart_edma_blocking

\KSDK_1.3.0\examples\frdmk64f\driver_examples\uart\uart_edma_non_blocking

I recommend you can  first test it on you board .

Hope it helps

Alice

0 Kudos

110 Views
Contributor II

Hi Alice

Thanks for the quick response.

Yes I have tested the examples on the FRDM-K64 and they work fine.

But they are not using processor expert.

How can we configure a processor expert based system

to use uart edma? Is it even possible?

0 Kudos

110 Views
NXP TechSupport
NXP TechSupport

Hello Peter,

Sorry there is no SDK+PE demo .

Yes, it is possible to use the SDK+PE , you can add the two component of

"Init_eDMA" and "fsl_uart" :

pastedImage_1.png

Then configure the Properities :

pastedImage_2.png

pastedImage_3.png

About the code  , you can refer to the demo under KSDK without PE.

For they use the same functions .

Hope it helps

Alice

0 Kudos

110 Views
Contributor I

Hello All,

i am trying to setup the configuration for DMA with UART for Transmission using Processor expert but i dont get the option of component mode in UART as "DMA mode"

pastedImage_1.png

Can anyone tell whether i m missing any component... 

I could setup the DMA Channel as shown below:

pastedImage_2.png

With Regards,

Aalakh Devari

0 Kudos