K60 UART DMA using PE not working !

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

K60 UART DMA using PE not working !

跳至解决方案
1,507 次查看
Amit_Kumar1
Senior Contributor II

Hi

 

I am using codewarrior 10.5 , 10.6 . I wanted to make a simple program in which I will send a char through terminal window  using DMA for receiving, I will store that in a variable and will echo that back. I had to send a string but initially I tried with a char. The DMA didn't worked. Attached is the codes I made 2 code sto test using DMAT, DMACH component of PE. Currently I am using MK60512VLL10 uc. and DMA is configured to UART4 Receive. I have made it worked using DMAT component in K20. It works fine there, I have transmitted 100 bytes using DMA in K20. but in K60 I am not able to .I checked in CW10.5 as well as CW10.6 but it didn't worked Please look into the matter.

 

Kind Regards

Amit Kumar

Original Attachment has been moved to: DMA-TEST-DMAT.zip

Original Attachment has been moved to: DMA-TEST-DMACH.zip

标记 (6)
1 解答
1,036 次查看
Amit_Kumar1
Senior Contributor II

Hi Mark

Thanks a lot for your valuable reply. I did the following changes and it is working for single character.

// UART_PDD_EnableReceiveDma(UART4_BASE_PTR, PDD_ENABLE); // Enable DMA for UART receive

UART4_C2 |= UART_C2_RIE_MASK;     // Interrupt /DMA Enable

UART4_C5 |= UART_C5_RDMAS_MASK;   // DMA

I wanted to know suppose I have char buffer[10]; the values coming in is 10 bytes , I want the DMA to flag the transfer complete if all 10 bytes are received. currently by setting buffer's address offset to 1, I am able to receive 10 bytes of data but in b/w DMA flag is flagging 2 times. also  I have configured it for single transfer.

What would you suggest as the above configuration didn't worked.

Kind Regards

Amit Kumar

在原帖中查看解决方案

0 项奖励
回复
3 回复数
1,036 次查看
mjbcswitzerland
Specialist V

Amit

I took a quick look at the project in DMA-TEST-DMAT.zip.

My feeling is that the DMA is essentially set up correctly but I think that the UART is not configured for DMA operation - looking at the register UART4_C2 the receiver and transmitter have been enabled (0x0c) but there is no setup to trigger DMA transfers.To enable a peripheral DMA transfer to be triggered on reception the bit 0x20 must be set - for transmission bit 0x80.

It looks like the rx/tx are enabled using

  UART_PDD_EnableTransmitter(UART4_BASE_PTR, PDD_ENABLE); /* Enable transmitter */

  UART_PDD_EnableReceiver(UART4_BASE_PTR, PDD_ENABLE); /* Enable receiver */

so I think that you will need to eithert work out how to tell PE to "also" enable DMA at the UART (perhaps you forgot to tell it (?)) or else manipulate it by adding whatever calls are needed to do it later in your user code.

If your K20 project worked check which calls were used there and maybe you can work out why they are missing in this configuration.

Regards

Mark

µTasker Kinetis support

1,037 次查看
Amit_Kumar1
Senior Contributor II

Hi Mark

Thanks a lot for your valuable reply. I did the following changes and it is working for single character.

// UART_PDD_EnableReceiveDma(UART4_BASE_PTR, PDD_ENABLE); // Enable DMA for UART receive

UART4_C2 |= UART_C2_RIE_MASK;     // Interrupt /DMA Enable

UART4_C5 |= UART_C5_RDMAS_MASK;   // DMA

I wanted to know suppose I have char buffer[10]; the values coming in is 10 bytes , I want the DMA to flag the transfer complete if all 10 bytes are received. currently by setting buffer's address offset to 1, I am able to receive 10 bytes of data but in b/w DMA flag is flagging 2 times. also  I have configured it for single transfer.

What would you suggest as the above configuration didn't worked.

Kind Regards

Amit Kumar

0 项奖励
回复
1,036 次查看
mjbcswitzerland
Specialist V

Amit

You can control the num,ber of bytes transferred before the DMA completes by setting both DMA_TCD_BITER_ELINK and DMA_TCD_CITER_ELINK to the length that you require.

In DMA_TCD_CSR you can configure for an interrupt on half-transfer completion and/or on complete transfer completion.If you presently get two interrupts you may have both interrupts enabled.

Regards

Mark