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.

TMS570LC4357: Read/write to NOR Flash S29GL128P from TMS570 via EMIF

Part Number: TMS570LC4357
Other Parts Discussed in Thread: HALCOGEN

Trying to write/read to the NOR Flash S29GL128P using EMIF but can only read 0xFFFF instead of the actual data that was written, here are my steps

  1. Halcogen settings
    1. Enabled EMIF interface but disabled the pins EMIF_nOE, EMIF_nDQM[0], EMIF_RNW due to conflicts
    2. Selected ASYNC1, selected NOR Flash
    3. Left the timing fields as default
  2. Added the following line to linker file HL_sys_link.c

    /* USER CODE BEGIN (3) */
    EMIF_1 (RX) : origin=0x60000000 length=0x00000100
    /* USER CODE END */

  3. Here is the main code

    int main(void)
    {
    /* USER CODE BEGIN (3) */

    _enable_IRQ_interrupt_();

    _mpuInit_();
    _mpuEnable_();
    emif_ASYNC1Init();

    uint16_t *base_addr = (uint16_t *) 0x60000000;
    uint16_t data1 = 0x1234;
    uint16_t Read_back_data = 1947;

    *((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 *) 0x60000000) = data1; /* write data to be programmed */
    __delay_cycles(150000);

    Read_back_data = *((uint16_t *) 0x60000000);

    /* USER CODE END */

    return 0;
    }

Questions:

  1. Any missing code/HALCOGEN settings to be added?
  2. As per the datasheet of the NOR Flash S29GL128P, polling algorithm should be performed after writing program data. This polling algorithm involves monitoring of the DQ pins. But the DQ pins are not found in HL_emif.c, HL_emif.h or HL_reg_emif.h. Where to access these DQ pins in the user space?

Many thanks in advance!

  • Hi Rachana,

    For interfacing NOR flash, is 8-bit mode or 16-bit mode used? 

    If 16-bit mode is used, the EMIF BA[1] should be mapped to NOR Addr[0]

    For 8-bit interface mode, the EMIF BA[1:0] should be connected to NOR Addr[1:0]

  • Where to access these DQ pins in the user space?

    DQ[x] is data pin of NOR flash. EMIF doesn't have DQ pin, but it has DQM pin which byte enable pin.

    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 */

  • Hi QJ,

    16-bit mode is used and yes, the EMIF BA[1] is mapped to NOR Addr[0]. I have double checked this on the board.

  • Ah yes, I meant the EMIF_DATA[x] pin on the TMS570 wihch is mapped to the DQ[x] pin on the NOR flash.

    I have updated with the lines you suggested, still the Read_back_data reads as 0xFFFF.

    Are there any further steps to be performed after the following line:

    *((uint16_t *) 0x60000000) = data1; /* write data to be programmed */

    Also, could you please confirm if the line added to the linker file HL_sys_link.c is sufficient?

     

  • HI Rachana,

    Please try my code. I developed this code years ago, and tested on TMS570 board.

    4010.Hercues NOR Flash.zip

  • Hi Wang, thanks for the code. Could you please clarify just one more thing:

    In the "TRM48L950FlashLnk.cmd" file, I see that the nor Flash memory starting and ending address are not listed under the Memory Map or the Section Configuration. Is it not necessary?

  • We don't have to add NOR flash address to linker command file.

    Does the code work for you? I developed this code 10 years ago.