Questions tagged [isr]

Interrupt Service Routine

19 questions
6
votes
2 answers

ISR, volatile and ATOMIC_BLOCK

From my experience so far I am aware of the following to pay attention to when working with ISRs: An ISR should complete quickly Variables shared between an ISR and the main execution path should be declared volatile to avoid accesses to it being…
Torsten Römer
  • 487
  • 2
  • 7
  • 18
6
votes
2 answers

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: xSemaphoreGiveFromISR() instead of xSemaphoreGive() in…
Mister Smith
  • 415
  • 1
  • 3
  • 12
4
votes
0 answers

STM8 nested interrupt bug, not described in current errata sheet ES019

If main process execute WFI with AL bit set in CFG_GCR, changing I1/I0 priority bits in the ISR cause CPU stalled when nested IRQ occured. Preconditions: all ITC_SPR1 registers has default value 0xFF. Enable TIM4 with generate interrupts on…
4
votes
1 answer

Interrupt never fires

I'm new to embedded and I've been struggling with this for days. I just don't understand why this doesn't work. I'm using an ATxMega128A1. I want to use a timer overflow interrupt to left shift a bit on a port to the next pin. The timer works. I can…
RubberDuck
  • 260
  • 1
  • 10
3
votes
2 answers

Realizing a multitasking program with Timer Interrupts

This is my attempt to realise multitasking (well almost) through interrupts. In this example, Task 1 is: Toggle LED connected to PB1 at 2Hz (Timer 1 is used, OCR1 can hold values upto 65535), Task 2 is: Toggle LED connected to PB3 at 61Hz (since…
Abel Tom
  • 435
  • 5
  • 15
3
votes
1 answer

How can I tell Microchip's XC8 compiler that I am using a custom interrupt handler? It tries to place other code at address 4!

I'm developing firmware for the Microchip PIC16F882 microcontroller using their MPLAB X IDE and the free version of their XC8 C compiler. I'm running into a small problem when trying to add a customized interrupt handler. Because the free version of…
pipe
  • 13,748
  • 5
  • 42
  • 72
3
votes
2 answers

Setting port in main loop causes ISR to starve

The example code initializes an asynchronous timer that is fired every second sets two ports as outputs (PA4, PA6 - LEDs connected) the timer ISR toggles pin PA4 permanently sets pin PA6 to 1 in the main while() loop If pin PA6 is toggled using…
Rev
  • 10,017
  • 7
  • 40
  • 77
2
votes
2 answers

Is setting software flags an effective use of interrupts?

I'm currently working on a microcontroller(Arduino) project in which I wish to use interrupts generated by pushbuttons and timers. However, I'm not sure if I'm 'effectively' using the interrupts. Here is my following architecture approach: Let's say…
Izzo
  • 1,984
  • 2
  • 18
  • 37
2
votes
2 answers

Interrupt Vector calculation in PowerPC based controllers

I am working with Freescale MPC5534 based on PowerPC arch. I am not able to understand how the address of a particular ISR is calculated during runtime. There are three registers involved, INTC_IACKR, INTC_IVPR, INTC_IVOR, and the final value of the…
stenvar
  • 731
  • 2
  • 10
  • 17
2
votes
2 answers

Serial Communication Rx ISR logic design

If im not wrong, an ISR is supposed to do minimal processing when it receives a data serially(via UART). Im planning on implementing such a protocol for communication between 2 systems via uart. This is a rough situation of how i plan on coding the…
AlphaGoku
  • 1,003
  • 2
  • 11
  • 26
2
votes
2 answers

MSP430 how to make configurable ISRs in a module (Code composer studio C)

I have a question that I think the answer to is quite simple. But I've been unable to find a straight answer to. If i have this service routine in some module foo.c #pragma vector = SOME_VECTOR interrupt void fooISR(){ dosomething; IFG =…
1
vote
0 answers

Reuse I2C SCL or SDA Pins to signal interrupt

In an I2C network, I am using an AVR microcontroller (AtMega328p) as a Master and I hooked it up to multiple sensors as Slaves, such as the TMP102, SI1145, MPU9250, among others. All of these sensors have pins to signal interrupts to the…
Mihai Galos
  • 145
  • 6
1
vote
1 answer

AVR ATmega: can I trigger external interrupt by setting corresponding INTF flag bit?

I'm writing a C program for ATmega64A which has a INT0 ISR. This ISR should be executed in case of INT0 falling edge OR if the TIMER3 goes overflow. To avoid doubling the code I'd like to trigger Int0 ISR in the Timer 3 overflow ISR. Unfortunately…
Roman Matveev
  • 2,942
  • 7
  • 32
  • 75
1
vote
1 answer

High Speed Data Acquisition with SD Card Write

I am collecting data from several dozen sensors over an 8 MHz SPI bus at 400 Hz. It is critical that the sensors are sampled at this rate with no lost packets. In order to do this, I have a timer (which I will refer to as TimerA) which raises an…
dgreenheck
  • 333
  • 3
  • 13
1
vote
1 answer

Can not set up ISR for PIC24F08KA101

I have a problem setting up Interrupt Service Routine for PIC24F08KA101. I have successfully initialized IE,IF,IP for interrupts which I need to use. Part of the code which initializes these: void int_init(void) { IEC1bits.INT2IE=1; //Enable…
Triak
  • 916
  • 8
  • 14
1
2