Hi, As I suppose it is the problem of the lower layer, I found that the implementation of MicInterrupt.enable() and disable() is different between the file tos/platform/mica2/HPLMicC.nc and tos/sensorboards/mts310/MicM.nc. I read the data sheet of ATMEGA128, and I found the INT3 pin is connected to interrupt 7 in the chip, so replaced the MicInterrupt.enable() with sbi(EIMSK,7) and MicInterrupt.disable() with cbi(EIMSK,7). But this time, the interrupt will respond to the first tone, and then died.
By the way, I set a periodic timer to toggle the yellow LED to see if the system is still running. After the first tone, the yellow LED will not blink any more. Thanks! Shawn On Wed, Oct 19, 2011 at 10:25 AM, dong bo <[email protected]> wrote: > Hi Micheal, > > Thanks for your reply. Actually, I am working on the tone detection part, > and the interrupt response seems very strange. The following is my original > code for this part, and I can see that the interrupt is coming continuously. > But when I probe the INT3 pin using an oscilloscope, I found the hardware is > working fine. I suspect the interrupt part is not working fine. > > By the way, I am using the environment of Moteworks downloaded from Xbow > website. Thanks a lot! > > command result_t StdControl.init() > { > call RadioControl.init(); > call HPLUART.init(); > call Leds.init(); > call Serial.SetStdoutSerial(); > > call MicControl.init(); > call Mic.muxSel(1); > call Mic.gainAdjust(64); > > return SUCCESS; > } > > command result_t StdControl.start() > { > call RadioControl.start(); > call MicControl.start(); > call MicInterrupt.enable(); > return SUCCESS; > } > > command result_t StdControl.stop() > { > call RadioControl.stop(); > call MicControl.stop(); > return SUCCESS; > } > > async event result_t MicInterrupt.toneDetected() > { > call MicInterrupt.disable(); > call Leds.redToggle(); > > TOSH_uwait(5000); > call MicInterrupt.enable(); > __nesc_enable_interrupt(); > return SUCCESS; > > } > > > On Tue, Oct 18, 2011 at 12:46 PM, Michael Schippling <[email protected]>wrote: > >> We would have to look at your code, but most likely you >> are not returning from the interrupt correctly. >> >> MS >> >> dong bo wrote: >> >>> I am trying to implement the tone detector software in a Mica2 motes with >>> MTS310 sensor cards. The current problem is that as soon as the interrupt is >>> triggered, the system would crash. I triggered green LED to toggle every a >>> while and red LED will be toggled in the interrupt callback function. As >>> soon as there is a sound, red LED will be toggled, and green LED will not be >>> blinking at more, and there will be no more response from the system. Does >>> anyone know about this? >>> >>> Thanks in advance! >>> Shawn >>> >>> >>> ------------------------------**------------------------------** >>> ------------ >>> >>> ______________________________**_________________ >>> Tinyos-help mailing list >>> Tinyos-help@millennium.**berkeley.edu<[email protected]> >>> https://www.millennium.**berkeley.edu/cgi-bin/mailman/** >>> listinfo/tinyos-help<https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help> >>> >> >
_______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
