EmbeddedRelated.com
Forums

External interrupt

Started by galapogos March 26, 2007
Hi,

I have a MCU project on a Toshiba MCU that only has 1 pin for external
interrupt. However, I need 2 external interrupts from 2 devices. I'm
wondering if there's a way to share that 1 pin between the 2 external
interrupt inputs? I'm thinking of wiring the MCU pin directly to the
inputs from the 2 devices A & B, and also wire those 2 devices to 2
other GPIO pins(say pin A and B). Then in my ISR, I can perform a
check to see if pin A or pin B is high/low in order to determine which
device caused the interrupt. Of course there will be priority given to
either A or B. Will wiring both devices to the single MCU pin be a
problem? I'm guessing I'll need a pull up/down just in case, but I'm
also wondering if device A driving the pin will cause any weird
behavior on device B, since they're essentially connected together.

On Mar 25, 11:07 pm, "galapogos" <gois...@gmail.com> wrote:
> Hi, > > I have a MCU project on a Toshiba MCU that only has 1 pin for external > interrupt. However, I need 2 external interrupts from 2 devices. I'm > wondering if there's a way to share that 1 pin between the 2 external > interrupt inputs? I'm thinking of wiring the MCU pin directly to the > inputs from the 2 devices A & B, and also wire those 2 devices to 2 > other GPIO pins(say pin A and B). Then in my ISR, I can perform a > check to see if pin A or pin B is high/low in order to determine which > device caused the interrupt. Of course there will be priority given to > either A or B. Will wiring both devices to the single MCU pin be a > problem? I'm guessing I'll need a pull up/down just in case, but I'm > also wondering if device A driving the pin will cause any weird > behavior on device B, since they're essentially connected together.
should not be a problem once you have reviewed the datasheets for the two devices. Why don't you ask your electrical engineer? Or is this a school project? here's a hint as to whether device A will affect device B: you are connecting the two OUTPUT lines. HTH, and read the datasheets. Ed
galapogos wrote:
> Hi, > > I have a MCU project on a Toshiba MCU that only has 1 pin for external > interrupt. However, I need 2 external interrupts from 2 devices. I'm > wondering if there's a way to share that 1 pin between the 2 external > interrupt inputs? I'm thinking of wiring the MCU pin directly to the > inputs from the 2 devices A & B, and also wire those 2 devices to 2 > other GPIO pins(say pin A and B). Then in my ISR, I can perform a > check to see if pin A or pin B is high/low in order to determine which > device caused the interrupt. Of course there will be priority given to > either A or B. Will wiring both devices to the single MCU pin be a > problem? I'm guessing I'll need a pull up/down just in case, but I'm > also wondering if device A driving the pin will cause any weird > behavior on device B, since they're essentially connected together.
Not only that, but since you have joined A & B, how can you now tell them appart ? You need a AND gate to Merge A and B onto the INT pin, (assumes it is active low) and then you can wire them to port pins. http://en.wikipedia.org/wiki/AND_gate Sometimes you can press a spare timer into service as an INT. Set it to -1 count from overflow, then set for External Clock, and a Clock edge on that, will fire the timer INT. An unused UART can also do - Low IP will give a RX INT, with a framing error. -jg
On 25 Mar 2007 20:07:13 -0700, "galapogos" <goister@gmail.com> wrote:

