So the interrupt never fires? I might have a slight idea :P.
Set the interrupt using a dynamic vector (Nvic_SetVector(....)), to the function with a different name (this one is reserved). There is a double bug with the K22F interrupt vector: Firstly it is relocated to the wrong location (in the middle of the RAM, so if you use near 50% of your RAM, it will crash. I reported the bug, still open). Secondly is that it only relocated part of the interrupt vectors. I am not sure, so maybe it isn't the problem, but if the DMA is one of those it does not relocate, it will crash.
If you set it dynamically it does not need to relocate anything. The first bug is still relevant then, but you arent using that much ram yet (when you end up at 0x1FFFE000 you have a problem), and the second one should be circumvented.
I am trying to set up DMA with I2S in a FRDM K22F. I got I2S running and the module it writing data to the I2S0_RDRO register. I have it set up to request DMA on FIFO Request Flag. I am now having a very hard time with DMA. My code is below:
SIM_SCGC6 |= 0x2; //DMAMUX Module Turn On SIM_SCGC7 |= 0x2; //DMA Module Turn On DMAMUX_CHCFG0 = 0x8C; //I2S Source: Slot 12 & Activate DMA_TCD0_CSR &= 0xBF; //Inactive NVIC_EnableIRQ(DMA0_IRQn); //Enable IRQ DMA Channel 0 DMA_TCD0_SADDR = (uint32_t)&I2S0_RDR0; //Data Source DMA_TCD0_DADDR = (uint32_t) BUFFER_A; //Destination DMA_TCD0_SOFF = 0; //No Source Offset DMA_TCD0_SLAST = 0; //Nothing Added to Source Address after Major Loop DMA_TCD0_DLASTSGA = -4096; //Value Added to Destination Address after Major Loop DMA_TCD0_DOFF = 4; //4 Byte Destination Offset DMA_TCD0_NBYTES_MLNO = 4; //4096 Bytes Transfered in Minor Loop DMA_TCD0_BITER_ELINKNO = 1024; //1024 Bins DMA_TCD0_CITER_ELINKNO = 1024; //1024 Bins DMA_TCD0_ATTR = 0x202; //32-Bit Transfer Size DMA_TCD0_CSR = 0x2; //Interrupt Major Iteration DMA_SERQ = 0x0; //Channel 0 Enable DMA_TCD0_CSR |= 0x41; //Enable!I have a while (1) loop in main which just reads to DADDR register to make sure the destination address of my BUFFER_A is updating correctly. But it isn't and my code is crashing: