|
If you can't view the Datasheet, Please click here to try to view without PDF Reader . |
|
Datasheet File OCR Text: |
december 2013 docid025623 rev 2 1/22 AN4417 application note spc564axx/spc56elxx devices exception handling and single/double bit error introduction this document provides an overview of spc564axx/spc56elxx exception handling with main focus on different kinds of exception that the application code may face during the runtime like single and double bit errors in memories, mpu protection violation, aips access protection violation and others. it starts with the simple overview of machine check interrupt highlighting important things from application perspective. to get detailed view and to implement low level machine check interrupt handler, it is necessary to use z4 core user manual which describes all the details about the core exception and interrupts. the following part describes the reason of the exception, how to find it and what possibilities exist to remove the fault. www.st.com
contents AN4417 2/22 docid025623 rev 2 contents 1 z4 core exception overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.1 machine check interrupt (ivor1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.1.1 machine check registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2 machine check handler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.1 low level handler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.1.1 start phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.1.2 final phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.1.3 modification of the mcsrr0 register . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.2 user handler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3 spc564axx/spc56elxx exception cases . . . . . . . . . . . . . . . . . . . . . . . 12 3.1 flash 2b ecc error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.1.1 cause of the exception . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.1.2 machine check exception status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.1.3 flash 2b ecc error detection by ecsm . . . . . . . . . . . . . . . . . . . . . . . . 13 3.1.4 ecsm_esr.fnce implementation note for spc564a70 device only . 14 3.1.5 ecsm_esr implementation for spc56elx device only . . . . . . . . . . . . 14 3.1.6 flash 2b ecc error detection by flash controller . . . . . . . . . . . . . . . . . 14 3.1.7 flash_x.mcr.err implementation note for spc564a80 device only . 15 3.1.8 user exception handler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.1.9 error solving . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 appendix a comparison of microcontroller behavior during ecc error . . . . . 17 appendix b reference documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 b.1 acronyms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 docid025623 rev 2 3/22 AN4417 list of tables 3 list of tables table 1. machine check interrupt causes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 table 2. machine check register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 table 3. machine check causes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 table 4. spc564axx/spc56elxx exception causes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 table 5. flash 2b ecc - machine check exception status in core registers. . . . . . . . . . . . . . . . . . . 13 table 6. flash 2b ecc ? ecsm registers related to ecc error detection . . . . . . . . . . . . . . . . . . . . 13 table 7. flash 2b ecc ? flash controller registers related to ecc error detection. . . . . . . . . . . . . . 15 table 8. summary of reactions to single/double bit error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 table 9. acronyms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 table 10. revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 list of figures AN4417 4/22 docid025623 rev 2 list of figures figure 1. machine check exception flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 figure 2. modification of mcsrr0 register content. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 figure 3. machine check exception user handler flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 figure 4. flash 2b ecc error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 docid025623 rev 2 5/22 AN4417 z4 core exception overview 21 1 z4 core exception overview z4 core used on spc564axx/spc56elxx devices contains many exception sources and sixteen interrupts to service them. multiple exception sources can be mapped to one interrupt handler where few supportive status registers provide flags to find the cause of the exception in the handler. detailed list of the exception causes and their mapping to interrupt handlers is found in the z4 core reference manual (see section appendix b: reference documents ). this chapter gives an overview of machine check interrupt that is utilized for several important fault states of spc564axx/spc56elxx devices. 1.1 machine check interrupt (ivor1) machine check interrupt is a handler that services multiple fault events that may occur during runtime code execution. this interrupt is used to handle various faults generated by peripherals in the spc564axx/spc56elxx devices, like mpu protection fault, 2b ecc error in the flash or ram memory etc. the reason is that most of the faults are signaled back as external bus error situation during the cpu-submodule bus transaction. 1.1.1 machine check registers z4 core implements few machine check status registers that are updated upon the exception event with some constraints stated in the z4 core reference manual (see section appendix b: reference documents ). these registers are used to find the source of the exception and based on, it is decided how to solve it. table 1. machine check interrupt causes interrupt type exception conditions machine check -nmi -isi, itlb, error on first instruction fetch for an exception handler -parity error signaled on cache access -external bus error z4 core exception overview AN4417 6/22 docid025623 rev 2 machine check syndrome register (mcsr) this register is the first register to check additional information about the cause of the exception. there are three groups of machine check causes. machine check address register (mcar) mcar register contains target address reporting the fault condition. it is updated only for asynchronous machine check group when mcsr.mav bit is cleared and it is valid only if mcsr.mav status flag is set. otherwise the mcar register cannot be used in the fault analysis. it is important to clear mcsr.mav bit after reading mcar register value to enable capture of the address, in case of new asynchronous machine check fault. machine check mcsrr0 register this register is updated by the hw in the beginning of the machine check interrupt. it stores the address of the instruction that causes the error condition. table 2. machine check register register content mcsr (syndrome register) register indicates the source of machine check, this condition gives the possibility to differentiate between them mcar (address capture) register contains some sort of machine check conditions, the address for which the asynchronous type of the machine check exception was raised. address valid only when mcsr.mav bit was ?0? before the exception, otherwise mcar register is not updated. mcsrr0 (save/restore register) address of the instruction that caused the exception. once the exception is finished (mcrfi instruction), program starts execution with the same instruction, that was the cause of the exception. table 3. machine check causes machine check cause brief description error report machine check ( i f, l d , s t, g ) these exceptions are directly associated with the current instruction execution stream. they are not masked with msr me bit. it means that the exception is always taken whenever the condition occurs. they differentiate among instruction fetch, data store and load. non-maskable interrupt (nmi) not msr me gated exception occurs when nmi signaling is enabled and nmi pin is driven low. asynchronous machine check (bus_ireer, bus_drerr, bus_wrerr) exceptions reported by the subsystem, usually as bus error termination, back to the core. they are enabled by msr me bit and are cumulative. this machine check whether the exception group triggers capture of the corresponding address to the mcar register and if mcsr mav bit is cleared. if mcsr mav was previously set, then the mcar register is not affected. docid025623 rev 2 7/22 AN4417 z4 core exception overview 21 it is used in the end of the machine check when mcrfi instruction is executed to fill the instruction pointer. the result is that code restarts the same instruction that was cause of the error, if additional modification of the mcsrr0 register is not explicitly done. machine check handler AN4417 8/22 docid025623 rev 2 2 machine check handler machine check handler usually splits into two parts: ? low level handler ? user handler 2.1 low level handler low level handler is responsible for first and last part of the exception execution. it is usually written in assembly language as it needs to execute proper instruction sequence before it can pass the code execution to higher level routine and accesses special purpose core registers. the middle of the interrupt service routine belongs to the user handler where analysis of the root cause of the exception and fault removal is done. once the user handler finishes, code execution is given back to the low level driver to finish the interrupt and return back to the interrupt process. figure 1. machine check exception flow 0 d f k l q h f k h f n h [ f h s w l r q ( [ f h s w l r q k d q g o h u v w d u w x s 6 w r u l q j d o o v w d w x v l q i r u p d w l r q q h h g h g 8 v h u k d q g o h u 5 h v w r u l q j w k h l q w h u u x s w h g f r q w h [ w 5 h w x u q l q j i u r p l q w h u u x s w + : x s g d w h v 0 & |