Folks,
I'm trying to use a gpio port of the BF707 to read in a stream of data from a fast external ADC. To see what sample rates would be possible, I used MDMA0 in the opposite direction and sent a toggling content of a testBuffer to the gpio data port register. The BF707 is clocked as fast as possible (PLL, cclk, sclk0 = 800, 400, 100 MHz).
for(i=0; i<100; i++) testBuffer[i] = (i&1)? 0:ADI_GPIO_PIN_8;
*pREG_PORTA_DIR_SET = ADI_GPIO_PIN_8; // IOA8 output
*pREG_DMA17_ADDRSTART = (void *) REG_PORTA_DATA; // start address of MDMA destination
*pREG_DMA16_ADDRSTART = testBuffer; // start address of MDMA source
*pREG_DMA16_XCNT = 100; // 100 words
*pREG_DMA17_XCNT = 100;
*pREG_DMA17_XMOD = 0; // increment = 0 (PortA data register MMR)
*pREG_DMA16_XMOD = 2; // increment = 2 (SRAM)
*pREG_DMA16_BWLCNT = 0; // set minimal bandwidth limit
*pREG_DMA17_BWLCNT = 0;
*pREG_DMA16_CFG =
ENUM_DMA_CFG_READ | // read from memory
ENUM_DMA_CFG_STOP | // stop mode
ENUM_DMA_CFG_MSIZE02 | // 2*8=16bit width memory bus
ENUM_DMA_CFG_PSIZE02 | // 2*8=16bit width peripheral bus (=connection to MDMA1_DST)
ENUM_DMA_CFG_SYNC; // clear fifo at start
*pREG_DMA17_CFG =
ENUM_DMA_CFG_WRITE | // write to Port data register
ENUM_DMA_CFG_STOP | // stop mode
ENUM_DMA_CFG_TRGWAIT | // wait for trigger
ENUM_DMA_CFG_MSIZE02 | // 2*8=16bit width memory bus
ENUM_DMA_CFG_PSIZE02 | // 2*8=16bit width peripheral bus (=connection to MDMA1_SRC)
ENUM_DMA_CFG_SYNC; // clear fifo at start
*pREG_DMA16_CFG |= ENUM_DMA_CFG_EN; // enable the DMA
*pREG_DMA17_CFG |= ENUM_DMA_CFG_EN; // enable the DMA
*pREG_TRU0_GCTL = BITM_TRU_GCTL_EN; // enable trigger propagating
// *pREG_TRU0_SSR38 = TRGM_SOFT0_MST; // slave 38 is MDMA0_SRC, assign it to master
*pREG_TRU0_SSR39 = TRGM_SOFT0_MST; // slave 39 is MDMA0_DST, assign it to master
*pREG_TRU0_MTR = BITM_TRU_MTR_MTR0 & TRGM_SOFT0_MST; // software trigger for master0
for(i=0; i<1000; i++); // let the DMAs happen
The MDMA works as expected. It generates 50 square waves but VERY slow:
In the other direction, when feeding a port input line with a 2MHz square wave testsignal, I see 6 MDMAs happen during one period. That translates in a MDMA frequency of 12MHz.
Does anybody know why? There should n't be anything that slows down the MDMA - I'm doing a simple empty loop waiting for completion. And there are no obvious interrupts. The generated or received bit patterns are steady.