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.

UCD3138064: How to Erase Program flash page? (UCD3138064)

Part Number: UCD3138064
Other Parts Discussed in Thread: UCD3138

Dear Sir/Ms.

Technical Reference Manual (SNIU028A),chapter 17.5.2 writes to the program flash control register and does a mass erase.  The example code is to clear total program bank. 

How to to erase program flash in page? Did someone can guild me about it in detail?

What registers should be used?

Best Regards,

Kami Huang

  • Kami, it works just like the data flash page erase. Instead of setting the MASS_ERASE bit in the PFLASHCTRL register, you set the PAGE_ERASE bit.
  • Happy The New Year.
    Last Week is the Chinese New Year.
    I test in same procedure, I found UCD3138064 can erase program flash page but UCD3138 can not erase program flash page.
    Very interesting.

    varialbe page_number
    My process as following
    clear RONLY bit
    what for PFLASHCTRL.bit.BUSY bit =0
    FLASHILOCK= PROGRAM_FLASH1_INTERLOCK_KEY (in tech. reference 0x42Dxxxxx)
    PFLASHCTRL = page_number | 0x200
    set RONLY bit
    Done.
    UCD3138064 working , UCD3318 don't working.
    Did i write something wrong in UCD3138?
    Best Regards,
    Kami Huang
  • While anything in a flash block is being erased or written to, that flash block is going to return all FFs.

    This means you can't erase a flash block or page, or write to a word in that flash block and simultaneously execute from it.

    So since the UCD3138 only has one program flash block, if you want to erase a page, you have to execute from somewhere else, ideally RAM, while you erase it.

    The UCD3138064 has two program flash blocks, so you can execute from 1 flash block while erasing pages in the other one. 

  • Hello Ian
    Thank your deep explain.
    I understand now and I will test to erase program plash page in UCD3138.
    Please allow me explain How to erase program flash in my previous UCD3138 code.
    I use bootflash project from address 0x0000~0x1fff, load a app from address 0x2040~0x7fff.
    Actually, app store in address 0x2040~0x6xxx.
    Boot flash in charge to erase address 0x3000~0x5fff when I place one GPIO form high to low.
    Best Regards,
    Kami Huang