[riot-devel] xtimer problem

Theodore Kotsonis kotsonis at aueb.gr
Thu Apr 7 16:28:35 CEST 2016


Hi everyone

I am trying to use xtimer method. I want to calculate how much  
miliseconds do my function.
Is there any xtimer counter to use?

I tried to use uint43 xtimer_now before and after the method but when  
I do the subtraction I get the result but then I get an error on my  
board
Below is my code

     first_wakeup = xtimer_now();
     printf("%" PRIu32 "\n", first_wakeup);
     /*my method*/
     last_wakeup = xtimer_now();
     final_result = last_wakeup -
     printf("%.2" PRIu32 "\n", last_wakeup - first_wakeup);

and this is the error

2016-04-07 14:06:16,042 - INFO # Context before hardfault:
2016-04-07 14:06:16,043 - INFO #    r0: 0x00000000
2016-04-07 14:06:16,048 - INFO #    r1: 0xf134b7e4
2016-04-07 14:06:16,048 - INFO #    r2: 0x00000328
2016-04-07 14:06:16,054 - INFO #    r3: 0x2000018c
2016-04-07 14:06:16,055 - INFO #   r12: 0x00000000
2016-04-07 14:06:16,055 - INFO #    lr: 0x08000fd3
2016-04-07 14:06:16,055 - INFO #    pc: 0x08000fe4
2016-04-07 14:06:16,055 - INFO #   psr: 0x21000021
2016-04-07 14:06:16,056 - INFO #
2016-04-07 14:06:16,056 - INFO # FSR/FAR:
2016-04-07 14:06:16,060 - INFO #  CFSR: 0x00008200
2016-04-07 14:06:16,060 - INFO #  HFSR: 0x40000000
2016-04-07 14:06:16,061 - INFO #  DFSR: 0x00000008
2016-04-07 14:06:16,061 - INFO #  AFSR: 0x00000000
2016-04-07 14:06:16,066 - INFO #  BFAR: 0xf134b7e4
2016-04-07 14:06:16,066 - INFO # Misc
2016-04-07 14:06:16,066 - INFO # EXC_RET: 0xfffffff1
2016-04-07 14:06:16,078 - INFO # Attempting to reconstruct state for  
debugging...
2016-04-07 14:06:16,078 - INFO # In GDB:
2016-04-07 14:06:16,078 - INFO #   set $pc=0x8000fe4
2016-04-07 14:06:16,079 - INFO #   frame 0
2016-04-07 14:06:16,079 - INFO #   bt
2016-04-07 14:06:16,079 - INFO #
2016-04-07 14:06:16,079 - INFO # ISR stack overflowed by at least 48 bytes.

When I remove this line ( printf("%.2" PRIu32 "\n", last_wakeup -  
first_wakeup); )
my program run without an error


All the best
Theodore




More information about the devel mailing list