Cart New Account Login

HomeAbout usProductsSupportForumsBlogCustomer Service

Please accept the use of cookies on our site

At PEmicro we use web browser cookies in order to provide you with an enhanced experience and in order to be able to do things like shopping cart processing and identify you when you login to our website.

Click here to accept

search inside this forum
search inside all forums
How to do erase byte range in freescale kinetis K22 chip?
george g. Dec 3, 2014 at 07:17 AM (07:17 hours)
Staff: Takao Y.

  • Hi,

    My current situation
    I have freescale k22 chip - MK22FN1M0VLQ12R and use "image creation utility" tool.
    1)I use three steps to create a SAP file
    a. CM->choose freescale_k24fn1m0m12_1x32x256k_pflash.arp file
    b. SS->choose s-record file.
    c. EN->erase if not blank.
    The result is the SAP works.

    My question
    1)But I don't want to do "module erase" operation - I guess it is "EN" or "DO_MASS_ERASE_AND_RESET" listed in .arp file?

    2)I want to do *sector erase" in a range from 0x00000 to 0x7efff. How to do it in "image creation utility" tool.



  • Greetings,

    1) If DO_MASS_ERASE_AND_RESET is listed in the ARP file then our erase commands already will do just that, whether you do a EM: Erase Module, or EN: Erase if not blank. Note, you should actually use the command algorithm. You said you have a K22fn1m0, but you are selecting the k24fn1m0. If you are missing this algorithm then please download the latest from our website:

    2) Sector erase is supported as long as the correct algorithm is selected. Once you upload your algorithm, you should see the sector erase commands in the command listings within image creation utility.

    Takao Yamada

  • I am sorry, I describe the .arp wrongly.
    What I used really is freescale_k22fn1m0m12_1x32x256k_pflash.arp. I

    Do you think it is algrithm support to erase sector? I didn't found "erase sector" in it. you can see it is already the newest one.
    Below are .arp file contents

    ;version 1.02, 06/02/2014, Copyright 2014 P&E Microcomputer Systems, Inc. All rights reserved. [mk22_1024k_n_pflash0_pflash1_m10]
    ;device freescale, k22fn1m0m12, 1x32x256k, desc=pflash
    ;begin_cs device=$00000000, length=$00100000, ram=$20000000
    DO_MASS_ERASE_AND_RESET ;Perform MDM Mass erase
    NO_TIMING_TEST ;Flash module is self clocked
    WRITE_LONG=00FF003F/4001F000/ ;Disable Master0..2 prefetching
    WRITE_LONG=30040000/4001F004/ ;Disable Cache and Prefetching on Flash Bank 0,1
    WRITE_LONG=30040000/4001F008/ ;Disable Cache and Prefetching on Flash Bank 2,3
    WRITE_LONG=FFFFFFFF/40020010/ ;All PFlash protection off
    ADDR_RANGE=00000000/000FFFFF/00/FFFFFFFC/FFFFF800/ ; $00000000-$000FFFFF P-Flash
    TEST_VALUE=00/0000040C/00000033/00000020/00/003/007/Data that is about to be programmed will permanently secure the device. Continue?/
    TEST_VALUE=00/0000040C/00000033/00000021/00/003/007/Data that is about to be programmed will permanently secure the device. Continue?/
    TEST_VALUE=00/0000040C/00000033/00000023/00/003/007/Data that is about to be programmed will permanently secure the device. Continue?/
    ; turn off watchdog timer
    WRITE_LONG=4005200E/1FFFFF00/ ; dc32 0x4005200E ;wdog unlock address
    WRITE_LONG=40052000/1FFFFF04/ ; dc32 0x40052000 ;wdog control_h
    WRITE_LONG=500CF85F/1FFFFF08/ ; ldr r5,w_unlock_loc ;get wdog unlock address
    WRITE_LONG=600CF85F/1FFFFF0C/ ; ldr r6,w_control_h ;get wdog control address
    WRITE_LONG=5820F24C/1FFFFF10/ ; mov r8,#0xC520 ;get constants
    WRITE_LONG=1928F64D/1FFFFF14/ ; mov r9,#0xD928
    WRITE_LONG=0A02F04F/1FFFFF18/ ; mov r10,#0x0002
    WRITE_LONG=8000F8A5/1FFFFF1C/ ; strh r8,[r5] ;unlock wdog
    WRITE_LONG=9000F8A5/1FFFFF20/ ; strh r9,[r5]
    WRITE_WORD=BF00/1FFFFF24/ ; nop ;timing
    WRITE_LONG=A000F8A6/1FFFFF26/ ; strh r10,[r6] ;turn wdog off
    WRITE_WORD=BE00/1FFFFF2A/ ; bkpt #0x0
    SET_PC_AND_RUN=1FFFFF08/ ; disable software watchdog
    PUT_REGFILE=00/1FFFFF00/ ;Address in SRAM_LOW for timing routine
    ICS_RANGE=000312500/000390625/000006400/ ICS Range (LSB = decimal place)
    ;Sectors 64-4k (00..3F) PFlash0
    USER=P0 Sector Erase PFl0 2Page > /00000000/0000003F/
    ;Sectors 64-4k (00..3F) PFlash1
    USER=P1 Sector Erase PFl1 2Page > /00000000/0000003F/
    ;Sectors 64-4k (00..3F) PFlash2
    USER=P2 Sector Erase PFl2 2Page > /00000000/0000003F/
    ;Sectors 64-4k (00..3F) PFlash3
    USER=P3 Sector Erase PFl3 2Page > /00000000/0000003F/
    USER=SD Secure Device 0 /00000000/00000000/

  • BTW, I saw some USER commands. does it support erase the range from from 0x00000 to 0x7efff?

  • Greetings,

    The P0 sector erase, P1 Sector Erase, P2 Sector Erase, and P3 Sector Erase should be visible as an option. P0 indicates PFlash sector 0. When you select this command, it will ask you which of the 64 blocks of size 4K you want to erase. So you can select your erase range however you wish.

    Takao Yamada

  • Greetings,

    Any update on this? Were you able to find sector erase?

    Takao Yamada

  • Hi,
    My question
    I have freescale k22 chip - MK22FN128VLH10.
    1). Can you tell me for the tool support this devise programming?
    2). Now we used the PE multi universal but not support the algorithm.

Add comment

   Want to comment? Please login or create a new PEMicro account.

© 2018 P&E Microcomputer Systems Inc.
Website Terms of Use and Sales Agreement