CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

PIC24E restart_cause() returns unknown cause 16 (0x10)

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
benoitstjean



Joined: 30 Oct 2007
Posts: 543
Location: Ottawa, Ontario, Canada

View user's profile Send private message

PostPosted: Thu Feb 22, 2018 6:57 am     Reply with quote

UPDATE:

An explanation from CCS support:
-------------------------------------
The only ways that it should be able to return 16 for restart_cause() is if it was called twice in software, or if something caused the program to jump to a point that caused restart_cause() get called again without it being an actual reset of the device. A call to goto_address(0); is an example of how the second way could occur. I would check that you don't have multiple calls to restart_cause() in your code, one example that I've personally run into is that I had a call to restart_cause() in a standalone bootloader and then call it again in my application.
-------------------------------------

I looked in my code and the only two places I call restart_cause() is at the beginning of the main():

Code:
void main()
{
   delay_ms( 250 );
   
   // Enable watchdog timer
   setup_wdt( WDT_16S | WDT_ON );
   
   // Get MCU's internal last restart cause
   Error.InternalRestartCode = restart_cause();

   // rest of code here
}


...and after the delay_cycles(100) following sleep( SLEEP_FULL ):

Code:
   // Sleep NOW
   sleep( SLEEP_FULL );

   // Wake-up from sleep
   delay_cycles(100);

   // Get MCU's internal last restart cause
   Error.InternalRestartCode = restart_cause();


I'll post more if CCS replies to this.

Benoit
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group