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.

Failed to erase flash

Hi,

I am working on TMS570 20216. After tried to copy flash block from 0x00080000 to 0x00000000, the error occur:

CortexR4: Flash Programmer: Error initializing device.
CortexR4: Flash Programmer: Error erasing Flash memory.
CortexR4: Flash Programmer: Error erasing Bank 0, Sector 0. Operation Cancelled.
CortexR4: Trouble Writing Memory Block at 0x80000 on Page 0 of Length 0x8
CortexR4: GEL: File: C:\test.elf: Load failed.
I am using CCS5.1.1. 
I have read several threads about this problem in the forum but no one got verified answer. It seems that the flash was locked (from other threads) but I don't know how to check it and why it was locked. 
Where can I find something like CSM? I can't find it in On-Chip Flash. 
Anyone has any idea?
thanks
  • some words can't displayed in my last post: 

    It seems that the flash was locked (from other threads) but I don't know how to check it and why it was locked. 
    Where can I find something like CSM (code security module)? I can't find it in On-Chip Flash. 
    I only found CSM (command state machine) in reference manual, are they the same things?
    is there anyone could give me an idea of locking flash?
  • Hello:

    I'll check with our experts to get an answer for your problem.

    Regards,

    Enrique Lizarraga

  • Good afternoon:

    Could you try the following and let me know the outcome?

    1)      Try programming the flash using nowFlash instead of CCS and see if that works.

    2)      Try connecting in a step-by-step way instead of clicking on the “Debug Active Project” in CCS:

              -  Right click on the target configuration file (.ccxml) and launch configuration

              -  Reset the target

              -  Connect to the target

              -  Go to Tools->On-chip Flash and click on Erase to erase the flash

    Thank you,

    Enrique Lizarraga

  • Hi, Enrique

    The second method does work.

    But it is strange because I have did this way before without "-Reset the target", it didn't work. I do "Reset the target" before connection this time, it works. Why?

    Thank you very much anyway.

  • Hi, Enrique

    It only works once!

    Now, the same problem occur and I can't erase flash in this way.

    By the way, I can't using nowFlash cause the process on a Jtag chain.

    I still want to know in what condition the flash can't be erased through Jtag?

    thanks

  • J Yin said:

    By the way, I can't using nowFlash cause the process on a Jtag chain.



    Based on this comment, I assume you are using a custom board and not a TMDX570LS20SMDK. Is that correct?

  • Yes, I am using custom board.

    It always works find until I do copy data between the sections in the Flash. I did this kind of copy many times,

    most of them are successful, then the problem jumped out.

  • J Yin said:

    It always works find until I do copy data between the sections in the Flash. I did this kind of copy many times,

    most of them are successful, then the problem jumped out.

    Just to make sure I understand what you mean here, are you saying that your code copies some data between Flash sectors at runtime? And with this code you have been able to erase/reprogram the flash many times in the past, but the problem has started appearing recently? What I am trying to understand is if this error has always appeared when trying to erase/program the device or only started appearing in a particular situation, and if so, what is it that triggered it to start appearing.

    Can you also attach a screenshot of your Flash programmer settings (where you can set which sectors are to be erased etc)?

     

  • Hi, you are right.

    I run the application on 0x00080000,  erase bootloader at 0x0 (bank 0, sector 0 to 3) and copy a new bootloader to that address. Then reset to run from 0x0.

    This function is under testing, so I have modified the bootloader, maybe copy in some unexpected data, but I can't remember any specific trigger for this error.

    I just thought that no matter what data was write (no matter where) in the flash, it should not forbid to erase flash through Jtag. am I right?

    thanks

  • Can you try changing the Erase options setting from "Necessary sector only" to "Entire Flash" and see if that helps?

  • I have done this but same error messages.

  • I have done this but same error messages.

    thanks

  • Hi,

    Just to clarify, your TMS570 20216 does is not locked, as this device does not support CSM/password programming.

    But based on the initial error "Error initializing device.", it is having trouble with the Flash operation setup sequence. The error itself does not provide enough information on the cause of the problem though.

    Just for your information, the main functionality of the initializing sequence is to set up the clock settings/PLL value of the device; based on the crystal value, which I can see you have it at the default value of 16MHz. Another thing thing to note is that the Flash algorithm is perform on target RAM memory, so make sure that is available.

    Other suggestions to try:

    1. Power cycle the device, and make sure the device is in a good state before trying to erase again.

    2. Generate the Debug Server logs (more information here: http://processors.wiki.ti.com/index.php/Troubleshooting_CCS#Debug_Server_Logging) during the test case, which might provide us with more information on where exactly the code is failing, although it most cases, it still does not give us enough information for debugging purposes. Either way, it could be a good thing to try.

    Please let me know if you have any questions.

    Thanks,

    Ricky

  • Hi J Yin,

    Has your problem resolved? because I am facing the same problem with LS20216 device.

    Thanks

    Sanjeev 

  • We had the same issue because we were using wrong PLL multiplier value in the PLL cntrl register.

    Check your PLL control register settings per manual.

    Thanks

    Sanjeev