OK, so I've been working on several things but this part is still not working.
I've setup 2 DMA as described above and I have 2 simple IRQ to reload them:
/*----------------------------------------------------------------------------
DMA1_Handler: reloads the destination buffer
*----------------------------------------------------------------------------*/
void DMA1_IRQHandler(void) {
DMA0->DMA[1].DSR_BCR |= DMA_DSR_BCR_DONE_MASK ; /* clear by writing 1 */
DMA0->DMA[1].DAR = (uint32_t) &uiADC_buffer[0]; /* destination: ADC results circular buffer */
DMA0->DMA[1].DSR_BCR = DMA_DSR_BCR_BCR(uiDMA1_BCR);
}
/*----------------------------------------------------------------------------
DMA0_Handler: reloads list of ADC channels' SC1
*----------------------------------------------------------------------------*/
void DMA0_IRQHandler(void) {
DMA0->DMA[0].DSR_BCR |= DMA_DSR_BCR_DONE_MASK ; /* clear by writing 1 */
DMA0->DMA[0].SAR = (uint32_t) &(uiADCcfg_SC1[0]) ; /* next TPM IRQ will start DMA0 which will start fomr ch0 */
DMA0->DMA[0].DSR_BCR = DMA_DSR_BCR_BCR(uiDMA0_BCR);
}
After configuration I get:
BCR1=30
DAR1=0x1FFFF0F4
and
BCR0=1C
SAR0= 0x1FFFF2F4
after the first ADC I set up and IRQ to monitor what happens and I would expect the counters to decrement by and the addresses to increment by 4 (32bit=4bytes).
However the address actually have decremented!
DAR1=0x1FFFF010
SAR0=0x1FFFF2D0
I'm at a loss...any ideas?
Thanks!