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.

How to test External NOR flash connected to TMS570 by EMIF

Other Parts Discussed in Thread: HALCOGEN, TMS570LC4357

I want to test external DRAM and NOR flash connected to TMS570 by EMIF.

DRAM is working correctly. I wanted to know how to test my NOR flash. I am using HALCOGEN for code generation.

My safety micro is connected to Async1 and its memory is defined as 0x60000000.

First I initialized Async1 by calling  emif_ASYNC1Init();


Then I used following code for writing and reading from NOR flash.

{    
    
       unsigned short *NORF_ptr = ( unsigned short *)0x60000000;
      unsigned short Read_back_data;
      *NORF_ptr = 0x1234;
      Read_back_data = *SRAM_ptr;

}

I am not getting the value 0x1234 in Read_back_data variable. Also checked the memory locations, it shows data like 0000E040

So I would like to know whether my testing method is correct or not.

If the testing method is correct then it may be the configuration issue.

  • Hello Ragesh,

    You can not write the data directly to the NOR flash address. You need to follow the read/write sequence defined in NOR flash datasheet.

    For example: S29GL01 NOR flash

    To write a word (Word Program) to NOR flash, you need to:

    1. write AA to 0x555

    2. write 55 to 0x2AA

    3. write A0 to 0x555

    4. Then write your data (PD) to the specified address (PA)

  • Hi Wang,

    Thank you very much for the support.

    I am using S29GL128S10DHB010 as external flash.

    I used the following code to write a single word in a flash memory location

    void program_word()
    {
        uint16_t *base_addr = (uint16_t *)0x60000000;
        uint16_t *pa = (uint16_t *)0x60000100;
        uint16_t data = 0x1234;
        
      *( (uint16_t *)base_addr + 0x555 ) = 0x00AA;   /* write unlock cycle 1            */
      *( (uint16_t *)base_addr + 0x2AA ) = 0x0055;   /* write unlock cycle 2            */
      *( (uint16_t *)base_addr + 0x555 ) = 0x00A0;   /* write program setup command     */
      *( (uint16_t *)pa )                = data;     /* write data to be programmed     */

    }

    When I look in to the memory location 0x60000100 , it shows different values, most time it shows 0x000e0000.

    I am using TMS570LC4357 as MCU, and the EMIF async memory  is defined in 0x60000000, so I used the base address as 0x60000000, this memory is also defined in linker file.

    Is my understanding and above test code is correct ?

    Thanks and Regards,

    Ragesh M R

  • Hi Wang,

    I have tried the sequence, but it is not working.

    Please give any suggestion to test it, I am not able to probe the signal in the board since it is multi layered.

    Thanks and Regards,

    Ragesh M R

  • I have followed the sequence, still it is not working
  • Can you try this:

    *( (uint16_t *)base_addr + 0xAAA ) = 0x00AA; /* write unlock cycle 1 */
    *( (uint16_t *)base_addr + 0x554 ) = 0x0055; /* write unlock cycle 2 */
    *( (uint16_t *)base_addr + 0xAAA) = 0x00A0; /* write program setup command */
    *( (uint16_t *)pa ) = data; /* write data to be programmed */
  • Hello Ragesh,

    I assume that you have solved the problem with the NOR flash read/write.