Hello All !
We have the TMS320c6678 EVM and we want to transfer a lot of data from an external FPGA (16 bit word). We are going to use EMIF16 for this purpose. Unfortunately, I'm beginner in this subject. I have read several discussions on this foum on EMIF16. As for as I understood the most effective way is:
1.EMIF16 CEn
2.CEn ->DDR by EDMA
So, in my project I have configured EMIF16 and tried to read data. My simple code is:
#define EMIF16_DATA_REG_ADR 0x70000000
CSL_Emif16Regs EMIF16_REGS;
void main ()
{
volatile uint16_t *pData;
pData = (uint16_t*) EMIF16_DATA_REG_ADR;
volatile uint16_t EMIF_DATA;
// Little Endian mode
CSL_FINS(EMIF16_REGS.RCSR, EMIF16_RCSR_BE, 0);
// enable 16-bit mode
CSL_FINS(EMIF16_REGS.A1CR, EMIF16_A1CR_ASIZE , 1);
/* FOR CHIP SELECT 0 */
EMIF16_REGS.A0CR = (0 \
| (1 << 31) /* selectStrobe */ \
| (0 << 30) /* extWait */ \
| (1 << 26) /* writeSetup 12 ns */ \
| (3 << 20) /* writeStrobe 24 ns */ \
| (0 << 17) /* writeHold 6 ns */ \
| (1 << 13) /* readSetup 12 ns */ \
| (7 << 7) /* readStrobe 48 ns */ \
| (0 << 4) /* readHold 6 ns */ \
| (1 << 2) /* turnAround 12 ns */ \
| (1 << 0)); /* asyncSize 16-bit bus */ \
/* Set the wait polarity */
CSL_FINS(EMIF16_REGS.AWCCR, EMIF16_AWCCR_WP0, CSL_EMIF16_AWCCR_WP0_WAITLOW);
CSL_FINS(EMIF16_REGS.AWCCR, EMIF16_AWCCR_CE0WAIT, CSL_EMIF16_AWCCR_CE0WAIT_WAIT0);
EMIF16_REGS.AWCCR = (0x80 /* max extended wait cycle */ \
| (0 << 16) /* CE0 uses WAIT0 */ \
| (0 << 28)); /* WAIT0 polarity low */ \
clock_t t_start, t_stop, t_overhead, t_opt;
t_start = clock();
t_stop = clock();
t_overhead = t_stop - t_start;
t_start = clock();
EMIF_DATA = *pData;
t_stop = clock();
printf("\tIN DATA VALUE: %d\n", EMIF_DATA);
printf("\tIN DATA: %d clock cycles\n", (t_stop - t_start) - t_overhead);
}
Here I have read data one time and measure how long time does the reading procedure take (marked red). I found that this time is about 600 clock cycles ! This is very-very slow. CPU frequency is 1 GHz, so 600 cycles = about 0.6 mks per one value (2 bytes). Totally this is only ~1.5 Mb/sec. To speed up the reading procedure I have to use EDMA3, but I have no idea how to do this. Could anybody help me ? How to configure and use EDMA ? Is there any sample code ?