It gets stranger...
I uploaded a piece of ZigBee specific code, using a FF interrupt to trigger sending a packet:
Quote:
#define NodeID "E001"
#define MAX_JOIN_CHECKS 40
packetXBee* paq_sent;
int8_t state=0;
long previous=0;
char command[] = ",,,,";
char message[] = ",,,,";
//char messageType = 'N';
char* macHigh=" ";
char* macLow=" ";
int aux_1 = 0;
int aux_2 = 0;
uint8_t timeout = 0;
//char* data="<<<C:";
//0013A2004068E061
uint8_t macB[8]={0x00,0x13,0xA2,0x00,0x40,0x68,0xE0,0x61};
void setup(){
RTC.ON();
ACC.ON();
// Inits the XBee XSC library
xbeeZB.init(ZIGBEE,FREQ2_4G,NORMAL);
// Powers XBee
xbeeZB.ON();
xbeeZB.setJoinNotification(1);
ACC.setFF();
xbeeZB.setSleepMode(1);
RTC.setTime("12:02:20:02:16:00:00");
RTC.getTime();
//RTC.setAlarm2("29:11:00",RTC_ABSOLUTE,RTC_ALM2_MODE4); // Hours and minutes match
//RTC.setAlarm2("29:11:02",RTC_ABSOLUTE,RTC_ALM2_MODE3); // minutes match
//RTC.setAlarm1(29,11,0,0,RTC_ABSOLUTE,RTC_ALM1_MODE5); // Sets Alarm1 (seconds matching)
for(uint8_t i = 0;i<5;i++){
Utils.blinkLEDs(125);
}
}
void loop(){
Utils.blinkLEDs(500);
XBee.setMode(XBEE_OFF);
XBee.close();
//PWR.sleep( UART0_OFF | UART1_OFF | BAT_OFF);
if( intFlag & ACC_INT )
{
for(uint8_t i = 0;i<3;i++){
Utils.blinkLEDs(50);
}
intFlag &= ~(ACC_INT); //reset flag
//sprintf(command,"ALARM,%d,%d,%d,%u,%u,%s>>>",ACC.getX(),ACC.getY(),ACC.getZ(),RTC.getTemperature(),PWR.getBatteryLevel(),RTC.getTime());
//auxFunction();
//USB.begin();
// USB.println("Message: ");
// USB.println(message);
// messageType = 'A';
assembleMessage();
// USB.println("Message: ");
// USB.println(message);
sendAuxPacket(message);
//sendAuxPacket(command);
//USB.println("Message: ");
//USB.println(message);
resetMessage();
ACC.setFF();
}
//if(intFlag & RTC_INT )
// {
// intFlag &= ~(RTC_INT); //clear flag
/// sprintf(command,"%s%d,%d,%d,%u,%u,%s>>>",data,ACC.getX(),ACC.getY(),ACC.getZ(),RTC.getTemperature(),PWR.getBatteryLevel(),RTC.getTime());
// auxFunction();
// sendAuxPacket(command);
//USB.print("Message: ");
//USB.println(command);
// }
//delay(5000);
}
void sendAuxPacket(char *){
XBee.setMode(XBEE_ON);
XBee.begin(9600);
// Inits the XBee XSC library
xbeeZB.init(ZIGBEE,FREQ2_4G,NORMAL);
// Powers XBee
xbeeZB.ON();
xbeeZB.getAssociationIndication();
while((xbeeZB.associationIndication)&&(timeout<MAX_JOIN_CHECKS)) //while not connected...
{
Utils.blinkLEDs(1000);
xbeeZB.getAssociationIndication();
timeout++;
}
timeout=0;
if(!xbeeZB.associationIndication)
{
paq_sent=(packetXBee*) calloc(1,sizeof(packetXBee));
paq_sent->mode=UNICAST;
paq_sent->MY_known=0;
paq_sent->packetID=0x52;
paq_sent->opt=0;
xbeeZB.hops=0;
xbeeZB.setOriginParams(paq_sent,MAC_TYPE);
xbeeZB.setDestinationParams(paq_sent, macB, message, MAC_TYPE, DATA_ABSOLUTE);
xbeeZB.sendXBee(paq_sent);
if( !xbeeZB.error_TX )
{
for(uint8_t i = 0;i<5;i++){
Utils.blinkLEDs(125);
}
}
else
{
Utils.blinkLEDs(100);
}
free(paq_sent);
paq_sent = NULL;
}
}
void auxFunction() //write to string function
{
sprintf(command, "%s", command);
}
void assembleMessage(){
//message[0] = messageType;
message[0] = NodeID[0];
message[1] = NodeID[1];
message[2] = NodeID[2];
message[3] = NodeID[3];
USB.print("message fn check");
USB.println(message);
}
void resetMessage(){
for(uint8_t i=0;i<4;i++){
message[i] = ',';
}
}
I can't pinpoint why it started working, but the interrupt occurred with this sketch (observed LED's and Xbee line via USB & serial monitor) and the FreeFall example breifly interrupted as normal for approximately 2 - 5 minutes. after this time it would not interrupt. under the assumption the ZB sketch above 'fixed' the issue I uploaded it to both motes, then tested for interrupts - one of the units interrupted when tested the second did not. when I reset the mote manually it began behaving normally.
I should mention I recompiled, reuploaded and tested both the example and other previously working FF sketches onto two waspmotes with no interruptions under interrupt accelerations Before I tried the above sketch. I cannot rule out my JRE or winXP OS being causes of error but it seems unlikely if the IDE/serial monitor works fine. I am using IDE v0.2
Thanks again. (sorry for the length of the description)