infineon4engineers Facebook

infineon@google+ Google+

infineon@linkedin linkedin

infineon4engi@twitter twitter

infineon@youtube youtube

Dave

+ Reply to Thread
Results 1 to 2 of 2

Thread: XE167H FLASH programming sequence error!

  1. #1
    New Member New Member quakelin is on a distinguished road
    Join Date
    Apr 2017
    Posts
    2
    Points
    35

    XE167H FLASH programming sequence error!

    I'm using XE167H chip, and I'm testing flash programming function.
    The environment is as below:
    (1) Main program use Internal Flash Start from 0xC00000, code length less than 0xEFFF;
    (2) The program try to remove and write data into 0xC10000 to 0xCFFFFF;
    (3) I found that pages in 0xCxxx00 to 0xCxxx7F can be removed and written into, but pages from 0xCxxx80 to 0xCxxxFF can not be removed and written into, and will report sequence error;
    (4) changing to 0xC40000 - 0xCFFFFF leads to the same result;

    How to solve this problem, or any mistake?
    Thank you!

    Quakel

    /////////////////////////////////////////////////////////
    // Function to erase one page of the flash.
    // * Parameter: adr: page Address
    // * Return Value: 0 - OK, 1 - Failed
    ////////////////////////////////////////////////////////
    uword Flash_erase_page (ulong ulPage_Addr)
    {
    (*((uword far *) (base |0xAA))) = 0x80; // Erase Sector (1. Cycle)
    (*((uword far *) (base |0x54))) = 0xAA; // Erase Sector (2. Cycle)
    (*((uword far *) (ulPage_Addr))) = 0x03; // Erase Sector (3. Cycle)
    return (Flash_Check()); // Check until Device Ready
    }

    ////////////////////////////////////////////////////////
    // Function to Program one flash data page.
    // * Parameter: adr: Block Address
    // * buf: Block Data
    // * Return Value: 0 - OK, 1 - Failed
    ////////////////////////////////////////////////////////
    uword Flash_ProgramPage (ulong page_adr, void *buf)
    {
    uword cnt, uwTmp;
    // Enter Page Mode
    (*((uword far *) (base |0x00AA))) = 0x50; // 1st cycle: write 50h to xx'00AAh
    (*((uword far *) (page_adr))) = 0xAA; // 2nd cycle: write AAh to page start address
    uwTmp = (Flash_Check()); // Check until Device Ready

    if (uwTmp == 0)
    {
    // Load Page
    for (cnt=0; cnt<64; cnt++)
    {
    (*((uword far *) (base |0x00F2))) = (*(uword *)buf); // write word from R4 to xx'00F2h
    buf = (uword *) buf+1;
    }
    // Write Page
    (*((uword far *) (base |0x00AA))) = 0xA0; // 1st cycle: write A0h to xx'00AAh
    (*((uword far *) (base |0x5A))) = 0xAA; // 2nd cycle: : write AAh to xx'005A
    uwTmp = Flash_Check(); // Check until Device Ready
    }
    return (uwTmp);
    }

  2. #2
    New Member New Member quakelin is on a distinguished road
    Join Date
    Apr 2017
    Posts
    2
    Points
    35

    Cool The Problem is command mistakes from AppNote 16164!!

    This stupid error example is taken from AppNote 16164:
    /************************************************** ************************
    ** *
    ** INFINEON XC20007XE16x AP16164 , CAN_loader, Version 1.0 *
    ** *
    ** Id: FlashDev.c 2009-10-1 YS

    All the commands in AppNote 16164 is using the form "base | 0xAA" which can work on when address are xxxx00, it shall be modified to "( base & 0xFFFFFF00 ) | 0xAA".

    This error took me a whole day to solve, so don't take it for granted that AppNote examples are all correct!!!

+ Reply to Thread
Disclaimer

All content and materials on this site are provided “as is“. Infineon makes no warranties or representations with regard to this content and these materials of any kind, whether express or implied, including without limitation, warranties or representations of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, whether express or implied, is granted by Infineon. Use of the information on this site may require a license from a third party, or a license from Infineon.


Infineon accepts no liability for the content and materials on this site being accurate, complete or up- to-date or for the contents of external links. Infineon distances itself expressly from the contents of the linked pages, over the structure of which Infineon has no control.


Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Usage Terms of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Usage Terms of this site. Infineon reserves the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.