configure DMA to trigger interrupt end of major loop

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

configure DMA to trigger interrupt end of major loop

721 Views
trichert
Contributor I

How do I configure a DMA to trigger the INTMAJOR interrupt on the completion of a major loop?

I am using MQX RTOS on a k60f120 board through CodeWarrior.

void dma_ch1_isr( void *user_isr_ptr){ DMA_CINT = DMA_CINT_CINT(0);}

uint16_t dma_dst[16] = {0};

uint16_t dma_src[16] = {0xF, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xA};

_int_install_isr(16, dma_ch1_isr, NULL);

_bsp_int_init(16, 3, 0, TRUE);

DMAMUX0_CHCFG0 = 0;//use software trigger

DMAMUX1_CHCFG0 = 0;

DMA_TCD0_SADDR = (uint32) &dma_src[0];//source address

DMA_TCD0_SOFF = 2;                                  //src addr ubcr

DMA_TCD0_SLAST = 0;                                //minor loop end decr

DMA_TCD0_DADDR = &dma_dst[0];            //dest address

DMA_TCD0_DOFF = 2;                                 //dest addr incr

DMA_TCD0_DLASTSGA = 0;                       //minor loop end decr

DMA_TCD0_NBYTES_MLNO = 8;              //transfer 4 words

DMA_TCD0_BITER_ELINKNO = 1;//one major loop iteration

DMA_TCD0_CITER_ELINKNO = 1;

DMA_TCD0_ATTR = DMA_ATTR_SSIZE(1) | DMA_ATTR_DSIZE(1);

DMA_TCD0_CSR = DMA_CSR_INTMAJOR_MASK; //interrupt after major loop ends

DMA_SSRT = DMA_SSRT_SSRT(0);//start DMA

while(!(DMA_TCD0_CSR & DMA_CSR_DONE_MASK)){}//wait for DMA

The data transfer is successful if the DMA_CSR_INTMAJOR bit is not set.  The program hangs to "_mqx_idle_task" when the SSRT start bit is set if the DMA_CSR_INTMAJOR bit is set.

Any ideas on what I am doing wrong or a different approach I could use?  If anyone can tell me how to format code blocks in these discussion things, I would appreciate that too.

Labels (1)
Tags (3)
0 Kudos
1 Reply

352 Views
trichert
Contributor I

I figured it out.  I had an error in my "user_config.h" header.

0 Kudos