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.

TMS320F28379D: Writing to external Flash memory through EMIF interface

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

In my project I use S29GL128S90TFI010 flash memory and TMS320F28379D microcontroller, which communicate via EMIF1 interface.

I used example project called emif_dc_flash from C2000Ware. I modified pinout for my project. Whereas I used EMIF1CS4 in my project, so I had to correctly modify EMIF_DC_initCS2 function. 

Enter to CFI mode works fine. Checking CFI data is correct. Clearing the flash memory also works correctly.

But the EMIF_DC_programCS4Flash() function does not write any data to the flash memory. It is a customized EMIF_DC_programCS2Flash() function for the EMIF1CS4.
The definition of this function is:

//
// EMIF_DC_programCS4Flash - Program single 16b word to Flash address
//
void EMIF_DC_programCS4Flash(Uint16 emifModule, Uint32 addr, Uint16 data) {
    Uint16 cmdNum;
    Uint32 CS4Addr;
    Uint16 restorePage;

    restorePage = EMIF_DC_activeCS4Page;

    EMIF_DC_selectCS4Page(emifModule, 0);

    if( emifModule == 1 ) {
        CS4Addr = EMIF_DC_EM1_CS4_ADDR;
    }


    for(cmdNum=0;cmdNum<sizeof(EMIF_DC_FLASH_PROG_SEQ)/2;cmdNum++) {
        *(Uint16*)(CS4Addr + EMIF_DC_FLASH_PROG_SEQ[cmdNum][EMIF_DC_FLASH_SEQ_ADDR]) = EMIF_DC_FLASH_PROG_SEQ[cmdNum][EMIF_DC_FLASH_SEQ_DATA];
    }

    if( restorePage != EMIF_DC_activeCS2Page ) {
        EMIF_DC_selectCS4Page(emifModule, restorePage);
    }

    *(Uint16*)addr = data;

    F28x_usDelay(EMIF_DC_FLASH_BUSY_DELAY); // Wait for Ready/Busy# signal to become valid

    while( GPIO_ReadPin(EMIF_DC_FLASH_READY[emifModule]) == 0 ); // Wait for Flash to complete command
}

where

#define EMIF_DC_EM1_CS4_ADDR 0x00380000

Do you have any advice for me? What am I doing wrong?
Thank you for your answers.

Regards


Joseph

  • Joseph,

    Your flash device has many newer features than the one used in the example code so there could be some additional command requirements.  However, I would expect the older command sequences (such as word programming) to be backward compatible.

    At this point, you will want to do some ground-up checks of the bus activity to make sure that they match the word-programming command sequences and timing diagrams from the flash datasheet.  Since CFI queries appear to work, you can focus on any pin resources or handshaking requirements that are used for word-programming, but not for CFI queries.  It will be difficult to confirm if the erase sequence is working on a fresh device that has not been programmed.

    I also noticed that you are looking at the active CS2 page instead of CS4 page when determining whether to restore the CS4 page.

    if( restorePage != EMIF_DC_activeCS2Page ) {
        EMIF_DC_selectCS4Page(emifModule, restorePage);
    }

    -Tommy

  • Hi Tommy,

    Basic commands are same to S29AL016J flash device.

    I can confirm Chip erase sequence doesn't work. Status register returns erase fail (5th bit of Status register is set).

    I will focus on the bus activity and timing.

    Regards

    Joseph

  • Joseph,

    It has been a while since your last update.  I assume that you were able to resolve your issue.

    If not, please reply to this thread.  If the thread has locked due to timeout, please create a new thread describing the current status of your issue.

    -Tommy

  • Hi,

    Sorry for my inactivity, I couldn't devote myself to this project for a few days.

    I observed, when I send CFI Enter Command, data in Memory browser is correct as stated in the S29GL128S datasheet. But the data is repeated with the address offset 0x100. This situation is shown in the picture below.

    Could you please explain to me why? Where could the problem be?
    Thanks.

    Regards,

    Joseph

  • Joseph,

    It would appear that the Flash is either not detecting or not responding to the values of the higher address signals.

    I recommend probing the address signals at the Flash memory to make sure that they are satisfying the VIH and VIL levels.  Also check the CFI definition in the Flash datasheet to see if the section is perhaps limited to 0x100 words.

    -Tommy

  • Thank you, Tommy

    Higher address signals (A8 - A21) didn't satisfy voltage levels. Bad PCB design probably.

    Best Regards,

    Joseph

  • Joseph,

    Thanks for reporting back your findings; they can be helpful to other users.

    I hope you are able to get your flash working soon now that you know what is causing problems.

    -Tommy