Re: [Tinyos-help] What does xx bytes in ROM, xx bytes in RAM and etc. mean?
On Sun, Mar 13, 2011 at 8:09 AM, Xiaohui Liu whu...@gmail.com wrote: yes. If a global variable is declared const it gets put into rom. What about global variables not declared as const? Where are they stored? If initilized, a global variable is put into the data section and the initilized value gets put into the initilizer block that is stored in ROM. ie. say we have a global uint16_t xyz. xyz will be located in the data section and 2 bytes in the ROM will be allocated and will hold the value that xyz should be initilized to.The data initilizer is copied into RAM by the start up code before main gets called. ie. uint16_t xyz = 0x5412; 0x5412 will be stored in the ROM and gets copied down by the start up code. If uninitilized the variable is allocated in .bss section. Which gets zero'd by the start up code. If a parameter to a function or a local variable is declared const it simply tells the compiler not to allow any writes to that object. If a global variable is initilized it goes into .data and there is a block of ROM that contains all the initilized data values. On start up this block is copied into the .data section that actually lives in RAM. If a global variable isn't initilized then it goes into the .bss section. It gets zero'd on start up. The name is ancient and comes from an old old old (maybe before you were born, gosh that's fun to say) IBM assembler directive. BAL (Basic Assembly Language). What is .bss? Google is your friend. I did a simple google search for what is .bss and got the answer. But that doesn't answer the question in the context you are asking. I don't know what to point you at. This is stuff I've picked up over the years. Probably by asking someone. Also I was in on this stuff when it was happening the first time. Sorry I don't have a better answer. -- Eric B. Decker Senior (over 50 :-) Researcher ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
[Tinyos-help] Java CLASSPATH problem again
Hello, After following advice in e.g. http://www.mail-archive.com/tinyos-help@millennium.berkeley.edu/msg36117.html Java still has problems finding packages/symbols, when compiling TestSerial If is set CLASSPATH to the .jar file, it cannot find the packages: - FNE@21TT14J /opt/tinyos-2.x/apps/tests/TestSerial $ printenv CLASSPATH c:\cygwin\opt\tinyos-2.x\support\sdk\java\tinyos.jar;. FNE@21TT14J /opt/tinyos-2.x/apps/tests/TestSerial $ make tinynode mkdir -p build/tinynode javac -target 1.4 -source 1.4 *.java TestSerial.java:35: package net.tinyos.message does not exist import net.tinyos.message.*; more errors - If is set CLASSPATH to the java path, it finds the packages, but not the symbols: FNE@21TT14J /opt/tinyos-2.x/apps/tests/TestSerial $ printenv CLASSPATH c:\cygwin\opt\tinyos-2.x\support\sdk\java;. FNE@21TT14J /opt/tinyos-2.x/apps/tests/TestSerial $ make tinynode mkdir -p build/tinynode javac -target 1.4 -source 1.4 *.java c:\cygwin\opt\tinyos-2.x\support\sdk\java\net\tinyos\message\Message.java:84: cannot find symbol symbol : class SerialPacket location: class net.tinyos.message.Message private SerialPacket serialPacket; more errors - Additional info: - FNE@21TT14J /opt/tinyos-2.x/support/sdk/java $ ls -l total 174 -rw-r--r-- 1 FNE mkgroup-l-d432 Aug 31 2007 Makefile -rw-r--r-- 1 FNE mkgroup-l-d 2750 Jul 12 2006 Makefile.include -rw-r--r-- 1 FNE mkgroup-l-d565 Aug 15 2007 build.xml drwxr-xr-x+ 3 FNE mkgroup-l-d 0 Jan 28 13:41 net -rwxr-xr-x 1 FNE mkgroup-l-d 168939 Mar 19 2010 tinyos.jar FNE@21TT14J /opt/tinyos-2.x/support/sdk/java $ which java /cygdrive/c/Program Files/Java/jdk1.6.0_23/bin/java FNE@21TT14J /opt/tinyos-2.x/support/sdk/java $ java -version java version 1.6.0_23 Java(TM) SE Runtime Environment (build 1.6.0_23-b05) Java HotSpot(TM) Client VM (build 19.0-b09, mixed mode, sharing) FNE@21TT14J /opt/tinyos-2.x/support/sdk/java $ which javac /cygdrive/c/Program Files/Java/jdk1.6.0_23/bin/javac -- Any suggestions? Is javac -target 1.4 -source 1.4 *.java wrong, when my actual java version is higher? Regards Flemming ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
Re: [Tinyos-help] Java CLASSPATH problem again
Hi, Unless you need to be compatible with older versions of Java you do not need to compile for version 1.4 (simply remove the -target and -source options). How did you install TinyOS? Clearly, your installation seems to be missing some files for the TinyOS Java libraries and tinyos.jar seems to be incomplete. Can you try the latest tinyos.jar from and let us know if this works? https://tinyos-main.googlecode.com/svn/trunk/support/sdk/java/tinyos.jar Cheers, Urs On 03/15/2011 10:43 AM, Flemming Nyboe wrote: Hello, After following advice in e.g. http://www.mail-archive.com/tinyos-help@millennium.berkeley.edu/msg36117.html Java still has problems finding packages/symbols, when compiling TestSerial If is set CLASSPATH to the .jar file, it cannot find the packages: - FNE@21TT14J /opt/tinyos-2.x/apps/tests/TestSerial $ printenv CLASSPATH c:\cygwin\opt\tinyos-2.x\support\sdk\java\tinyos.jar;. FNE@21TT14J /opt/tinyos-2.x/apps/tests/TestSerial $ make tinynode mkdir -p build/tinynode javac -target 1.4 -source 1.4 *.java TestSerial.java:35: package net.tinyos.message does not exist import net.tinyos.message.*; more errors - If is set CLASSPATH to the java path, it finds the packages, but not the symbols: FNE@21TT14J /opt/tinyos-2.x/apps/tests/TestSerial $ printenv CLASSPATH c:\cygwin\opt\tinyos-2.x\support\sdk\java;. FNE@21TT14J /opt/tinyos-2.x/apps/tests/TestSerial $ make tinynode mkdir -p build/tinynode javac -target 1.4 -source 1.4 *.java c:\cygwin\opt\tinyos-2.x\support\sdk\java\net\tinyos\message\Message.java:84: cannot find symbol symbol : class SerialPacket location: class net.tinyos.message.Message private SerialPacket serialPacket; more errors - Additional info: - FNE@21TT14J /opt/tinyos-2.x/support/sdk/java $ ls -l total 174 -rw-r--r-- 1 FNE mkgroup-l-d 432 Aug 31 2007 Makefile -rw-r--r-- 1 FNE mkgroup-l-d 2750 Jul 12 2006 Makefile.include -rw-r--r-- 1 FNE mkgroup-l-d 565 Aug 15 2007 build.xml drwxr-xr-x+ 3 FNE mkgroup-l-d 0 Jan 28 13:41 net -rwxr-xr-x 1 FNE mkgroup-l-d 168939 Mar 19 2010 tinyos.jar FNE@21TT14J /opt/tinyos-2.x/support/sdk/java $ which java /cygdrive/c/Program Files/Java/jdk1.6.0_23/bin/java FNE@21TT14J /opt/tinyos-2.x/support/sdk/java $ java -version java version 1.6.0_23 Java(TM) SE Runtime Environment (build 1.6.0_23-b05) Java HotSpot(TM) Client VM (build 19.0-b09, mixed mode, sharing) FNE@21TT14J /opt/tinyos-2.x/support/sdk/java $ which javac /cygdrive/c/Program Files/Java/jdk1.6.0_23/bin/javac -- Any suggestions? Is “javac -target 1.4 -source 1.4 *.java” wrong, when my actual java version is higher? Regards Flemming ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
Re: [Tinyos-help] Java CLASSPATH problem again
Hello Urs, Thanks for your quick response, this works. Brilliant. Regards Flemming -Original Message- From: Urs Hunkeler [mailto:urs.hunke...@epfl.ch] Sent: 15. marts 2011 11:28 To: Flemming Nyboe Cc: tinyos-help@millennium.berkeley.edu Subject: Re: [Tinyos-help] Java CLASSPATH problem again Hi, Unless you need to be compatible with older versions of Java you do not need to compile for version 1.4 (simply remove the -target and -source options). How did you install TinyOS? Clearly, your installation seems to be missing some files for the TinyOS Java libraries and tinyos.jar seems to be incomplete. Can you try the latest tinyos.jar from and let us know if this works? https://tinyos-main.googlecode.com/svn/trunk/support/sdk/java/tinyos.jar Cheers, Urs On 03/15/2011 10:43 AM, Flemming Nyboe wrote: Hello, After following advice in e.g. http://www.mail-archive.com/tinyos-help@millennium.berkeley.edu/msg361 17.html Java still has problems finding packages/symbols, when compiling TestSerial If is set CLASSPATH to the .jar file, it cannot find the packages: - FNE@21TT14J /opt/tinyos-2.x/apps/tests/TestSerial $ printenv CLASSPATH c:\cygwin\opt\tinyos-2.x\support\sdk\java\tinyos.jar;. FNE@21TT14J /opt/tinyos-2.x/apps/tests/TestSerial $ make tinynode mkdir -p build/tinynode javac -target 1.4 -source 1.4 *.java TestSerial.java:35: package net.tinyos.message does not exist import net.tinyos.message.*; more errors - If is set CLASSPATH to the java path, it finds the packages, but not the symbols: FNE@21TT14J /opt/tinyos-2.x/apps/tests/TestSerial $ printenv CLASSPATH c:\cygwin\opt\tinyos-2.x\support\sdk\java;. FNE@21TT14J /opt/tinyos-2.x/apps/tests/TestSerial $ make tinynode mkdir -p build/tinynode javac -target 1.4 -source 1.4 *.java c:\cygwin\opt\tinyos-2.x\support\sdk\java\net\tinyos\message\Message.java:84: cannot find symbol symbol : class SerialPacket location: class net.tinyos.message.Message private SerialPacket serialPacket; more errors - Additional info: - FNE@21TT14J /opt/tinyos-2.x/support/sdk/java $ ls -l total 174 -rw-r--r-- 1 FNE mkgroup-l-d 432 Aug 31 2007 Makefile -rw-r--r-- 1 FNE mkgroup-l-d 2750 Jul 12 2006 Makefile.include -rw-r--r-- 1 FNE mkgroup-l-d 565 Aug 15 2007 build.xml drwxr-xr-x+ 3 FNE mkgroup-l-d 0 Jan 28 13:41 net -rwxr-xr-x 1 FNE mkgroup-l-d 168939 Mar 19 2010 tinyos.jar FNE@21TT14J /opt/tinyos-2.x/support/sdk/java $ which java /cygdrive/c/Program Files/Java/jdk1.6.0_23/bin/java FNE@21TT14J /opt/tinyos-2.x/support/sdk/java $ java -version java version 1.6.0_23 Java(TM) SE Runtime Environment (build 1.6.0_23-b05) Java HotSpot(TM) Client VM (build 19.0-b09, mixed mode, sharing) FNE@21TT14J /opt/tinyos-2.x/support/sdk/java $ which javac /cygdrive/c/Program Files/Java/jdk1.6.0_23/bin/javac -- Any suggestions? Is javac -target 1.4 -source 1.4 *.java wrong, when my actual java version is higher? Regards Flemming ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
[Tinyos-help] LEACH Source Code
Hi all, I would like to know if LEACH is implemented in NesC and where the source code would be available. If any one has already implemented this LEACH code then can you please help me? Thanks in advance. ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
[Tinyos-help] Help needed regarding computation time calculation in Microseconds for Atmega128 Processor
I am using Timer3 as code posted below. I call startCounting() before a task executes and I call stopCounting after task executes. But, I am getting variable result. Is there any mistake in my code or somebody can provide code performing similar job. #include printf.h uint16_t coarseValues; uint16_t fineValues; uint16_t COARSECOMPARE = 0x7FFF; uint16_t fineOffset = 0x000E; uint16_t coarseOffset = 0x0021; uint16_t coarseWasCalled = 0; module ClockCount { provides { interface TaskCount as TC; } uses interface HplAtm128Compareuint16_t; } implementation { async event void HplAtm128Compare.fired() { TCCR3B = 0x00; atomic coarseWasCalled++; atomic coarseValues++; TCNT3 = 0x; //Counter3 clear TCCR3B = 0x09; } async command void TC.startCounting() { atomic coarseValues = 0; atomic fineValues = 0; //Actual Timer/Counter TCNT3 = 0x; //Set counter clear on match (Couter Control Registers) TCCR3A = 0x80; TCCR3B = 0x09; //Interupt mask set (Extended Timer Interrupt Mask Register) ETIMSK = 0x10; //Compare values (Output Compare Register) OCR3A = COARSECOMPARE; } void calculateFine() { uint16_t callOffset = (coarseWasCalled * coarseOffset)/COARSECOMPARE; //Was Commented atomic coarseValues = coarseValues + callOffset; if (coarseWasCalled) { atomic fineValues = TCNT3 - coarseOffset; atomic coarseWasCalled = 0; } else { //there is a 13 overhead on running the counter atomic fineValues = TCNT3 - fineOffset; } } async command void TC.stopCounting() { TCCR3B = 0x00; calculateFine(); } command unsigned int TC.getCoarseValue() {atomic return coarseValues;} command unsigned int TC.getFineValue() {atomic return fineValues; } command void TC.setCoarseCompare(uint16_t newCompare) { COARSECOMPARE = newCompare; OCR3A = newCompare; } command void TC.setFineOffset(uint16_t off) { atomic fineOffset = off; } command void TC.setCoarseOffset(uint16_t off) { atomic coarseOffset = off; } command void TC.sendValuesToScreen() { printf(Fine Value is %u:\n, fineValues); printf(Coarse Value is %u:\n, coarseValues); printfflush(); } } ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
[Tinyos-help] Question regarding computation time calculation for a task in MicroSeconds in Atmega128
I am using Timer3 as code posted below. I call startCounting() before a task executes and I call stopCounting after task executes. But, I am getting variable result. Is there any mistake in my code or somebody can provide code performing similar job. And, it is Atmega128 specific. #include printf.h uint16_t coarseValues; uint16_t fineValues; uint16_t COARSECOMPARE = 0x7FFF; uint16_t fineOffset = 0x000E; uint16_t coarseOffset = 0x0021; uint16_t coarseWasCalled = 0; module ClockCount { provides { interface TaskCount as TC; } uses interface HplAtm128Compareuint16_t; } implementation { async event void HplAtm128Compare.fired() { TCCR3B = 0x00; atomic coarseWasCalled++; atomic coarseValues++; TCNT3 = 0x; //Counter3 clear TCCR3B = 0x09; } async command void TC.startCounting() { atomic coarseValues = 0; atomic fineValues = 0; //Actual Timer/Counter TCNT3 = 0x; //Set counter clear on match (Couter Control Registers) TCCR3A = 0x80; TCCR3B = 0x09; //Interupt mask set (Extended Timer Interrupt Mask Register) ETIMSK = 0x10; //Compare values (Output Compare Register) OCR3A = COARSECOMPARE; } void calculateFine() { uint16_t callOffset = (coarseWasCalled * coarseOffset)/COARSECOMPARE; //Was Commented atomic coarseValues = coarseValues + callOffset; if (coarseWasCalled) { atomic fineValues = TCNT3 - coarseOffset; atomic coarseWasCalled = 0; } else { //there is a 13 overhead on running the counter atomic fineValues = TCNT3 - fineOffset; } } async command void TC.stopCounting() { TCCR3B = 0x00; calculateFine(); } command unsigned int TC.getCoarseValue() {atomic return coarseValues;} command unsigned int TC.getFineValue() {atomic return fineValues; } command void TC.setCoarseCompare(uint16_t newCompare) { COARSECOMPARE = newCompare; OCR3A = newCompare; } command void TC.setFineOffset(uint16_t off) { atomic fineOffset = off; } command void TC.setCoarseOffset(uint16_t off) { atomic coarseOffset = off; } command void TC.sendValuesToScreen() { printf(Fine Value is %u:\n, fineValues); printf(Coarse Value is %u:\n, coarseValues); printfflush(); } } Sobit B. Thapa Graduate Research Assistant Department of Computer Science Texas State University, San Marcos ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
Re: [Tinyos-help] Problem in adapting the Atmega 644 to Atmega 128 (Async Timer)
Just a correction: 'setInterrupt' function is at tos/chips/atm128/Atm128AlarmAsyncP.nc, not in Atm128AsyncTimerP.nc as i said in the previous message. Sorry for the mistake :-) ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
[Tinyos-help] MicaZ Responses
Hi, I'm working with MicaZ motes on TinyOS 2.0.1. My application is simple. I have one mote sending a broadcast message and other two responding to the first whenever they receive any message. Therefore, the first mote receive two messages almost at the same time. When running on TOSSIM, I noticed that they respond exactly at the same time. As the first mote can't receive two messages at the same time, it drops one of the messages. I solved this problem by using a timer on each mote that acts as a clock. The clock frequency is calculated using the node ID number, so every mote respond with different times. That works very well on the simulation and there was no problem when I tried on real motes. But that seems a poor solution as it is made on software. My question is: Is there any hardware that avoid that kind of problem on micaz? If there isn't, is there any other better software solution? Thanks in advance, Breno Rodrigues Guimaraes Federal University of Minas Gerais, Brazil. ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
Re: [Tinyos-help] MicaZ Responses
In general, lower level collision detection should minimize the number of attempts to send simultaneous messages. But if your two slave motes are out of range of each other they won't detect a collision. Or if they consistently try to transmit at _exactly_ the same time I guess they wouldn't detect a busy channel either. In my testing of mica2's I did something very similar to your system, sending a request from the base-station and having each re-Mote attempt to respond immediately. I didn't find a lot of dropped messages. I was not able to test multiple micaz's, so my results don't indicate a (larger) problem. If your system depends on the call-and-response model, probably having a short random delay before responding is your best option. MS Breno Guimarães wrote: Hi, I'm working with MicaZ motes on TinyOS 2.0.1. My application is simple. I have one mote sending a broadcast message and other two responding to the first whenever they receive any message. Therefore, the first mote receive two messages almost at the same time. When running on TOSSIM, I noticed that they respond exactly at the same time. As the first mote can't receive two messages at the same time, it drops one of the messages. I solved this problem by using a timer on each mote that acts as a clock. The clock frequency is calculated using the node ID number, so every mote respond with different times. That works very well on the simulation and there was no problem when I tried on real motes. But that seems a poor solution as it is made on software. My question is: Is there any hardware that avoid that kind of problem on micaz? If there isn't, is there any other better software solution? Thanks in advance, Breno Rodrigues Guimaraes Federal University of Minas Gerais, Brazil. ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
Re: [Tinyos-help] Question regarding computation time calculation for a task in MicroSeconds in Atmega128
How much do the results vary? There are other interrupts and such that happen during processing, so even a very regular foreground process might slip'n'slide a bit. At a cursory review level I'd think your code is probably OK, although I believe there is a counter wrap-around interrupt you could use for your coarse counter so you don't have to fool with the compare thing. I have some counter3 compare code here: http://www.etantdonnes.com/Motes/AVR128timers.zip if you want something to compare and contrast. MS Thapa, Sobit wrote: I am using Timer3 as code posted below. I call startCounting() before a task executes and I call stopCounting after task executes. But, I am getting variable result. Is there any mistake in my code or somebody can provide code performing similar job. And, it is Atmega128 specific. #include printf.h uint16_t coarseValues; uint16_t fineValues; uint16_t COARSECOMPARE = 0x7FFF; uint16_t fineOffset = 0x000E; uint16_t coarseOffset = 0x0021; uint16_t coarseWasCalled = 0; module ClockCount { provides { interface TaskCount as TC; } uses interface HplAtm128Compareuint16_t; } implementation { async event void HplAtm128Compare.fired() { TCCR3B = 0x00; atomic coarseWasCalled++; atomic coarseValues++; TCNT3 = 0x; //Counter3 clear TCCR3B = 0x09; } async command void TC.startCounting() { atomic coarseValues = 0; atomic fineValues = 0; //Actual Timer/Counter TCNT3 = 0x; //Set counter clear on match (Couter Control Registers) TCCR3A = 0x80; TCCR3B = 0x09; //Interupt mask set (Extended Timer Interrupt Mask Register) ETIMSK = 0x10; //Compare values (Output Compare Register) OCR3A = COARSECOMPARE; } void calculateFine() { uint16_t callOffset = (coarseWasCalled * coarseOffset)/COARSECOMPARE; //Was Commented atomic coarseValues = coarseValues + callOffset; if (coarseWasCalled) { atomic fineValues = TCNT3 - coarseOffset; atomic coarseWasCalled = 0; } else { //there is a 13 overhead on running the counter atomic fineValues = TCNT3 - fineOffset; } } async command void TC.stopCounting() { TCCR3B = 0x00; calculateFine(); } command unsigned int TC.getCoarseValue() {atomic return coarseValues;} command unsigned int TC.getFineValue() {atomic return fineValues; } command void TC.setCoarseCompare(uint16_t newCompare) { COARSECOMPARE = newCompare; OCR3A = newCompare; } command void TC.setFineOffset(uint16_t off) { atomic fineOffset = off; } command void TC.setCoarseOffset(uint16_t off) { atomic coarseOffset = off; } command void TC.sendValuesToScreen() { printf(Fine Value is %u:\n, fineValues); printf(Coarse Value is %u:\n, coarseValues); printfflush(); } } Sobit B. Thapa Graduate Research Assistant Department of Computer Science Texas State University, San Marcos ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
Re: [Tinyos-help] Question regarding computation time calculation for a task in MicroSeconds in Atmega128
Hi, Thank you very much for your valuable help. My results are varying so much as they are increasing continuously for same job when I distributed them among sensors. By the way, I did following to disable interrupts. ETIMSK = 0x10; It should work. Am I right? Regards, Sobit B. Thapa Graduate Research Assistant Department of Computer Science Texas State University, San Marcos From: Michael Schippling [sc...@santafe.edu] Sent: Tuesday, March 15, 2011 5:53 PM To: Thapa, Sobit Cc: tinyos-help-requ...@millennium.berkeley.edu; tinyos-help@millennium.berkeley.edu Subject: Re: [Tinyos-help] Question regarding computation time calculation for a task in MicroSeconds in Atmega128 How much do the results vary? There are other interrupts and such that happen during processing, so even a very regular foreground process might slip'n'slide a bit. At a cursory review level I'd think your code is probably OK, although I believe there is a counter wrap-around interrupt you could use for your coarse counter so you don't have to fool with the compare thing. I have some counter3 compare code here: http://www.etantdonnes.com/Motes/AVR128timers.zip if you want something to compare and contrast. MS Thapa, Sobit wrote: I am using Timer3 as code posted below. I call startCounting() before a task executes and I call stopCounting after task executes. But, I am getting variable result. Is there any mistake in my code or somebody can provide code performing similar job. And, it is Atmega128 specific. #include printf.h uint16_t coarseValues; uint16_t fineValues; uint16_t COARSECOMPARE = 0x7FFF; uint16_t fineOffset = 0x000E; uint16_t coarseOffset = 0x0021; uint16_t coarseWasCalled = 0; module ClockCount { provides { interface TaskCount as TC; } uses interface HplAtm128Compareuint16_t; } implementation { async event void HplAtm128Compare.fired() { TCCR3B = 0x00; atomic coarseWasCalled++; atomic coarseValues++; TCNT3 = 0x; //Counter3 clear TCCR3B = 0x09; } async command void TC.startCounting() { atomic coarseValues = 0; atomic fineValues = 0; //Actual Timer/Counter TCNT3 = 0x; //Set counter clear on match (Couter Control Registers) TCCR3A = 0x80; TCCR3B = 0x09; //Interupt mask set (Extended Timer Interrupt Mask Register) ETIMSK = 0x10; //Compare values (Output Compare Register) OCR3A = COARSECOMPARE; } void calculateFine() { uint16_t callOffset = (coarseWasCalled * coarseOffset)/COARSECOMPARE; //Was Commented atomic coarseValues = coarseValues + callOffset; if (coarseWasCalled) { atomic fineValues = TCNT3 - coarseOffset; atomic coarseWasCalled = 0; } else { //there is a 13 overhead on running the counter atomic fineValues = TCNT3 - fineOffset; } } async command void TC.stopCounting() { TCCR3B = 0x00; calculateFine(); } command unsigned int TC.getCoarseValue() {atomic return coarseValues;} command unsigned int TC.getFineValue() {atomic return fineValues; } command void TC.setCoarseCompare(uint16_t newCompare) { COARSECOMPARE = newCompare; OCR3A = newCompare; } command void TC.setFineOffset(uint16_t off) { atomic fineOffset = off; } command void TC.setCoarseOffset(uint16_t off) { atomic coarseOffset = off; } command void TC.sendValuesToScreen() { printf(Fine Value is %u:\n, fineValues); printf(Coarse Value is %u:\n, coarseValues); printfflush(); } } Sobit B. Thapa Graduate Research Assistant Department of Computer Science Texas State University, San Marcos ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
[Tinyos-help] Process aborted: xserve2/bin/xserve.exe problem
Hello, I am currently working with 2 MDA100CB sensor with iris MDA11 2.4 GHz, with low power gateway MIB520CB and I'm trying to use MoteView to monitor the motes. I didn’t get any sensor data in Moteview. The Serve Message is: XSERVE 2.0.E: $Id: xserve.c,v 1.8.2.3 2007/02/02 17:45:01 rkapur Exp $ Warning: Converting Windows COM4 device to Cygwin device. Using params: [db parsed] [xml parsed] [server port=9001] Opening serial device: /dev/ttyS3 @ 57600 Process aborted: xserve2/bin/xserve.exe Error message : [MV : 3/15/2011 9:09:30 PM] System.NullReferenceException: Object reference not set to an instance of an object. at XBow.Plugin.Topology.MoteMapIsoBar.DrawMoteGlow(UInt16 nodeid, String sensor) Would you have some suggestions to solve the problem ? Thank you -- Mlle Deuner-Oghlou Lingailé Etudiante en Maitrise cours en Génie Biomédical Ecole Polytechnique de Montréal ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
Re: [Tinyos-help] MicaZ Responses
On Mar 15, 2011, at 12:00 PM, Breno Guimarães wrote: Hi, I'm working with MicaZ motes on TinyOS 2.0.1. My application is simple. I have one mote sending a broadcast message and other two responding to the first whenever they receive any message. Therefore, the first mote receive two messages almost at the same time. When running on TOSSIM, I noticed that they respond exactly at the same time. As the first mote can't receive two messages at the same time, it drops one of the messages. I solved this problem by using a timer on each mote that acts as a clock. The clock frequency is calculated using the node ID number, so every mote respond with different times. That works very well on the simulation and there was no problem when I tried on real motes. But that seems a poor solution as it is made on software. My question is: Is there any hardware that avoid that kind of problem on micaz? If there isn't, is there any other better software solution? You're basically introducing time slots at a higher layer. That's a reasonable approach although it has limitations with respect to how many nodes it can support. Another approach is to just try retransmitting failed packets. The TinyOS MAC is such that if there are only 2 nodes it should not take more than a handful of retransmissions in the absolute worst case (unless you are sending very long packets). Phil ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help