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.

Undef Instr Exception on Sector 0 Erase



Hello

I have a problem with using the F035 Flash Api on a TMS570. I am running the library from RAM. So far I can successfully erase and program all banks and sectors except Bank 0 - Sector 0. When I run the code through the debugger, I can see that it goes through the Flash_Erase_B routine successfully and as soon as I try to re-enable my interrupts, an exception occurs at 0x4. When looking at the memory browser, I can see that the Flash on Bank 0, Sector 0 has been successfully erased, and since the exception that I keep getting is an "Undefined Instruction Exception", it is making it very hard for me to figure out what is wrong here. (By the way the code that calls the F035 API that is in RAM, is running from Bank 1.)

This behaviour occurs on none of the other sectors. I have Flash ECC turned off and I disable all my interrupts before calling the F035 library. I am also running in Privilege mode. All the examples that I have seen that use the F035 Flash API do not use interrupts, and since this problem seems to have to do with re-enabling the interrupts, I am wondering if anyone else has come across this problem?

Many Thanks,

Kieran

  • Have you tried programming data to Bank 0, Sector 0 before enabling interrupts?  I think you may have an unserviced interrupt that it is trying to handle when you enable interrupts and since the interrupt vectors are in Bank 0, Sector 0 and erased state is an undefined instruction, this could be why you are getting the abort.

  • Hi John Thanks for your reply. I have realised what I have been doing wrong. After I erase Bank 0 Sector 0, all interrupts thereafter are trying to go to the interrupt vector table in bank 0 sector 0, which has obviously now been erased. Unfortunately after I have erased sector 0 of bank 0, I need to enable my interrupts in order to get the data required to program sector 0 of bank 0. I also have a question with regard to running the F035 Flash API in RAM. I am currently running the library in RAM, but I would like to know if the library has to be run in RAM or can it function just as reliably in Flash memory? Many Thanks Kieran
  • Hi Kieran, The read and verify functions must be run from RAM as they change the Read Margin modes that affect the entire Flash. Other operations that modify the Flash like Erase and Program can be executed from Flash as long as they are not trying to perform an operation in the same bank where the code is being executed from.