<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Xc167 software reset implementation</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/36086/xc167-software-reset-implementation</link><description> 
Hello buddies, worry for disturbing but I almost died in attempts
to run software resset when my program freezes. 
Rly need som1s help. I know exatcly moment when my programm has to be
reseted, But I dunno how could I do it. I read the documentation</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Xc167 software reset implementation</title><link>https://community.arm.com/thread/70003?ContentTypeID=1</link><pubDate>Tue, 16 May 2017 21:54:56 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:dd4738dd-4360-436e-a34d-21b7e2037034</guid><dc:creator>Paul Blackmore</dc:creator><description>&lt;p&gt;&lt;p&gt;
On XC161 I use _trap_(0) for a software reset. It may be
similar.same on XC167&lt;/p&gt;

&lt;p&gt;
In fact, I do this so that I can catch the fault in the debugger
and examine the TFR register&lt;/p&gt;

&lt;pre&gt;
void
Class_B_trap (void) interrupt irq=CACHED // 0x0A
{
/* TFR Bit  Conditions
 * TFR.0  = Illegal External Bus Access (no external BUS defined for address)
 * TFR.1  = Illegal Instruction Access  (branch to odd address)
 * TFR.2  = Illegal Word Operand Access (word read/write on odd address)
 * TFR.3  = Protection Fault (protected instruction with illegal format)
 * TFR.4  = Illegal or erroneous access to program memory interface
 * TFR.7  = Undefined Opcode (invalid 166/167 op-code)
 * TFR.12 = Software break event
 * TFR.13 = Stack Underflow
 * TFR.14 = Stack Overflow
 * TFR.15 = Non Maskable Interrupt
 */

  PSW_IEN = 0;     // Disable interrupts
  ip  = _pop_ ();
  csp = _pop_ ();
  pc2 = _pop_ ();
  pc1 = _pop_ ();
  tfr = TFR;
  for ( ;; )
    ;
  _trap_(0);       // Reset CPU
}
&lt;/pre&gt;

&lt;p&gt;
Regards&lt;br /&gt;
Paul&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>