logo       

Re: ExternalInterrupt Problem: msg#00718

hardware.microcontrollers.tini

Subject: Re: ExternalInterrupt Problem

Johnson, Bill wrote:
Is the whole ExternalInterrupt class broken for 1.11 on the 400?
I cannot get buttons to work yet either. Even the example from the TINI book
does not work.

You are correct, you will not be able to use the ExternalInterrupt class on the 400 and 1.11 firmware.

Edge triggering is the default. Clearing IT1 in TCON for level triggering
causes the process to hang while the button is held, but no
ExternalInterruptEvent seems to be generated.

The CPU is vectoring to the interrupt handler after every instruction and slowing the CPU.

I have buttons on all 5 interrupts, so something special is needed
anyway. How can I link them to generate an event like the ExternalInterrupt
is supposed to?
Docs seem to indicate I can install interrupt handlers. Then, suspend a
thread from an event generator method.

Yes, you can do this.

But, System_ThreadResume cannot be called from the ISRs. So, how do you
resume? Is there good example somewhere?
Thanks,
Bill Johnson
SHOT (R)

The best methodology is:

1. Install the interrupt handler and have it set a shared memory location when an interrupt occurs. Clear the interrupt flag and reti.
2. Register an IO_Poll routine that can wake a thread. If an interrupt occurs and sets the shared memory location, the poll routine will clear the shared memory location and if a thread is sleeping, will wake it.
3. Have a native routine that checks the shared memory location, and if it is not set put the thread to sleep.

The above procedure does not have any race condictions, and is how some interrupt handlers work with the TINI firmware.

You cannot resume a thread from an interrupt because the state of the Java runtime can not be guaranteed to be consistent. The JVM could be in the middle of a thread swap, native method call, or even be the wrong JVM if you have multiple processes running (Each process is a unique JVM instance).

-Bryan


--
--
Bryan Armstrong
bryan.armstrong-6tN4nzCoH/hBDgjK7y7TUQ@xxxxxxxxxxxxxxxx


_______________________________________________
TINI mailing list
TINI-6tN4nzCoH/hBDgjK7y7TUQ@xxxxxxxxxxxxxxxx
To UNSUBSCRIBE, edit your profile, or see list archives:
http://lists.dalsemi.com/mailman/listinfo/tini



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise