This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

code & data allocation on flash of xc167

Question about flash programming of xc167. Flash is devided into 6 sectors, which can be erased separetly(?). I need to use flash for variable storage, which can be modified while program running, and for storage of executable code. But executable code i want to allocate to most significant adresses C1'0000 - C2'0000 (in sector of 64 kb) and modified variables to least significant adresses C0'0000 - C1'0000 (in sectors of 8 kb). How to do this and where i can determine start position for executeable code?
And what means 256-byte wordline in "Programming operations are supported by a 128-byte page buffer which can be loaded with maximum speed, and is then programmed with one single command sequence.Erase operations clear all bits of a selected sector or of a 256-byte wordline." Thanks.

  • Hi,

    yes the sectors are separately eraseable.
    The vectortable is free programable, so there is no difficulty to tell the Linker/Locator where it should be placed.
    ( Options for Target -> L166 Misc)
    The same can be done easy with your code,
    which you can locate also by some options
    under "Options for Target -> L166 Locate".
    ( Good example how to do , you can find in
    the C166 manual and A166 & Utiliies Guide
    under 'definition of the memory layout')
    Be sure to set your VECSEG Poiner to 0x00C1
    in startup code.

    The wordline simply means that you are able to clear 256 Byte (2 pages) per sector with one
    command sequence of the flash state machine,

    // AC - step and higher  pseudo code
    /* 1 command */
    A=Cx'xxAAh
    D=xx'80h
    /* 2 command */
    A=Cx'xx54h
    D=xx'AAh
    /* 3 command * /
    A=WLA ; WLA= Word Line Address
    D=xx03h
    
    while writing is done pagewise (128 byte per command sequence).
    // AC - step and higher  pseudo code
    /* 1 command */
    A=Cx'xxAAh
    D=xx'A0h
    /* 2 command */
    A=Cx'xx5Ah
    D=xx'AAh
    
    That may be not usefull for you, since an
    Erase Sector command is provided.
    // AC - step and higher  pseudo code
    /* 1 command */
    A=Cx'xxAAh
    D=xx'80h
    /* 2 command */
    A=Cx'xx54h
    D=xx'AAh
    /* 3 command * /
    A=SLOC ; SLOC= Sector Start Location
    D=xx33h
    
    It depends from what you want to do exactly.
    From your description it seems, that the
    Erase Sector command will be more interesting for you.
    BTW: A flashlib.c is provided by Infineon,
    which you can include to your project.

    At least be sure to use an AC-step or later of XC167, because the flash state machine internally has slightly changed with AC-step.
    And think about some RAM for loading the page buffer to reprogram the flash sector.

    Stefan

  • Thanks. But what file is flashlib.c? I can't find it.

  • Leave your mail account here,
    I will send it to you.

    Stefan