I am using Arduino ATMega (1280) and I would like to confirm if I am really in trouble... Or there is no way to solve this issue?
I need an interruption pin to wake-up the processor.
I am already using INT0 and INT1 (pins Digital 2 and 3) as interruption pins to wake-up the MCU(working fine).
I am using the I2C bus, so INT3 and INT4 (pins Digital 21-SCL and 20-SDA) cannot be used. There are more than one device on this bus and I do not want (I am afraid of...) to include a hardware line on it to serve as an interruption pin...
Serial1 interface is being used (actually, I am using all 4 serial interfaces). therefore, INT4 (RX1) and INT5 (TX1) cannot be used.
Or use diodes, like here:
Any of cathodes going low causes a low interrupt on the common anode, which is an input with internal pullup resister enabled.
The diode idea is very good and it is definitely an option for me.
While waiting for the replies, I had an idea. I am using one of the serial ports (Serial3) for a serial LCD.
Therefore, I can swap Serial1 with Serial3. In this way, the RX1 pin will be available (LCD only receives data) and I can use this pin for this purpose.
Question:
If I am using Serial1 (say, Serial1.begin(9600), etc...) for a serial LCD, can I still use the RX1 pin for interruption purposes or it compromised in someway with the serial library?
Re: Serial1 - I don't think so, unless you use Serial1.end, and then pinMode to set the pin to an input, and then Serial1.begin again later to turn it back on.
Otherwise I would expect your signal will likely just be seen as a start bit and fill the hardware buffer byte with 0s or 1s.
If you want to get an interrupt when you get serial data you can run a wire from the Rx pin to another interrupt pin. But you can't use Rx to handle a separate interrupting input. As CR says, the UART will have a hernia.
What is this other interrupt source, and why would it need to share the Rx pin?
I think that would work, won't know for sure until you try. Do the
serial1.end,
pinmode(RXpin, INPUT)
digitalWrite(RXpin, HIGH)
attachInterrupt(whatever it is, LOW),
etc.
Another thought:
Interrupts 6 & 7 do not seem to have been broken out, physical pins 8 & 9.
Perhaps solder little wires on and bring those to a connector.
Update the pins_arduino.c so the software can use them.
That's what we really need - a software tool to let you select a processor, define the mapping you want the pins to have to real hardware, and let it create custom pins_arduino.c files. This is the 3rd time this month where that would have been handy now...