Unused flash memory on xdg128b and illegal address reset

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Unused flash memory on xdg128b and illegal address reset

1,937 Views
gvn
Contributor I

Hello Friends,

 

I am new in this group,i am working on 9s12xdg128 microcontroller,what action we should take for unused FLASH memory? suppose my programme counter goes into unknown location of flash ,may be out of flash then how i can reset my programe so that my hardware unit not stuck.

 

There are two cases programe counter may be go into : 1.out of flash memory

                                                                            2.PC go into unused flash memory but that loacation within the flash memory range. 

 

in that case I think internal watchdog may not be work.but i think in 1.case illegal address reset may occure is it right? if yes then what about 2.case.and i heard that we should write opcode of SWI in unused flash.but where i should write ?please help me.it is very necessary for me.

 

Thanks and Regards

GVN 

Labels (1)
0 Kudos
Reply
3 Replies

930 Views
J2MEJediMaster
Specialist I

For 1), a PC access to a non-existent address causes a bus error, and the bus error handler forces the MCU to reset. The bus  error might also hang the processor, in which case the watchdog timer expires and forces a reset. Either way, the MCU resets.

 

For 2), most often unused Flash memory is filled with 0xFF to resemble unimplemented memory. The value also is an invalid address (unless I'm confusing my MCUs), which should cause an address exception, and that handler should reset the MCU.

 

---Tom

0 Kudos
Reply

930 Views
gvn
Contributor I

Thanks TOM ,it s really helpful for me.....if i am not wrong than i should not do any thing for those cases...my internal watchdog will take care.i am not getting what handler will do?means i have to write a code for that or it will automatically reset the processor.

 

Thanks with regards 

0 Kudos
Reply

930 Views
J2MEJediMaster
Specialist I

You should probably get the S12XCPUV1 Reference Manual (S12XCPUV1.pdf) and check chapter 7, Exception processing, for better information than what I can provide.

 

Basically, the processor will reset itself on an illegal address exception (what I called an address error), and if the watchdog times out (which catches a hung MCU due to a bus error). You do not have to do anything to reset the MCU; no handler is required. However, do note that after the MCU resets due to a COP time-out, the MCU fetches the address of the COP vector rather than the reset vector. You can use this COP vector to execute code that performs some sort of recovery action.

 

However, and this may have be what you were asking about earlier, you may want to set up your interrupt vector table so that for other spurious interrpts, the interrupt is cleared and simply returns. Check out the sample code provided with the CodeWarrior installation to see how the interrupt vector table is set up.

 

---Tom

0 Kudos
Reply