Questions tagged [interrupts]

A mechanism for the control of program flow in a computer. When interrupted a computer saves it's present operational state and changes to execution of code that is dependent upon which interrupt was generated. Interrupts can be either hardware-sourced or software-sourced; software-sourced interrupts are called traps. It is an alternate mechanism to polling and is the basis around which most I/O, multitasking and control is implemented.

Filter by
Sorted by
Tagged with
35
votes
4answers
118k views

What does edge triggered and level triggered mean?

I am studying 8085 microprocessor architecture and the word edge triggered and level triggered confusing me really very much. Can anyone explain me it in layman's words ? While studying the ...
18
votes
2answers
1k views

Should all traps always be defined?

I've seen two cases now with dsPIC 30F4013 where the controller was resetting due to an undefined trap. Why these traps were getting raised in the first place is still a mystery, but that's not my ...
18
votes
1answer
28k views

Stm32 Event and interrupts

I started studying interrupts on stm32 specifically the stm32f4 discovery board. i found this example in which you have to press the button to start the interrupt and push it again to stop it. In ...
17
votes
2answers
2k views

Is SPI safe to be interrupted?

I'm writing to a microSD card from within my firmware, but it's the lowest priority task, so it can be interrupted by other tasks while it's in the middle of reading/writing. Now suppose I ...
15
votes
4answers
5k views

How to implement critical sections on ARM Cortex A9

I am porting some legacy code from an ARM926 core to CortexA9. This code is baremetal and does not include an OS or standard libraries, all custom. I am having a failure that appears to be related ...
13
votes
4answers
2k views

AVR SEI instruction

