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.

unable to configure emif16 in C6678

Hi,everyone

I'm trying to use emif16 and fail to configure it.

According to cslr_emif16.h I create a CSL_Emif16Regs handle EMIF16_REGS,fill the value and copy it to 0x20C00000(emif config address).But after memcpy the memory browzer tells me nothing has changede in EMIF config register.I find a post herehttp://e2e.ti.com/support/dsp/c6000_multi-core_dsps/f/639/p/171091/626862.aspx#626862

and I think maybe my LPSC for EMIF16 is shut down.

So I add this to my code(3 is module num for emif16 and srio according to datasheet of 6678) :

CSL_PSC_setModuleNextState(3,PSC_MODSTATE_ENABLE);    

CSL_PSC_startStateTransition(1);    

while(!CSL_PSC_isStateTransitionDone (1));    

while(!CSL_PSC_isModuleClockOn(3));

but the program stuck in while(!CSL_PSC_isModuleClockOn(3));,namely clock module for emif16 is still shut down.

I believe there is something I missed to configure it correctly,could anyone help me?

Thank you very much.

Zhao

  • Zhao,

    I believe you want to use Power Domain 0 for the EMIF16, so change the two lines to use the argument 0:

    CSL_PSC_startStateTransition(0);    

    while(!CSL_PSC_isStateTransitionDone (0));    

    Please let us know if this helps.

    Regards,
    RandyP

     

  • Hi,RandyP

    Thank you for your advice and it does help.But the datasheet tells me there is no relationship between power domain and clock module,and emif16 is in domain 0,which is always on,so why should I enable domain 0 before I enable emif clock module?

    One more question,I'am not sure the way I configure my emif is right.since there is no example,could you please spare me some time to teach me?Here is my code:

    #include<cslr_emif16.h>
    #include<csl_psc.h>
    #include<csl_pscAux.h>
    #include<string.h>
    
    #define emif16_CE0_address 0x70000000
    #define emif16_config_address 0x20C00000
    
    CSL_Emif16Regs *EMIFconfig;
    
    
    emif16_config(){
    	Uint32 *MDCTL3;
    	Uint32 *MDSTAT;
    	MDCTL3=(Uint32 *)0x02350A0C;
    	MDSTAT=(Uint32 *)0x0235080C;
    	CSL_Emif16Regs EMIF16_REGS;
    	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 */
        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 */
    
        CSL_PSC_enablePowerDomain (0);
        CSL_PSC_setModuleNextState (3, PSC_MODSTATE_ENABLE);
        CSL_PSC_startStateTransition (0);
    
        // Wait until the transition process is completed.
        while (!CSL_PSC_isStateTransitionDone (0));
    
        while(!CSL_PSC_isModuleClockOn(3));
        memcpy((CSL_Emif16Regs *)emif16_config_address,&EMIF16_REGS,sizeof(EMIF16_REGS));
    }
    main(){
    	int i;
    	EMIFconfig=(CSL_Emif16Regs *)0x20C00000;
    	Uint16 data[20];
    	emif16_config();
    	for(i=0;i<20;i++){
    		data[i]=i+1;
    	}
    	memcpy((Uint16 *)emif16_CE0_address,&data[i],sizeof(Uint16));
    	while(1);
    }
    
    .

    The function is very simple,all I want to do is writing some data through emif to fpga.I fill the CSL_Emif16Regs and copy it to 0x20C00000(emif config address),I doubt I do it right.In fact after I copy CSL_Emif16Regs to 0x20C00000(no write to CE0 yet),some of the emif data pins are already high,and OE,WE have 0101 sequence while RNW always 0.Then I memcpy a array to CE0 start address which is 0x70000000.but nothing change on the pins.(I observe the pins through logic analyzer).

    I believe my code is responsible for this strange phenomenon,could you please help me out?Thank you very much.

    Best Regards,

    Zhao

     

  • Zhao,

    To understand the use of the PSC module, the PSC User Guide is the best source of information. It explains in much better wording than I can and much greater detail than I can.

    Also, you can refer to example code to see how our debugged code uses these registers and peripherals. To figure out the problem with your code snippet, I searched on my laptop for EMIF16 and PSC in .c files and found some file that used the same CSL functions that you did but used different arguments.

    In the same way for the EMIF16 module, the EMIF16 User Guide is the best source of information on how things work in that module. It covers all the possibilities and explains with timing diagrams how different mode operate. Please refer to the EMIF16 User Guide to learn the operation of the EMIF16 module.

    For examples of how to program the EMIF16 module, search the MCSDK 2 folders for examples. Using a desktop search program, I found a few .c files that use the EMIF16 term and some that use the EMIF25 term. EMIF16 is the real name for the module meaning there are 16 pins, while EMIF25 is an internal term that refers to internal reference numbers. Sorry if there is any confusion because of that.

    Which example did you find that used the method of filling a CSL_Emif16Regs struct and copying it to 0x20C00000? My recommendation is to use a method shown in the MCSDK folders.

    Regards,
    RandyP