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 CCS Technical Support

Error interrupts usage?

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



Joined: 20 Jul 2011
Posts: 375

View user's profile Send private message

Error interrupts usage?
PostPosted: Wed Jan 14, 2015 4:02 am     Reply with quote

Greetings! Can you give me an example for INT_OSCFAIL, INT_ADDRERR, INT_STACKERR, INT_MATHERR, INT_DMAERR?
I have a small question! If I have an oscillator failure then what will provide frequency for execution of the interrupt?!
Thanks!
Ttelmah



Joined: 11 Mar 2010
Posts: 19513

View user's profile Send private message

PostPosted: Wed Jan 14, 2015 4:52 am     Reply with quote

For the clock, the internal oscillator.

This is all down to how you have your chip configured, and what you are actually trying to do.

For the address error, this should never happen if the code is written correctly, but if (for instance) you are using pointer/array accesses and talk outside the range of the array, then you may trigger an address error (depending where you access). Or (more common), if you generate a pointer to a 16bit value, and then try to talk to an odd memory address (16bit accesses can only be done to an even address). There was quite a long thread not that long ago, where a user was getting this error, covering 'how to use the interrupt'.

For the clock error, you can only use this if you are running off an external clock source. The chip can then be setup to give you the interrupt if your external clock fails. Obviously your clock rate won't then be the expected 'running' rate, but the chip can still function.

Generally the best place to start is the chip's data sheet, where the manufacturer will tell you what triggers these events, and particularly the 'family reference manual'.

The MATHERR occurs with some types of maths overflow (/0 for example).

The DMAERR occurs when for example a USB transfer is setup, and then the count field is less than the number of bytes actually received.

Obviously in each case quite complex code is needed to 'recover' in any way other than catastrophically. However for debugging, these can be very useful.
stoyanoff



Joined: 20 Jul 2011
Posts: 375

View user's profile Send private message

PostPosted: Thu Jan 15, 2015 1:10 am     Reply with quote

If I have interrupt priority set, do I have to set priority to this interrupts?
For example:
Code:

#INT_EXT0 level=5


Thanks!
Ttelmah



Joined: 11 Mar 2010
Posts: 19513

View user's profile Send private message

PostPosted: Thu Jan 15, 2015 1:29 am     Reply with quote

Read the data sheet. Most of these are _traps_ not conventional interrupts (so won't be disabled by a DISI instruction). As such above the highest priority in the normal table. Their internal 'priority' order is OSC, ADDR, STACK, MATH.
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