The AVR SEI instruction (http://www.atmel.com/webdoc/avrassembler/avrassembler.wb_SEI.html) waits for the next instruction to finish before enabling interrupts. If I use another instruction to set ...
12
votes
4answers
2k views

How does the controller know when to jump to the ISR?

I am talking about things at the core level. As far as I understand, the controller core just executes instructions which are fetched from the memory (Fetch - Decode - Execute). When an Interrupt ...
11
votes
5answers
16k views

What is the difference between Interrupt on Change and External Interrupt on PICs

What is the difference in function between IOC and EXT Interrupt on a PIC? I am currently using a PIC12F1822, and apart from the extra layer of checking you have to do with IOC (i.e. which pin caused ...
11
votes
1answer
7k views

Arduino and Interrupts: Fast way to get pin values

I use an Arduino Uno and already set it up to work with interrupts on digital pins 2, 3, 4 and 5 according to an explanation1 I found. void setup() contains the ...
10
votes
3answers
5k views

Software interrupt vs function

After about 3 years of working with MCUs still I don't know what's the use of Software interrupts? I have done several jobs with STM32 and I have never used the software interrupts. Indeed this is a ...
10
votes
5answers
3k views

Interrupt handling in microcontrollers and FSM example

Initial question I have a general question about the handling of interrupts in microcontrollers. I am using the MSP430, but I think the question may be extended to other uCs. I would like to know ...
10
votes
2answers
7k views

Any reason not to use Timer0 on AVR?

Just a basic question... For arduino/avr/ATMega328 I find lots of examples using Timer1 (there's even a whole library for it) but rarely any that utilize Timer0 (or Timer2). Now, I know that using ...
10
votes
6answers
6k views

Avoiding global variables when using interrupts in embedded systems

Is there a good way of implementing communication between an ISR and the rest of the program for an embedded system which avoids global variables? It seems that the general pattern is to have a ...
10
votes
2answers
1k views

Enable interrupt but no ISR

I would like to know what happens if an Interrupt is enabled(ex:Arbitration Lost Interrupt in CAN module of NXP's LPC1778),but no ISR has been defined for the interrupt. When such an interrupt occurs,...
10
votes
3answers
10k views

Critical sections on Cortex-M3

I'm wondering a bit about implementing critical code sections on a Cortex-M3 where exceptions are not allowed due to timing constraints or concurrency issues. In my case, I'm running an LPC1758 and I ...
10
votes
3answers
12k views

Correct usage of a pin change interrupt

I'm trying to use pin change interrupts to detect pressed buttons. Until now I have never worked with these kind of interrupts and there are some problems, so I want to make sure if this is the ...
9
votes
3answers
19k views

How are interrupt handlers implemented in CMSIS of Cortex M0?

I have a LPC1114 kit. Last few days I have been digging up CMSIS implementation of Cortex M0 to find how things are done in it. So far I understood how each registers are mapped and how I can access ...
9
votes
4answers
33k views

How do I create a timer interrupt with Arduino?

I am trying to create a time delay interrupt with Arduino. I would like to use the interrupts() function, because it is an internal interrupt. Example: Let's say, I would like to make a light blink ...
9
votes
2answers
22k views

Determining which pin triggered a PCINTn interrupt?

Am I correct in thinking that if you have two pins causing the same AVR PCINT interrupt, (e.g. PCINT0 vector caused by either PCINT0 or PCINT1 pins -- I think the naming overlap of vectors and pins is ...
9
votes
3answers
16k views

STM32: Timer interrupt works immediately

This is code for timer in my project on STM32F429: ...
9
votes
3answers
9k views

Using multiple external interrupts in PIC

I've used PIC16F877 (datasheet) for several projects. For a single external pin change interrupts, you can use PORTB0 interrupt. ...
9
votes
2answers
16k views

STM32F4 Cube HAL UART. Is it a bug or am I missing something?

I am using interrupt based UART IO (no DMA). HAL_UART_Transmit_IT function sets EIE bit in ...
8
votes
3answers
1k views

Measuring cpu load of interrupt routine

I have an isr that is updating a display at a fixed frequency. I would like to tune my routine to minimize overhead and keep as much cpu time as possible open for other processing, but I don't have ...
8
votes
6answers
1k views

Differences between Interrupts and sampling for hardware button?

I have a hardware button I connected to an interrupt, but my problem is it bounces a bit, making the button press unreliable. I think a good deal of these issues would be solved by sampling in the ...
8
votes
5answers
1k views

What is the point of having a level-based interrupts?

Wherever I have searched about the practical implementation of the level-based interrupt, I have found only one suggestion that people have given i.e disable the interrupt as soon as it enters the ISR ...
8
votes
4answers
3k views

Interrupt latency on a STM32F303 MCU

I’m working on a project that involves a STM32 MCU (on the STM32303C-EVAL board to be exact) that has to respond to an external interrupt. I want the reaction to the external interrupt to be as fast ...
8
votes
2answers
23k views

Clearing USART (UART) interrupt flags in an STM32?

I am using an STM32F105 to communicate with a Linx GPS chip using a UART. If I don't use interrupts (if I just poll the RX flag) then it works just fine. But I'm getting unexpected results when ...
8
votes
1answer
3k views

How does the call stack operated during an interrupt on AVR?

(Specific to the Arduino Uno...) What happens to the stack when an interrupt occurs on an AVR microcontroller and I call a function? Does the compiler inline the code? Does it cache the stack ...
8
votes
1answer
5k views

Bug in Keil ARM compiler with interrupt handlers and C++?

I have a problem with writing interrupt handlers in Keil ARM compiler for LPC1114. When I write program in C++ and specify --cpp compiler option all code from interrupt handlers disappears, it is ...
8
votes
2answers
7k views

AVR interrupt service routine not executing as fast as expected (instruction overhead?)

I'm developing a small logic analyzer with 7 inputs. My target device is an ATmega168 with a 20MHz clock rate. To detect logic changes I use pin change interrupts. ...
8
votes
2answers
788 views

ATtiny13A - Can't generate software PWM with CTC mode

I'm trying to make a remote control RGB LED light using an ATtiny13A. I know the ATtiny85 is better suited for this purpose, and I know I might not eventually be able to fit the whole code, but for ...
8
votes
1answer
1k views

enable/disable PCI interrupts

I'm implementing a PCIe driver, and I'd like to understand at what level the interrupts can be or should be enabled/disabled. I intentionally do not specify OS, as I'm assuming it should be relevant ...
7
votes
7answers
3k views

Is it possible to interrupt the copy process of a struct by an interrupt in embedded C?

Inside the driver I have got a function to copy the data from the internal struct into a struct from the application. Can this process be interrupted by a microcontroller interrupt trigger? ...
7
votes
2answers
1k views

Mutex in interrupts

For a small micro controller without an OS what is the proper way to share data between different interrupts and the main loop? With an OS one can just create a mutex for each critical part and carry ...
7
votes
3answers
13k views

What's the actual difference between Edge sensitive and Level sensitive interrupts

Currently I'm working on a C8051F120 MCU where External Interrupts can be defined in two ways: Edge sensitive (Falling) Level sensitive (low-level) In level-sensitive interrupts as soon as the MCU ...
7
votes
1answer
2k views

Tell if interrupts are enabled

Is there a way of telling if sei()/interrupts() or cli()/...
7
votes
4answers
4k views

Good solution for more interrupts on an arduino?

I'm building a circuit with an Arduino Mega and simple IC chips (e.g. 7432) but I have many lines to monitor for interrupt conditions and not enough pins on the Atmel so I'm looking for a way to ...
7
votes
2answers
7k views

Define callbacks for interrupts

I am working with an STM32 and I am a bit confused about interrupts, specifically the Nested Vectored Interrupts (NVI). As I understand there is a NVI vector (called NVIC) where each interrupt has a ...
7
votes
2answers
11k views

STM32F7 gets stuck in external interrupt callback function

i am working on a project to connect a camera to an STM32F7 Discovery board using the DCMI interface. The camera part works fine, but i have a strange problem with external interrupts from the ...
7
votes
1answer
4k views

LED blinks even when I don't press the button

I have written a program in Keil that blinks a LED via External GPIO Interrupt. Here is how I have configured it in STM32CubeMX: At first, I enabled and configured RCC as you can see and configured ...
7
votes
2answers
2k views

Need help understanding Ultra Low Power Wakeup on PIC16F887

I am trying to implement the "Ultra Low Power Wake Up" feature on a small PIC project. The idea is the chip will go to sleep, and then be woken up in the future by the ULPWU interrupt. The idea ...
6
votes
2answers
1k views

Nested Vectored Interrupt Controller (NVIC) - Why is it “nested” and “vectored”?

In ARM microcontrollers there is an peripheral called NVIC (Nested Vectored Interrupt Controller). What does the "nested" and "vectored" part refer to, or why is it "nested" and "vectored"?
6
votes
2answers
5k views

What's the difference between setting SysTick Interrupt in NVIC and using it as an exception?

I'm using an STM32F303 MCU and I've noticed that the SysTick can be set up to cause an exception, which seems to mentioned quite often in various User Guides. This way, it will have a priority level ...
6
votes
4answers
2k views

Multithreading on AVR

If I have an AVR micro controller and have an ISR coming up about every 100 micro seconds or so, can I change the stack pointer in the ISR and then fake multi threading? Psuedo code: ...
6
votes
3answers
16k views

What do the different interrupts in PCIe do? I referring to MSI, MSI-X and INTx

We have the following interrupts: MSI, MSI-X and INTx. What do these different type of interrupts do in PCIe? I only need a short description. I only know that in PCIe interrupts are generated as ...
6
votes
1answer
809 views

Inaccurate timer interrupt STM32

I wrote a simple program to toggle an LED on and off using the TIM1 interrupt on an STM32F0 discovery board. CLK Freq = 48MHz Prescalar = 48000 Auto Reload Register = 1000 Using the following ...
6
votes
2answers
1k views

RTOS: Why Do We Need Special Post versions for ISRs?

In some RT kernels, if you want to post to a semaphore or flag from an ISR, you need to call an special version of the method, instead of the regular one called from a normal task. Examples: ...
6
votes
1answer
4k views

Interrupt Service Routine in C - function at specific address

I need to add an Interrupt Service Routine (ISR) to existing code in C for a PIC18F4620 and a PIC18F46K22. As you can see in section 9 (of both datasheets), these devices have multiple interrupt ...
6
votes
3answers
5k views

To Clear or not to clear ARM Cortex-M NVIC interrupt pending

Do I need to clear the pending status of an interrupt in the interrupt service routine of an ARM Cortex-M0 MCU? Could not find information on this on the web.
6
votes
1answer
17k views

STM32 Interrupt Priority (preemption) Problems

I have another problem (High resolution system timer in STM32) which I have tracked down (mostly) to this issue, and have created a test case here for the simplest STM32 processor I could find (on the ...