This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

F28069 GPIOs simulate 16bit EMIF

Dears,

Do you have a sample code which used GPIOs simulate 16bit EMIF? Or could you please advise how to improve the simulate EMIF R/W speed? thanks a lot! 

According to the datasheet, GPIO toggling frequency is 22.5MHz. unfortunately, It takes me 102 CPU cycles for a 16bit data read and write cycle by using below codes. Could you advise how to improve the efficiency? 

#define DATA_EN_H  GpioDataRegs.GPADAT.all |= 0x01000000 
#define DATA_EN_L  GpioDataRegs.GPADAT.all &= 0xfeffffff 

#define DATA_CLK_H GpioDataRegs.GPADAT.all |= 0x00800000 
#define DATA_CLK_L GpioDataRegs.GPADAT.all &= 0xFF7FFFFF 

	for(i=0;i<len;i++)
	{
		//setup data
		tmp= ( ((Uint32)(*(pdata_in+i))&0xf000)<<6 ) +  (((Uint32)(*(pdata_in+i))&0x0fff)<<4);
		GpioDataRegs.GPADAT.all &= 0xffc3000f;     //clear 16bit data;
		GpioDataRegs.GPADAT.all |= tmp ;           //set   16bit data;

		//HOLD CLK HIGH
		DATA_CLK_H;                            // clk high ;
		GpioCtrlRegs.GPADIR.all &= 0xffc3000f; // dir=input

		//HOLD CLK LOW
		DATA_CLK_L;                            // clk low;

		//read data
		tmp=GpioDataRegs.GPADAT.all;
		*(pdata_out+i)= ( (tmp>>6) & 0xf000) + ((tmp & 0x0ffff) >> 4);
		// dir=output
		GpioCtrlRegs.GPADIR.all |= 0x003cfff0;
	}

  • Gavin,

    I don't know of an example which implements an EMIF-like function using GPIO. It's possible others on this forum might know but I have not personally seen one.

    You can get an idea where those cycles are being spent by looking at the code lines in the disassembly window. With no optimization a lot of cycles are being burned formatting the data in lines 10 & 23 above. You can reduce this some by turning on the optimizer, but on my setup but it doesn't change dramatically. If the data can be pre-formatted and held in a buffer of some kind it may help with throughput, but you'll still be paying for those cycles elsewhere.

    I notice a lot of the register read/writes are being made with 16-bit instructions even though the registers are 32-bits wide. You will certainly be able to improve performance by coding in assembly, but again I don't know of an example where this is done to build an EMIF.

    There are some useful general hints on GPIO usage on this Wiki page:
    processors.wiki.ti.com/.../General_Purpose_IO_(GPIO)_FAQ_for_C2000

    Sorry not to have more on this.

    Regards,

    Richard
  • Thank you Richard. Seems that I need spend some time to study the assembly instructions.