>Hi, > >I have a MCU project on a Toshiba MCU that only has 1 pin for external >interrupt. However, I need 2 external interrupts from 2 devices. I'm >wondering if there's a way to share that 1 pin between the 2 external >interrupt inputs? I'm thinking of wiring the MCU pin directly to the >inputs from the 2 devices A & B, and also wire those 2 devices to 2 >other GPIO pins(say pin A and B). Then in my ISR, I can perform a >check to see if pin A or pin B is high/low in order to determine which >device caused the interrupt. Of course there will be priority given to >either A or B. Will wiring both devices to the single MCU pin be a >problem? I'm guessing I'll need a pull up/down just in case, but I'm >also wondering if device A driving the pin will cause any weird >behavior on device B, since they're essentially connected together.
You need a diode from A to INT and an other from B to INT and possibly a pull up/down resistor on the INT pin. However, watch for the voltage drop in the diode and check that the active state voltage at the INT pin is within specifications, even after the diode voltage drop. Paul
On Mar 26, 6:39 am, Jim Granville <no.s...@designtools.maps.co.nz>
wrote:
> You need a AND gate to Merge A and B onto the INT pin, > (assumes it is active low) and then you can wire them to port pins. > > -jg
I think he rather needs a OR gate from what I understand of his use case. But the problem will rather be on the GPIO side. Are your interrupts signaled on a rising/falling edge, or on a level? If you have an interrupt on edge, maybe the interrupt source information is no longer there when you read your GPIO. You will need something more complex, but not that complex. You need to be able to memorize an interrupt information, read that information, and reset it. Maybe something like a latch on the read GPIO will do the trick, and another "clear" GPIO to reset the latch. If you have an interrupt on level, I am pretty sure you will need an extra GPIO too to clear the interrupt condition on your external chips. Stephane
On Mar 26, 12:39 pm, Jim Granville <no.s...@designtools.maps.co.nz>
wrote:
> galapogos wrote: > > Hi, > > > I have a MCU project on a Toshiba MCU that only has 1 pin for external > > interrupt. However, I need 2 external interrupts from 2 devices. I'm > > wondering if there's a way to share that 1 pin between the 2 external > > interrupt inputs? I'm thinking of wiring the MCU pin directly to the > > inputs from the 2 devices A & B, and also wire those 2 devices to 2 > > other GPIO pins(say pin A and B). Then in my ISR, I can perform a > > check to see if pin A or pin B is high/low in order to determine which > > device caused the interrupt. Of course there will be priority given to > > either A or B. Will wiring both devices to the single MCU pin be a > > problem? I'm guessing I'll need a pull up/down just in case, but I'm > > also wondering if device A driving the pin will cause any weird > > behavior on device B, since they're essentially connected together. > > Not only that, but since you have joined A & B, how can you now > tell them appart ? > > You need a AND gate to Merge A and B onto the INT pin, > (assumes it is active low) and then you can wire them to port pins. > > http://en.wikipedia.org/wiki/AND_gate > > Sometimes you can press a spare timer into service as an INT. > Set it to -1 count from overflow, then set for External Clock, > and a Clock edge on that, will fire the timer INT. > An unused UART can also do - Low IP will give a RX INT, with > a framing error. > > -jg
Hey, that's a good idea. Maybe I'll do that. I actually have 2 more external interrupts, except those pins are already being used as GPIO for some other device. Using them would mean a new PCB layout, so I'm looking for a quick and dirty way to do some testing first.
On Mar 26, 1:10 pm, Paul Keinanen <keina...@sci.fi> wrote:
> On 25 Mar 2007 20:07:13 -0700, "galapogos" <gois...@gmail.com> wrote: > > >Hi, > > >I have a MCU project on a Toshiba MCU that only has 1 pin for external > >interrupt. However, I need 2 external interrupts from 2 devices. I'm > >wondering if there's a way to share that 1 pin between the 2 external > >interrupt inputs? I'm thinking of wiring the MCU pin directly to the > >inputs from the 2 devices A & B, and also wire those 2 devices to 2 > >other GPIO pins(say pin A and B). Then in my ISR, I can perform a > >check to see if pin A or pin B is high/low in order to determine which > >device caused the interrupt. Of course there will be priority given to > >either A or B. Will wiring both devices to the single MCU pin be a > >problem? I'm guessing I'll need a pull up/down just in case, but I'm > >also wondering if device A driving the pin will cause any weird > >behavior on device B, since they're essentially connected together. > > You need a diode from A to INT and an other from B to INT and possibly > a pull up/down resistor on the INT pin. However, watch for the voltage > drop in the diode and check that the active state voltage at the INT > pin is within specifications, even after the diode voltage drop. > > Paul
Actually one of the "devices" already has a schottky diode on it. It's actually not a device but rather the 5V power supply with a voltage divider to lower it down to 3.3V. The application is detecting whether the connector is inserted or not. The other device is a proper ASIC that sends an error signal, which will interrupt my program.
On 25 Mar 2007 20:07:13 -0700, "galapogos" <goister@gmail.com> wrote:

>Hi, > >I have a MCU project on a Toshiba MCU that only has 1 pin for external >interrupt. However, I need 2 external interrupts from 2 devices. I'm >wondering if there's a way to share that 1 pin between the 2 external >interrupt inputs? I'm thinking of wiring the MCU pin directly to the >inputs from the 2 devices A & B, and also wire those 2 devices to 2 >other GPIO pins(say pin A and B). Then in my ISR, I can perform a >check to see if pin A or pin B is high/low in order to determine which >device caused the interrupt. Of course there will be priority given to >either A or B. Will wiring both devices to the single MCU pin be a >problem? I'm guessing I'll need a pull up/down just in case, but I'm >also wondering if device A driving the pin will cause any weird >behavior on device B, since they're essentially connected together.
For low level active interrupts, your system will work if you put a diode in series with both interrupt pins, cathodes conneted to int pins, anode connected together, and also to a pull-up resistor, and also to MCU interrupt input pin. Use schottky diodes preferably Zara
Hi,
I am just curious,may be I am not correct.Will it not be helpful to
have an external interrupt controller which can take 2 inputs and
provide one output?

Regards,
s.subbarayan

ssubbarayan wrote:
> > I am just curious,may be I am not correct.Will it not be helpful > to have an external interrupt controller which can take 2 inputs > and provide one output?
Such chips exist, or at least have existed. They can also control priority and edge/level sensitivity. -- Chuck F (cbfalconer at maineline dot net) Available for consulting/temporary embedded and systems. <http://cbfalconer.home.att.net> -- Posted via a free Usenet account from http://www.teranews.com