0

I am using two interrupts in ARM7 lpc2378:

  1. UART1 to receive data from some external module
  2. External Interrupt for ADC reading

During the execution of the External-Interrupt ISR, data from UART1 is lost since interrupts are disabled.

How should I collect or save the UART1 data when some other ISR is being executed?

What measures should be taken in order to ensure that data from UART1 does not get lost?

barak manos
  • 29,648
  • 10
  • 62
  • 114
  • Enabling interrupts at the beginning of the ISR sounds like a trivial solution (though it is typically applied within the interrupt-vector itself, just before invoking the ISR). – barak manos Jun 17 '14 at 12:19
  • does your uart have a fifo? Is it enabled? Are you spending the bare minimum time in the isr? Why is the uart isr disabled? – old_timer Aug 25 '14 at 14:54

1 Answers1

1

I don't know the details of this particular microcontroller, but usually you should spend as few time in ISR as possible: do not do any expensive processing there. For example, in your ISR, read the important informations, write them to some variables, leave the ISR. In your app's main loop, react to the variable changes (there are several ways to achieve this so I'm describing this in a very generic way).

DarkDust
  • 90,870
  • 19
  • 190
  • 224
  • 1
    Since both interrupts events are Asynchronous and losing data in UART1 is not frequent but it is an important task to save UART1 data without losing at any instance. In my project External interrupt ISR takes around 7.5msec max and during this period sometimes UART1 received data is missed. Now even if i reduce external interrupt ISR processing time but there would be some probability of losing UART1 data which i don't want to miss it. There has to some way or technique to handle such cases. – Ashish Garag Jun 17 '14 at 12:39